fix when there is data and you are serching
This commit is contained in:
@@ -140,97 +140,31 @@ class _MihFavouriteBusinessesState extends State<MihFavouriteBusinesses> {
|
|||||||
// Display message if no results after search
|
// Display message if no results after search
|
||||||
if (businesses.isEmpty &&
|
if (businesses.isEmpty &&
|
||||||
businessSearchController.text.isNotEmpty) {
|
businessSearchController.text.isNotEmpty) {
|
||||||
return Padding(
|
return Column(
|
||||||
padding:
|
children: [
|
||||||
const EdgeInsets.symmetric(horizontal: 10.0),
|
const SizedBox(height: 50),
|
||||||
child: Column(
|
Icon(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
MihIcons.iDontKnow,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
size: 165,
|
||||||
children: [
|
color: MzansiInnovationHub.of(context)!
|
||||||
const SizedBox(height: 50),
|
.theme
|
||||||
Icon(
|
.secondaryColor(),
|
||||||
MihIcons.businessProfile,
|
),
|
||||||
size: 165,
|
const SizedBox(height: 10),
|
||||||
|
Text(
|
||||||
|
"Let's Try Refining Your Search",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
overflow: TextOverflow.visible,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 25,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
color: MzansiInnovationHub.of(context)!
|
color: MzansiInnovationHub.of(context)!
|
||||||
.theme
|
.theme
|
||||||
.secondaryColor(),
|
.secondaryColor(),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
),
|
||||||
Text(
|
],
|
||||||
"No Businesses added to your Favourites",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
overflow: TextOverflow.visible,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 25,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: MzansiInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.secondaryColor(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
Center(
|
|
||||||
child: RichText(
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
text: TextSpan(
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.normal,
|
|
||||||
color: MzansiInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.secondaryColor(),
|
|
||||||
),
|
|
||||||
children: [
|
|
||||||
TextSpan(text: "Use the Mzansi Search"),
|
|
||||||
// WidgetSpan(
|
|
||||||
// alignment:
|
|
||||||
// PlaceholderAlignment.middle,
|
|
||||||
// child: Icon(
|
|
||||||
// Icons.search,
|
|
||||||
// size: 20,
|
|
||||||
// color:
|
|
||||||
// MzansiInnovationHub.of(context)!
|
|
||||||
// .theme
|
|
||||||
// .secondaryColor(),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
TextSpan(
|
|
||||||
text:
|
|
||||||
" to find Businesses of Mzansi"),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
// return Column(
|
|
||||||
// children: [
|
|
||||||
// const SizedBox(height: 50),
|
|
||||||
// Icon(
|
|
||||||
// Icons.business_center_rounded,
|
|
||||||
// size: 150,
|
|
||||||
// color: MzansiInnovationHub.of(context)!
|
|
||||||
// .theme
|
|
||||||
// .secondaryColor(),
|
|
||||||
// ),
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.symmetric(
|
|
||||||
// horizontal: 10.0),
|
|
||||||
// child: SizedBox(
|
|
||||||
// width: 500,
|
|
||||||
// child: Text(
|
|
||||||
// "No favourites yet, use Mzansi Search to find and bookmark businesses you like",
|
|
||||||
// textAlign: TextAlign.center,
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 18,
|
|
||||||
// fontWeight: FontWeight.bold,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
return BuildFavouriteBusinessesList(
|
return BuildFavouriteBusinessesList(
|
||||||
favouriteBusinesses:
|
favouriteBusinesses:
|
||||||
@@ -241,6 +175,7 @@ class _MihFavouriteBusinessesState extends State<MihFavouriteBusinesses> {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
// This block handles the case where there are no bookmarked businesses initially
|
// This block handles the case where there are no bookmarked businesses initially
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -303,32 +238,6 @@ class _MihFavouriteBusinessesState extends State<MihFavouriteBusinesses> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
// return Column(
|
|
||||||
// children: [
|
|
||||||
// const SizedBox(height: 50),
|
|
||||||
// Icon(
|
|
||||||
// Icons.business_center_rounded,
|
|
||||||
// size: 150,
|
|
||||||
// color: MzansiInnovationHub.of(context)!
|
|
||||||
// .theme
|
|
||||||
// .secondaryColor(),
|
|
||||||
// ),
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
|
||||||
// child: SizedBox(
|
|
||||||
// width: 500,
|
|
||||||
// child: Text(
|
|
||||||
// "No favourites yet, use Mzansi Search to find and bookmark businesses you like",
|
|
||||||
// textAlign: TextAlign.center,
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 18,
|
|
||||||
// fontWeight: FontWeight.bold,
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// );
|
|
||||||
}
|
}
|
||||||
} else if (snapshot.hasError) {
|
} else if (snapshot.hasError) {
|
||||||
return Center(
|
return Center(
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ class BuildLoyaltyCardList extends StatefulWidget {
|
|||||||
final int navIndex;
|
final int navIndex;
|
||||||
final MihBannerAd? bannerAd;
|
final MihBannerAd? bannerAd;
|
||||||
final bool favouritesMode;
|
final bool favouritesMode;
|
||||||
|
final TextEditingController searchText;
|
||||||
final void Function()? onCardViewClose;
|
final void Function()? onCardViewClose;
|
||||||
|
|
||||||
const BuildLoyaltyCardList({
|
const BuildLoyaltyCardList({
|
||||||
@@ -31,6 +32,7 @@ class BuildLoyaltyCardList extends StatefulWidget {
|
|||||||
required this.cardList,
|
required this.cardList,
|
||||||
required this.navIndex,
|
required this.navIndex,
|
||||||
required this.favouritesMode,
|
required this.favouritesMode,
|
||||||
|
required this.searchText,
|
||||||
this.bannerAd,
|
this.bannerAd,
|
||||||
this.onCardViewClose,
|
this.onCardViewClose,
|
||||||
});
|
});
|
||||||
@@ -527,6 +529,30 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
if (!widget.favouritesMode) {
|
if (!widget.favouritesMode) {
|
||||||
|
if (widget.searchText.text.isNotEmpty) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 50),
|
||||||
|
Icon(
|
||||||
|
MihIcons.iDontKnow,
|
||||||
|
size: 165,
|
||||||
|
color: MzansiInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Text(
|
||||||
|
"Let's Try Refining Your Search",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
overflow: TextOverflow.visible,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 25,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color:
|
||||||
|
MzansiInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ class _MihCardFavouritesState extends State<MihCardFavourites> {
|
|||||||
navIndex: 0,
|
navIndex: 0,
|
||||||
bannerAd: _bannerAd,
|
bannerAd: _bannerAd,
|
||||||
favouritesMode: true,
|
favouritesMode: true,
|
||||||
|
searchText: TextEditingController(),
|
||||||
onCardViewClose: () {
|
onCardViewClose: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_bannerAd = MihBannerAd();
|
_bannerAd = MihBannerAd();
|
||||||
|
|||||||
@@ -373,6 +373,7 @@ class _MihCardsState extends State<MihCards> {
|
|||||||
navIndex: 0,
|
navIndex: 0,
|
||||||
bannerAd: _bannerAd,
|
bannerAd: _bannerAd,
|
||||||
favouritesMode: false,
|
favouritesMode: false,
|
||||||
|
searchText: cardSearchController,
|
||||||
onCardViewClose: () {
|
onCardViewClose: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_bannerAd = MihBannerAd();
|
_bannerAd = MihBannerAd();
|
||||||
|
|||||||
Reference in New Issue
Block a user