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(
padding:
const EdgeInsets.symmetric(horizontal: 10.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
const SizedBox(height: 50), const SizedBox(height: 50),
Icon( Icon(
Icons MihIcons.businessProfile,
.search_off_rounded, // A different icon for "no results" size: 165,
size: 150,
color: MzansiInnovationHub.of(context)! color: MzansiInnovationHub.of(context)!
.theme .theme
.secondaryColor(), .secondaryColor(),
), ),
Padding( const SizedBox(height: 10),
padding: const EdgeInsets.symmetric( Text(
horizontal: 10.0), "No Businesses added to your Favourites",
child: SizedBox(
width: 500,
child: Text(
"No businesses found for '${businessSearchController.text}'", // Specific message for no search results
textAlign: TextAlign.center, textAlign: TextAlign.center,
overflow: TextOverflow.visible,
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 25,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
),
),
),
),
],
);
} 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)! color: MzansiInnovationHub.of(context)!
.theme .theme
.secondaryColor(), .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,
), ),
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:
@@ -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(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
const SizedBox(height: 50), const SizedBox(height: 50),
Icon( Icon(
Icons.business_center_rounded, MihIcons.businessProfile,
size: 150, size: 165,
color: MzansiInnovationHub.of(context)! color: MzansiInnovationHub.of(context)!
.theme .theme
.secondaryColor(), .secondaryColor(),
), ),
Padding( const SizedBox(height: 10),
padding: const EdgeInsets.symmetric(horizontal: 10.0), Text(
child: SizedBox( "No Businesses added to your Favourites",
width: 500,
child: Text(
"No favourites yet, use Mzansi Search to find and bookmark businesses you like",
textAlign: TextAlign.center, textAlign: TextAlign.center,
overflow: TextOverflow.visible,
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 25,
fontWeight: FontWeight.bold, 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,
// ),
// ),
// ),
// ),
// ],
// );
} }
} else if (snapshot.hasError) { } else if (snapshot.hasError) {
return Center( return Center(

View File

@@ -282,7 +282,9 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
], ],
); );
} else if (!snapshot.hasData) { } else if (!snapshot.hasData) {
return Column( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
@@ -295,18 +297,74 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
Text( Text(
"People Of Mzansi!", "Search for People Of Mzansi!",
textAlign: TextAlign.center, textAlign: TextAlign.center,
overflow: TextOverflow.visible, overflow: TextOverflow.visible,
style: TextStyle( style: TextStyle(
fontSize: 25, fontSize: 25,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: color: MzansiInnovationHub.of(context)!
MzansiInnovationHub.of(context)!.theme.secondaryColor(), .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(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
const SizedBox(height: 50), const SizedBox(height: 50),
Icon( Icon(
MihIcons.businessProfile, MihIcons.personalProfile,
size: 165, size: 165,
color: color:
MzansiInnovationHub.of(context)!.theme.secondaryColor(), MzansiInnovationHub.of(context)!.theme.secondaryColor(),
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
Text( Text(
"Businesses Of Mzansi!", "Search for Business Of Mzansi!",
textAlign: TextAlign.center, textAlign: TextAlign.center,
overflow: TextOverflow.visible, overflow: TextOverflow.visible,
style: TextStyle( style: TextStyle(
fontSize: 25, fontSize: 25,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: color: MzansiInnovationHub.of(context)!
MzansiInnovationHub.of(context)!.theme.secondaryColor(), .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(