BUG: fav bus view fix performace pt 2
This commit is contained in:
@@ -27,8 +27,8 @@ class _BuildBusinessSearchResultsListState
|
|||||||
builder: (BuildContext context, MzansiDirectoryProvider directoryProvider,
|
builder: (BuildContext context, MzansiDirectoryProvider directoryProvider,
|
||||||
Widget? child) {
|
Widget? child) {
|
||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
shrinkWrap: true,
|
// shrinkWrap: true,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
// physics: const NeverScrollableScrollPhysics(),
|
||||||
itemCount: widget.businessList.length,
|
itemCount: widget.businessList.length,
|
||||||
separatorBuilder: (BuildContext context, index) {
|
separatorBuilder: (BuildContext context, index) {
|
||||||
return Divider(
|
return Divider(
|
||||||
|
|||||||
@@ -27,8 +27,8 @@ class _BuildUserSearchResultsListState
|
|||||||
builder: (BuildContext context, MzansiDirectoryProvider directoryProvider,
|
builder: (BuildContext context, MzansiDirectoryProvider directoryProvider,
|
||||||
Widget? child) {
|
Widget? child) {
|
||||||
return ListView.separated(
|
return ListView.separated(
|
||||||
shrinkWrap: true,
|
// shrinkWrap: true,
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
// physics: const NeverScrollableScrollPhysics(),
|
||||||
itemCount: widget.userList.length,
|
itemCount: widget.userList.length,
|
||||||
separatorBuilder: (BuildContext context, index) {
|
separatorBuilder: (BuildContext context, index) {
|
||||||
return Divider(
|
return Divider(
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:geolocator/geolocator.dart';
|
import 'package:geolocator/geolocator.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
@@ -30,6 +31,8 @@ class _MzansiDirectoryState extends State<MzansiDirectory> {
|
|||||||
bool _isLoadingInitialData = true;
|
bool _isLoadingInitialData = true;
|
||||||
late Future<Position?> futurePosition =
|
late Future<Position?> futurePosition =
|
||||||
MIHLocationAPI().getGPSPosition(context);
|
MIHLocationAPI().getGPSPosition(context);
|
||||||
|
late final MihSearchMzansi _searchTool;
|
||||||
|
late final MihFavouriteBusinesses _favouritesTool;
|
||||||
|
|
||||||
Future<void> _loadInitialData() async {
|
Future<void> _loadInitialData() async {
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -72,8 +75,9 @@ class _MzansiDirectoryState extends State<MzansiDirectory> {
|
|||||||
.then((business) async {
|
.then((business) async {
|
||||||
favBus.add(business!);
|
favBus.add(business!);
|
||||||
businessLogoUrl = await MihFileApi.getMinioFileUrl(business.logo_path);
|
businessLogoUrl = await MihFileApi.getMinioFileUrl(business.logo_path);
|
||||||
favBusImages[business.business_id] =
|
favBusImages[business.business_id] = businessLogoUrl != ""
|
||||||
businessLogoUrl != "" ? NetworkImage(businessLogoUrl) : null;
|
? CachedNetworkImageProvider(businessLogoUrl)
|
||||||
|
: null;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
directoryProvider.setFavouriteBusinesses(
|
directoryProvider.setFavouriteBusinesses(
|
||||||
@@ -133,6 +137,8 @@ class _MzansiDirectoryState extends State<MzansiDirectory> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
_searchTool = const MihSearchMzansi();
|
||||||
|
_favouritesTool = const MihFavouriteBusinesses();
|
||||||
_loadInitialData();
|
_loadInitialData();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,12 +169,10 @@ class _MzansiDirectoryState extends State<MzansiDirectory> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> getToolBody() {
|
List<Widget> getToolBody() {
|
||||||
List<Widget> toolBodies = [];
|
return [
|
||||||
toolBodies.addAll([
|
_searchTool,
|
||||||
MihSearchMzansi(),
|
_favouritesTool,
|
||||||
MihFavouriteBusinesses(),
|
];
|
||||||
]);
|
|
||||||
return toolBodies;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MihPackageAction getAction() {
|
MihPackageAction getAction() {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:ken_logger/ken_logger.dart';
|
import 'package:ken_logger/ken_logger.dart';
|
||||||
import 'package:mzansi_innovation_hub/main.dart';
|
import 'package:mzansi_innovation_hub/main.dart';
|
||||||
@@ -86,8 +87,9 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
|
|||||||
KenLogger.success("Business Logo Path: ${user.pro_pic_path}");
|
KenLogger.success("Business Logo Path: ${user.pro_pic_path}");
|
||||||
usernProPicUrl = await MihFileApi.getMinioFileUrl(user.pro_pic_path);
|
usernProPicUrl = await MihFileApi.getMinioFileUrl(user.pro_pic_path);
|
||||||
KenLogger.success("Business Logo Path: ${user.pro_pic_path}");
|
KenLogger.success("Business Logo Path: ${user.pro_pic_path}");
|
||||||
userImages[user.app_id] =
|
userImages[user.app_id] = usernProPicUrl != ""
|
||||||
usernProPicUrl != "" ? NetworkImage(usernProPicUrl) : null;
|
? CachedNetworkImageProvider(usernProPicUrl)
|
||||||
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
directoryProvider.setSearchedUsers(
|
directoryProvider.setSearchedUsers(
|
||||||
@@ -111,8 +113,9 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
|
|||||||
KenLogger.success("Business Logo Path: ${bus.logo_path}");
|
KenLogger.success("Business Logo Path: ${bus.logo_path}");
|
||||||
businessLogoUrl = await MihFileApi.getMinioFileUrl(bus.logo_path);
|
businessLogoUrl = await MihFileApi.getMinioFileUrl(bus.logo_path);
|
||||||
KenLogger.success("Business Logo Path: ${bus.logo_path}");
|
KenLogger.success("Business Logo Path: ${bus.logo_path}");
|
||||||
busImages[bus.business_id] =
|
busImages[bus.business_id] = businessLogoUrl != ""
|
||||||
businessLogoUrl != "" ? NetworkImage(businessLogoUrl) : null;
|
? CachedNetworkImageProvider(businessLogoUrl)
|
||||||
|
: null;
|
||||||
}
|
}
|
||||||
directoryProvider.setSearchedBusinesses(
|
directoryProvider.setSearchedBusinesses(
|
||||||
searchedBusinesses: businessSearchResults,
|
searchedBusinesses: businessSearchResults,
|
||||||
@@ -158,146 +161,155 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
|
|||||||
return Consumer2<MzansiProfileProvider, MzansiDirectoryProvider>(
|
return Consumer2<MzansiProfileProvider, MzansiDirectoryProvider>(
|
||||||
builder: (BuildContext context, MzansiProfileProvider profileProvider,
|
builder: (BuildContext context, MzansiProfileProvider profileProvider,
|
||||||
MzansiDirectoryProvider directoryProvider, Widget? child) {
|
MzansiDirectoryProvider directoryProvider, Widget? child) {
|
||||||
return MihSingleChildScroll(
|
return Column(
|
||||||
child: Column(
|
children: [
|
||||||
children: [
|
Text(
|
||||||
Padding(
|
directoryProvider.personalSearch
|
||||||
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
? "People Search"
|
||||||
child: Row(
|
: "Businesses Search",
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
|
||||||
children: [
|
),
|
||||||
Expanded(
|
const SizedBox(height: 10),
|
||||||
child: MihSearchBar(
|
Padding(
|
||||||
controller: mzansiSearchController,
|
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||||
hintText: "Search Mzansi",
|
child: Row(
|
||||||
prefixIcon: Icons.search,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
prefixAltIcon: directoryProvider.personalSearch
|
children: [
|
||||||
? Icons.person
|
Expanded(
|
||||||
: Icons.business,
|
child: MihSearchBar(
|
||||||
suffixTools: [
|
controller: mzansiSearchController,
|
||||||
IconButton(
|
hintText: "Search Mzansi",
|
||||||
|
prefixIcon: Icons.search,
|
||||||
|
prefixAltIcon: directoryProvider.personalSearch
|
||||||
|
? Icons.person
|
||||||
|
: Icons.business,
|
||||||
|
suffixTools: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
swapPressed(profileProvider, directoryProvider);
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
Icons.swap_horiz_rounded,
|
||||||
|
size: 35,
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
fillColor: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
hintColor: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
onPrefixIconTap: () {
|
||||||
|
searchPressed(profileProvider, directoryProvider);
|
||||||
|
},
|
||||||
|
onClearIconTap: () {
|
||||||
|
clearAll(directoryProvider);
|
||||||
|
},
|
||||||
|
searchFocusNode: searchFocusNode,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Visibility(
|
||||||
|
visible: !directoryProvider.personalSearch,
|
||||||
|
child: const SizedBox(width: 10),
|
||||||
|
),
|
||||||
|
Visibility(
|
||||||
|
visible: !directoryProvider.personalSearch,
|
||||||
|
child: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
if (filterOn) {
|
||||||
|
clearAll(directoryProvider);
|
||||||
|
}
|
||||||
|
setState(() {
|
||||||
|
filterOn = !filterOn;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
icon: Icon(
|
||||||
|
!filterOn
|
||||||
|
? Icons.filter_list_rounded
|
||||||
|
: Icons.filter_list_off_rounded,
|
||||||
|
size: 35,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
FutureBuilder(
|
||||||
|
future: availableBusinessTypes,
|
||||||
|
builder: (context, asyncSnapshot) {
|
||||||
|
List<String> options = [];
|
||||||
|
if (asyncSnapshot.connectionState == ConnectionState.done) {
|
||||||
|
options.addAll(asyncSnapshot.data!);
|
||||||
|
}
|
||||||
|
return Visibility(
|
||||||
|
visible: filterOn,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: MihDropdownField(
|
||||||
|
controller: businessTypeController,
|
||||||
|
hintText: "Business Type",
|
||||||
|
dropdownOptions: options,
|
||||||
|
requiredText: true,
|
||||||
|
editable: true,
|
||||||
|
enableSearch: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
MihButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
swapPressed(profileProvider, directoryProvider);
|
if (businessTypeController.text.isNotEmpty) {
|
||||||
|
searchPressed(
|
||||||
|
profileProvider, directoryProvider);
|
||||||
|
} else {
|
||||||
|
MihAlertServices().errorBasicAlert(
|
||||||
|
"Business Type Not Selected",
|
||||||
|
"Please ensure you have selected a Business Type before seareching for Businesses of Mzansi",
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
icon: Icon(
|
buttonColor: MihColors.getGreenColor(
|
||||||
Icons.swap_horiz_rounded,
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
size: 35,
|
"Dark"),
|
||||||
color: MihColors.getPrimaryColor(
|
elevation: 10,
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
child: Text(
|
||||||
"Dark"),
|
"Search",
|
||||||
|
style: TextStyle(
|
||||||
|
color: MihColors.getPrimaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.mode ==
|
||||||
|
"Dark"),
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
fillColor: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
hintColor: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
onPrefixIconTap: () {
|
|
||||||
searchPressed(profileProvider, directoryProvider);
|
|
||||||
},
|
|
||||||
onClearIconTap: () {
|
|
||||||
clearAll(directoryProvider);
|
|
||||||
},
|
|
||||||
searchFocusNode: searchFocusNode,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Visibility(
|
);
|
||||||
visible: !directoryProvider.personalSearch,
|
}),
|
||||||
child: const SizedBox(width: 10),
|
const SizedBox(height: 10),
|
||||||
),
|
Expanded(
|
||||||
Visibility(
|
child: directoryProvider.personalSearch
|
||||||
visible: !directoryProvider.personalSearch,
|
? displayPersonalSearchResults(directoryProvider)
|
||||||
child: IconButton(
|
: displayBusinessSearchResults(directoryProvider),
|
||||||
onPressed: () {
|
),
|
||||||
if (filterOn) {
|
],
|
||||||
clearAll(directoryProvider);
|
|
||||||
}
|
|
||||||
setState(() {
|
|
||||||
filterOn = !filterOn;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
!filterOn
|
|
||||||
? Icons.filter_list_rounded
|
|
||||||
: Icons.filter_list_off_rounded,
|
|
||||||
size: 35,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
FutureBuilder(
|
|
||||||
future: availableBusinessTypes,
|
|
||||||
builder: (context, asyncSnapshot) {
|
|
||||||
List<String> options = [];
|
|
||||||
if (asyncSnapshot.connectionState == ConnectionState.done) {
|
|
||||||
options.addAll(asyncSnapshot.data!);
|
|
||||||
}
|
|
||||||
return Visibility(
|
|
||||||
visible: filterOn,
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: width / 20),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: MihDropdownField(
|
|
||||||
controller: businessTypeController,
|
|
||||||
hintText: "Business Type",
|
|
||||||
dropdownOptions: options,
|
|
||||||
requiredText: true,
|
|
||||||
editable: true,
|
|
||||||
enableSearch: true,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 10),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
if (businessTypeController.text.isNotEmpty) {
|
|
||||||
searchPressed(
|
|
||||||
profileProvider, directoryProvider);
|
|
||||||
} else {
|
|
||||||
MihAlertServices().errorBasicAlert(
|
|
||||||
"Business Type Not Selected",
|
|
||||||
"Please ensure you have selected a Business Type before seareching for Businesses of Mzansi",
|
|
||||||
context,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
buttonColor: MihColors.getGreenColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
elevation: 10,
|
|
||||||
child: Text(
|
|
||||||
"Search",
|
|
||||||
style: TextStyle(
|
|
||||||
color: MihColors.getPrimaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!
|
|
||||||
.theme
|
|
||||||
.mode ==
|
|
||||||
"Dark"),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
displaySearchResults(directoryProvider),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -313,62 +325,24 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
|
|||||||
// return Text("Pulled Data successfully");
|
// return Text("Pulled Data successfully");
|
||||||
directoryProvider.searchedBusinesses!
|
directoryProvider.searchedBusinesses!
|
||||||
.sort((a, b) => a.Name.compareTo(b.Name));
|
.sort((a, b) => a.Name.compareTo(b.Name));
|
||||||
return Column(
|
return BuildBusinessSearchResultsList(
|
||||||
children: [
|
businessList: directoryProvider.searchedBusinesses!,
|
||||||
Text(
|
|
||||||
"Businesses of Mzansi",
|
|
||||||
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
BuildBusinessSearchResultsList(
|
|
||||||
businessList: directoryProvider.searchedBusinesses!,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
} else if (directoryProvider.searchedBusinesses!.isEmpty &&
|
} else if (directoryProvider.searchedBusinesses!.isEmpty &&
|
||||||
directoryProvider.searchTerm.isNotEmpty) {
|
directoryProvider.searchTerm.isNotEmpty) {
|
||||||
// return Text("Pulled Data successfully");
|
return MihSingleChildScroll(
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
const SizedBox(height: 50),
|
|
||||||
Icon(
|
|
||||||
MihIcons.iDontKnow,
|
|
||||||
size: 165,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 25),
|
|
||||||
Text(
|
|
||||||
"Let's try refining your search",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
overflow: TextOverflow.visible,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 25,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
} else if (directoryProvider.searchedBusinesses!.isEmpty &&
|
|
||||||
directoryProvider.searchTerm.isEmpty) {
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 50),
|
const SizedBox(height: 50),
|
||||||
Icon(
|
Icon(
|
||||||
MihIcons.businessProfile,
|
MihIcons.iDontKnow,
|
||||||
size: 165,
|
size: 165,
|
||||||
color: MihColors.getSecondaryColor(
|
color: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 25),
|
||||||
Text(
|
Text(
|
||||||
"Search for businesses of Mzansi!",
|
"Let's try refining your search",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
overflow: TextOverflow.visible,
|
overflow: TextOverflow.visible,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@@ -378,65 +352,99 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
|
|||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: RichText(
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
text: TextSpan(
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.normal,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
children: [
|
|
||||||
TextSpan(text: "Press "),
|
|
||||||
WidgetSpan(
|
|
||||||
alignment: PlaceholderAlignment.middle,
|
|
||||||
child: Icon(
|
|
||||||
Icons.swap_horiz_rounded,
|
|
||||||
size: 20,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
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: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
children: [
|
|
||||||
TextSpan(text: "Press "),
|
|
||||||
WidgetSpan(
|
|
||||||
alignment: PlaceholderAlignment.middle,
|
|
||||||
child: Icon(
|
|
||||||
Icons.filter_list_rounded,
|
|
||||||
size: 20,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextSpan(text: " to filter business types"),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
} else if (directoryProvider.searchedBusinesses!.isEmpty &&
|
||||||
|
directoryProvider.searchTerm.isEmpty) {
|
||||||
|
return MihSingleChildScroll(
|
||||||
|
child: 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: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Text(
|
||||||
|
"Search for businesses of Mzansi!",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
overflow: TextOverflow.visible,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 25,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 25),
|
||||||
|
Center(
|
||||||
|
child: RichText(
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
text: TextSpan(
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.normal,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
TextSpan(text: "Press "),
|
||||||
|
WidgetSpan(
|
||||||
|
alignment: PlaceholderAlignment.middle,
|
||||||
|
child: Icon(
|
||||||
|
Icons.swap_horiz_rounded,
|
||||||
|
size: 20,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
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: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
TextSpan(text: "Press "),
|
||||||
|
WidgetSpan(
|
||||||
|
alignment: PlaceholderAlignment.middle,
|
||||||
|
child: Icon(
|
||||||
|
Icons.filter_list_rounded,
|
||||||
|
size: 20,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextSpan(text: " to filter business types"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return Center(
|
return Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -458,38 +466,86 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
|
|||||||
child: const Mihloadingcircle(),
|
child: const Mihloadingcircle(),
|
||||||
);
|
);
|
||||||
} else if (directoryProvider.searchedUsers!.isNotEmpty) {
|
} else if (directoryProvider.searchedUsers!.isNotEmpty) {
|
||||||
// return Text("Pulled Data successfully");
|
|
||||||
directoryProvider.searchedUsers!
|
directoryProvider.searchedUsers!
|
||||||
.sort((a, b) => a.username.compareTo(b.username));
|
.sort((a, b) => a.username.compareTo(b.username));
|
||||||
return Column(
|
return BuildUserSearchResultsList(
|
||||||
children: [
|
userList: directoryProvider.searchedUsers!);
|
||||||
Text(
|
|
||||||
"People of Mzansi",
|
|
||||||
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
BuildUserSearchResultsList(
|
|
||||||
userList: directoryProvider.searchedUsers!),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
} else if (directoryProvider.searchedUsers!.isEmpty &&
|
} else if (directoryProvider.searchedUsers!.isEmpty &&
|
||||||
directoryProvider.searchTerm.isEmpty) {
|
directoryProvider.searchTerm.isEmpty) {
|
||||||
return Padding(
|
return MihSingleChildScroll(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
child: 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: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Text(
|
||||||
|
"Search for people of Mzansi!",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
overflow: TextOverflow.visible,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 25,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 25),
|
||||||
|
Center(
|
||||||
|
child: RichText(
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
text: TextSpan(
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 20,
|
||||||
|
fontWeight: FontWeight.normal,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
TextSpan(text: "Press "),
|
||||||
|
WidgetSpan(
|
||||||
|
alignment: PlaceholderAlignment.middle,
|
||||||
|
child: Icon(
|
||||||
|
Icons.swap_horiz_rounded,
|
||||||
|
size: 20,
|
||||||
|
color: MihColors.getSecondaryColor(
|
||||||
|
MzansiInnovationHub.of(context)!.theme.mode ==
|
||||||
|
"Dark"),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextSpan(text: " to search for businesses of Mzansi"),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else if (directoryProvider.searchedUsers!.isEmpty &&
|
||||||
|
directoryProvider.searchTerm.isNotEmpty) {
|
||||||
|
return MihSingleChildScroll(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 50),
|
const SizedBox(height: 50),
|
||||||
Icon(
|
Icon(
|
||||||
MihIcons.personalProfile,
|
MihIcons.iDontKnow,
|
||||||
size: 165,
|
size: 165,
|
||||||
color: MihColors.getSecondaryColor(
|
color: MihColors.getSecondaryColor(
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
Text(
|
Text(
|
||||||
"Search for people of Mzansi!",
|
"Let's try refining your search",
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
overflow: TextOverflow.visible,
|
overflow: TextOverflow.visible,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@@ -499,62 +555,9 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
|
|||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 25),
|
|
||||||
Center(
|
|
||||||
child: RichText(
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
text: TextSpan(
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.normal,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
children: [
|
|
||||||
TextSpan(text: "Press "),
|
|
||||||
WidgetSpan(
|
|
||||||
alignment: PlaceholderAlignment.middle,
|
|
||||||
child: Icon(
|
|
||||||
Icons.swap_horiz_rounded,
|
|
||||||
size: 20,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode ==
|
|
||||||
"Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextSpan(text: " to search for businesses of Mzansi"),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else if (directoryProvider.searchedUsers!.isEmpty &&
|
|
||||||
directoryProvider.searchTerm.isNotEmpty) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
const SizedBox(height: 50),
|
|
||||||
Icon(
|
|
||||||
MihIcons.iDontKnow,
|
|
||||||
size: 165,
|
|
||||||
color: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
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: MihColors.getSecondaryColor(
|
|
||||||
MzansiInnovationHub.of(context)!.theme.mode == "Dark"),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
return Center(
|
return Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
@@ -568,12 +571,4 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget displaySearchResults(MzansiDirectoryProvider directoryProvider) {
|
|
||||||
if (directoryProvider.personalSearch) {
|
|
||||||
return displayPersonalSearchResults(directoryProvider);
|
|
||||||
} else {
|
|
||||||
return displayBusinessSearchResults(directoryProvider);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user