Sort businesses
This commit is contained in:
@@ -68,6 +68,15 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
// searchTypeVisibility = !searchTypeVisibility;
|
// searchTypeVisibility = !searchTypeVisibility;
|
||||||
userSearch = !userSearch;
|
userSearch = !userSearch;
|
||||||
|
if (userSearch) {
|
||||||
|
futureUserSearchResults = MihUserServices()
|
||||||
|
.searchUsers(
|
||||||
|
mzansiSearchController.text, context);
|
||||||
|
} else {
|
||||||
|
futureBusinessSearchResults =
|
||||||
|
MihBusinessDetailsServices().searchBusinesses(
|
||||||
|
mzansiSearchController.text, context);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
@@ -137,7 +146,16 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
|
|||||||
// return Text("Pulled Data successfully");
|
// return Text("Pulled Data successfully");
|
||||||
snapshot.requireData!
|
snapshot.requireData!
|
||||||
.sort((a, b) => a.username.compareTo(b.username));
|
.sort((a, b) => a.username.compareTo(b.username));
|
||||||
return BuildUserSearchResultsList(userList: snapshot.requireData!);
|
return Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"People of Mzansi",
|
||||||
|
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
BuildUserSearchResultsList(userList: snapshot.requireData!),
|
||||||
|
],
|
||||||
|
);
|
||||||
} else if (!snapshot.hasData) {
|
} else if (!snapshot.hasData) {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@@ -185,9 +203,19 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
|
|||||||
} else if (snapshot.connectionState == ConnectionState.done &&
|
} else if (snapshot.connectionState == ConnectionState.done &&
|
||||||
snapshot.hasData) {
|
snapshot.hasData) {
|
||||||
// return Text("Pulled Data successfully");
|
// return Text("Pulled Data successfully");
|
||||||
return BuildBusinessSearchResultsList(
|
snapshot.requireData!.sort((a, b) => a.Name.compareTo(b.Name));
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Businesses of Mzansi",
|
||||||
|
style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
BuildBusinessSearchResultsList(
|
||||||
businessList: snapshot.requireData!,
|
businessList: snapshot.requireData!,
|
||||||
myLocation: myLocation,
|
myLocation: myLocation,
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
} else if (!snapshot.hasData) {
|
} else if (!snapshot.hasData) {
|
||||||
return Column(
|
return Column(
|
||||||
|
|||||||
Reference in New Issue
Block a user