forked from yaso_meth/mih-project
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
|
||||
if (businesses.isEmpty &&
|
||||
businessSearchController.text.isNotEmpty) {
|
||||
return Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 50),
|
||||
Icon(
|
||||
MihIcons.businessProfile,
|
||||
size: 165,
|
||||
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(),
|
||||
),
|
||||
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(
|
||||
favouriteBusinesses:
|
||||
@@ -241,6 +175,7 @@ class _MihFavouriteBusinessesState extends State<MihFavouriteBusinesses> {
|
||||
);
|
||||
} else {
|
||||
// This block handles the case where there are no bookmarked businesses initially
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
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) {
|
||||
return Center(
|
||||
|
||||
@@ -23,6 +23,7 @@ class BuildLoyaltyCardList extends StatefulWidget {
|
||||
final int navIndex;
|
||||
final MihBannerAd? bannerAd;
|
||||
final bool favouritesMode;
|
||||
final TextEditingController searchText;
|
||||
final void Function()? onCardViewClose;
|
||||
|
||||
const BuildLoyaltyCardList({
|
||||
@@ -31,6 +32,7 @@ class BuildLoyaltyCardList extends StatefulWidget {
|
||||
required this.cardList,
|
||||
required this.navIndex,
|
||||
required this.favouritesMode,
|
||||
required this.searchText,
|
||||
this.bannerAd,
|
||||
this.onCardViewClose,
|
||||
});
|
||||
@@ -527,6 +529,30 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
||||
);
|
||||
} else {
|
||||
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(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Column(
|
||||
|
||||
@@ -64,6 +64,7 @@ class _MihCardFavouritesState extends State<MihCardFavourites> {
|
||||
navIndex: 0,
|
||||
bannerAd: _bannerAd,
|
||||
favouritesMode: true,
|
||||
searchText: TextEditingController(),
|
||||
onCardViewClose: () {
|
||||
setState(() {
|
||||
_bannerAd = MihBannerAd();
|
||||
|
||||
@@ -373,6 +373,7 @@ class _MihCardsState extends State<MihCards> {
|
||||
navIndex: 0,
|
||||
bannerAd: _bannerAd,
|
||||
favouritesMode: false,
|
||||
searchText: cardSearchController,
|
||||
onCardViewClose: () {
|
||||
setState(() {
|
||||
_bannerAd = MihBannerAd();
|
||||
|
||||
Reference in New Issue
Block a user