Mzansi Directory No data message enhanced

This commit is contained in:
2025-08-07 10:44:55 +02:00
parent 1caf8aaf7b
commit 3cf3bb98ba
2 changed files with 332 additions and 115 deletions

View File

@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:mzansi_innovation_hub/main.dart'; import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_objects/bookmarked_business.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/bookmarked_business.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_objects/business.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_objects/business.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_icons.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tool_body.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_package_tool_body.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_search_bar.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_search_bar.dart';
import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_single_child_scroll.dart'; import 'package:mzansi_innovation_hub/mih_components/mih_package_components/mih_single_child_scroll.dart';
@@ -139,63 +140,97 @@ 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 Column( return Padding(
children: [ padding:
const SizedBox(height: 50), const EdgeInsets.symmetric(horizontal: 10.0),
Icon( child: Column(
Icons mainAxisAlignment: MainAxisAlignment.center,
.search_off_rounded, // A different icon for "no results" crossAxisAlignment: CrossAxisAlignment.center,
size: 150, children: [
color: MzansiInnovationHub.of(context)! const SizedBox(height: 50),
.theme Icon(
.secondaryColor(), MihIcons.businessProfile,
), size: 165,
Padding( color: MzansiInnovationHub.of(context)!
padding: const EdgeInsets.symmetric( .theme
horizontal: 10.0), .secondaryColor(),
child: SizedBox( ),
width: 500, const SizedBox(height: 10),
child: Text( Text(
"No businesses found for '${businessSearchController.text}'", // Specific message for no search results "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, textAlign: TextAlign.center,
style: TextStyle( text: TextSpan(
fontSize: 18, style: TextStyle(
fontWeight: FontWeight.bold, 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"),
],
), ),
), ),
), ),
), ],
], ),
);
} else if (businesses.isEmpty) {
// Initial empty state
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 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:
@@ -206,32 +241,94 @@ 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 Column( return Padding(
children: [ padding: const EdgeInsets.symmetric(horizontal: 10.0),
const SizedBox(height: 50), child: Column(
Icon( mainAxisAlignment: MainAxisAlignment.center,
Icons.business_center_rounded, crossAxisAlignment: CrossAxisAlignment.center,
size: 150, children: [
color: MzansiInnovationHub.of(context)! const SizedBox(height: 50),
.theme Icon(
.secondaryColor(), MihIcons.businessProfile,
), size: 165,
Padding( color: MzansiInnovationHub.of(context)!
padding: const EdgeInsets.symmetric(horizontal: 10.0), .theme
child: SizedBox( .secondaryColor(),
width: 500, ),
child: Text( const SizedBox(height: 10),
"No favourites yet, use Mzansi Search to find and bookmark businesses you like", 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, textAlign: TextAlign.center,
style: TextStyle( text: TextSpan(
fontSize: 18, style: TextStyle(
fontWeight: FontWeight.bold, 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,
// ),
// ),
// ),
// ),
// ],
// );
} }
} else if (snapshot.hasError) { } else if (snapshot.hasError) {
return Center( return Center(

View File

@@ -282,31 +282,89 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
], ],
); );
} else if (!snapshot.hasData) { } else if (!snapshot.hasData) {
return Column( return Padding(
mainAxisAlignment: MainAxisAlignment.center, padding: const EdgeInsets.symmetric(horizontal: 10.0),
crossAxisAlignment: CrossAxisAlignment.center, child: Column(
children: [ mainAxisAlignment: MainAxisAlignment.center,
const SizedBox(height: 50), crossAxisAlignment: CrossAxisAlignment.center,
Icon( children: [
MihIcons.personalProfile, const SizedBox(height: 50),
size: 165, Icon(
color: MihIcons.personalProfile,
MzansiInnovationHub.of(context)!.theme.secondaryColor(), size: 165,
),
const SizedBox(height: 10),
Text(
"People Of Mzansi!",
textAlign: TextAlign.center,
overflow: TextOverflow.visible,
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: color:
MzansiInnovationHub.of(context)!.theme.secondaryColor(), MzansiInnovationHub.of(context)!.theme.secondaryColor(),
), ),
), const SizedBox(height: 10),
], Text(
"Search for People Of Mzansi!",
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: "Press "),
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Icon(
Icons.swap_horiz_rounded,
size: 20,
color: MzansiInnovationHub.of(context)!
.theme
.secondaryColor(),
),
),
TextSpan(text: " to search for Businesses of Mzansi"),
],
),
),
),
],
),
); );
// return Column(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// const SizedBox(height: 50),
// Icon(
// MihIcons.personalProfile,
// size: 165,
// color:
// MzansiInnovationHub.of(context)!.theme.secondaryColor(),
// ),
// const SizedBox(height: 10),
// Text(
// "People Of Mzansi!",
// textAlign: TextAlign.center,
// overflow: TextOverflow.visible,
// style: TextStyle(
// fontSize: 25,
// fontWeight: FontWeight.bold,
// color:
// MzansiInnovationHub.of(context)!.theme.secondaryColor(),
// ),
// ),
// ],
// );
} else if (snapshot.connectionState == ConnectionState.done && } else if (snapshot.connectionState == ConnectionState.done &&
snapshot.hasData && snapshot.hasData &&
snapshot.requireData!.isEmpty) { snapshot.requireData!.isEmpty) {
@@ -400,30 +458,92 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
], ],
); );
} else if (!snapshot.hasData) { } else if (!snapshot.hasData) {
return Column( return Padding(
mainAxisAlignment: MainAxisAlignment.center, padding: const EdgeInsets.symmetric(horizontal: 10.0),
crossAxisAlignment: CrossAxisAlignment.center, child: Column(
children: [ mainAxisAlignment: MainAxisAlignment.center,
const SizedBox(height: 50), crossAxisAlignment: CrossAxisAlignment.center,
Icon( children: [
MihIcons.businessProfile, const SizedBox(height: 50),
size: 165, Icon(
color: MihIcons.personalProfile,
MzansiInnovationHub.of(context)!.theme.secondaryColor(), size: 165,
),
const SizedBox(height: 10),
Text(
"Businesses Of Mzansi!",
textAlign: TextAlign.center,
overflow: TextOverflow.visible,
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
color: color:
MzansiInnovationHub.of(context)!.theme.secondaryColor(), MzansiInnovationHub.of(context)!.theme.secondaryColor(),
), ),
), const SizedBox(height: 10),
], Text(
"Search for Business Of Mzansi!",
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: "Press "),
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Icon(
Icons.swap_horiz_rounded,
size: 20,
color: MzansiInnovationHub.of(context)!
.theme
.secondaryColor(),
),
),
TextSpan(text: " to search for People of Mzansi"),
],
),
),
),
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: "Press "),
WidgetSpan(
alignment: PlaceholderAlignment.middle,
child: Icon(
Icons.filter_list_rounded,
size: 20,
color: MzansiInnovationHub.of(context)!
.theme
.secondaryColor(),
),
),
TextSpan(text: " to filter business types"),
],
),
),
),
],
),
); );
} else { } else {
return Center( return Center(