forked from yaso_meth/mih-project
remove search on start for MD
This commit is contained in:
@@ -229,17 +229,13 @@ class MzansiAiArguments {
|
||||
}
|
||||
|
||||
class MzansiDirectoryArguments {
|
||||
final String? startUpSearch;
|
||||
final bool personalSearch;
|
||||
final int? packageIndex;
|
||||
|
||||
MzansiDirectoryArguments(
|
||||
{
|
||||
this.startUpSearch,
|
||||
MzansiDirectoryArguments({
|
||||
required this.personalSearch,
|
||||
this.packageIndex,
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
class TestArguments {
|
||||
|
||||
@@ -66,7 +66,6 @@ class _MzansiDirectoryState extends State<MzansiDirectory> {
|
||||
.replaceAll("Longitude: ", "");
|
||||
}
|
||||
return MihSearchMzansi(
|
||||
startUpSearch: widget.arguments.startUpSearch,
|
||||
personalSearch: widget.arguments.personalSearch,
|
||||
myLocation: myLocation,
|
||||
);
|
||||
|
||||
@@ -16,12 +16,10 @@ import 'package:mzansi_innovation_hub/mih_services/mih_business_details_services
|
||||
import 'package:mzansi_innovation_hub/mih_services/mih_user_services.dart';
|
||||
|
||||
class MihSearchMzansi extends StatefulWidget {
|
||||
final String? startUpSearch;
|
||||
final bool personalSearch;
|
||||
final String? myLocation;
|
||||
const MihSearchMzansi({
|
||||
super.key,
|
||||
required this.startUpSearch,
|
||||
required this.personalSearch,
|
||||
required this.myLocation,
|
||||
});
|
||||
@@ -100,18 +98,10 @@ class _MihSearchMzansiState extends State<MihSearchMzansi> {
|
||||
super.initState();
|
||||
setState(() {
|
||||
userSearch = widget.personalSearch;
|
||||
mzansiSearchController.text = widget.startUpSearch ?? "";
|
||||
mzansiSearchController.text = "";
|
||||
// businessTypeController.text = "All";
|
||||
availableBusinessTypes =
|
||||
MihBusinessDetailsServices().fetchAllBusinessTypes();
|
||||
if (userSearch) {
|
||||
futureUserSearchResults =
|
||||
MihUserServices().searchUsers(mzansiSearchController.text, context);
|
||||
} else {
|
||||
futureBusinessSearchResults = MihBusinessDetailsServices()
|
||||
.searchBusinesses(mzansiSearchController.text,
|
||||
businessTypeController.text, context);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -12,11 +12,9 @@ import 'package:supertokens_flutter/supertokens.dart';
|
||||
|
||||
class MihAddBookmarkAlert extends StatefulWidget {
|
||||
final Business business;
|
||||
final String? startUpSearch;
|
||||
const MihAddBookmarkAlert({
|
||||
super.key,
|
||||
required this.business,
|
||||
required this.startUpSearch,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -40,7 +38,6 @@ class _MihAddBookmarkAlertState extends State<MihAddBookmarkAlert> {
|
||||
'/mzansi-directory',
|
||||
ModalRoute.withName('/'),
|
||||
arguments: MzansiDirectoryArguments(
|
||||
startUpSearch: widget.startUpSearch, // startUpSearch
|
||||
personalSearch: false, // personalSearch
|
||||
packageIndex: 1,
|
||||
),
|
||||
|
||||
@@ -647,7 +647,6 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
businessReview: myReview,
|
||||
screenWidth: width,
|
||||
readOnly: false,
|
||||
startUpSearch: widget.startUpSearch,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -657,7 +656,6 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
context: context,
|
||||
builder: (context) => MihAddBookmarkAlert(
|
||||
business: widget.business,
|
||||
startUpSearch: widget.startUpSearch,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -52,7 +52,6 @@ class _MihDeleteBookmarkAlertState extends State<MihDeleteBookmarkAlert> {
|
||||
'/mzansi-directory',
|
||||
ModalRoute.withName('/'),
|
||||
arguments: MzansiDirectoryArguments(
|
||||
startUpSearch: widget.startUpSearch, // startUpSearch
|
||||
personalSearch: false, // personalSearch
|
||||
packageIndex: 1,
|
||||
),
|
||||
|
||||
@@ -23,14 +23,12 @@ class MihReviewBusinessWindow extends StatefulWidget {
|
||||
final BusinessReview? businessReview;
|
||||
final double screenWidth;
|
||||
final bool readOnly;
|
||||
final String? startUpSearch;
|
||||
const MihReviewBusinessWindow({
|
||||
super.key,
|
||||
required this.business,
|
||||
required this.businessReview,
|
||||
required this.screenWidth,
|
||||
required this.readOnly,
|
||||
required this.startUpSearch,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -101,7 +99,6 @@ class _MihReviewBusinessWindowState extends State<MihReviewBusinessWindow> {
|
||||
Navigator.of(context).pushNamed(
|
||||
'/mzansi-directory',
|
||||
arguments: MzansiDirectoryArguments(
|
||||
startUpSearch: widget.startUpSearch, // startUpSearch
|
||||
personalSearch: false, // personalSearch
|
||||
),
|
||||
);
|
||||
@@ -191,8 +188,7 @@ class _MihReviewBusinessWindowState extends State<MihReviewBusinessWindow> {
|
||||
Navigator.of(context).pushNamed(
|
||||
'/mzansi-directory',
|
||||
arguments: MzansiDirectoryArguments(
|
||||
startUpSearch: widget.startUpSearch, // startUpSearch
|
||||
personalSearch: false, // personalSearch
|
||||
personalSearch: false, // personalSearch
|
||||
),
|
||||
);
|
||||
MihAlertServices().successAlert(
|
||||
@@ -227,7 +223,6 @@ class _MihReviewBusinessWindowState extends State<MihReviewBusinessWindow> {
|
||||
Navigator.of(context).pushNamed(
|
||||
'/mzansi-directory',
|
||||
arguments: MzansiDirectoryArguments(
|
||||
startUpSearch: widget.startUpSearch, // startUpSearch
|
||||
personalSearch: false, // personalSearch
|
||||
),
|
||||
);
|
||||
@@ -386,7 +381,8 @@ class _MihReviewBusinessWindowState extends State<MihReviewBusinessWindow> {
|
||||
emptyColor: MzansiInnovationHub.of(context)!
|
||||
.theme
|
||||
.secondaryColor(),
|
||||
halfFilledColor: MihColors.getYellowColor(context), isHalfAllowed: true,
|
||||
halfFilledColor: MihColors.getYellowColor(context),
|
||||
isHalfAllowed: true,
|
||||
initialRating: widget.businessReview != null
|
||||
? double.parse(_reviewScoreController.text)
|
||||
: 1,
|
||||
|
||||
@@ -40,7 +40,6 @@ class _MihBusinessReviewsState extends State<MihBusinessReviews> {
|
||||
businessReview: businessReview,
|
||||
screenWidth: width,
|
||||
readOnly: true,
|
||||
startUpSearch: null,
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -39,6 +39,9 @@ class MihBusinessDetailsServices {
|
||||
if (searchType.isNotEmpty) {
|
||||
newSearchType = searchType;
|
||||
}
|
||||
if (searchText.isEmpty && searchType.isEmpty) {
|
||||
return [];
|
||||
}
|
||||
var response = await http.get(
|
||||
Uri.parse(
|
||||
"${AppEnviroment.baseApiUrl}/business/search/$newSearchType/$newSearchText"),
|
||||
|
||||
Reference in New Issue
Block a user