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/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_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_search_bar.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
if (businesses.isEmpty &&
businessSearchController.text.isNotEmpty) {
return Column(
children: [
const SizedBox(height: 50),
Icon(
Icons
.search_off_rounded, // A different icon for "no results"
size: 150,
color: MzansiInnovationHub.of(context)!
.theme
.secondaryColor(),
),
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 10.0),
child: SizedBox(
width: 500,
child: Text(
"No businesses found for '${businessSearchController.text}'", // Specific message for no search results
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,
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,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
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"),
],
),
),
),
),
],
);
} 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(
favouriteBusinesses:
@@ -206,32 +241,94 @@ class _MihFavouriteBusinessesState extends State<MihFavouriteBusinesses> {
);
} else {
// This block handles the case where there are no bookmarked businesses initially
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",
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,
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,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
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) {
return Center(

View File

@@ -282,31 +282,89 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
],
);
} else if (!snapshot.hasData) {
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,
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: 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(
"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 &&
snapshot.hasData &&
snapshot.requireData!.isEmpty) {
@@ -400,30 +458,92 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
],
);
} else if (!snapshot.hasData) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 50),
Icon(
MihIcons.businessProfile,
size: 165,
color:
MzansiInnovationHub.of(context)!.theme.secondaryColor(),
),
const SizedBox(height: 10),
Text(
"Businesses Of Mzansi!",
textAlign: TextAlign.center,
overflow: TextOverflow.visible,
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.bold,
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: 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(
"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 {
return Center(