Updated both apps' structure
parent
360048c3bf
commit
91ea03c834
@ -1,130 +1,153 @@
|
|||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
import 'package:mc_common_app/classes/app_state.dart';
|
// import 'package:mc_common_app/classes/app_state.dart';
|
||||||
import 'package:mc_common_app/config/dependency_injection.dart';
|
// import 'package:mc_common_app/classes/consts.dart';
|
||||||
import 'package:mc_common_app/config/routes.dart';
|
// import 'package:mc_common_app/config/dependency_injection.dart';
|
||||||
import 'package:mc_common_app/extensions/int_extensions.dart';
|
// import 'package:mc_common_app/config/routes.dart';
|
||||||
import 'package:mc_common_app/extensions/string_extensions.dart';
|
// import 'package:mc_common_app/extensions/int_extensions.dart';
|
||||||
import 'package:mc_common_app/generated/locale_keys.g.dart';
|
// import 'package:mc_common_app/extensions/string_extensions.dart';
|
||||||
import 'package:mc_common_app/models/advertisment_models/ad_details_model.dart';
|
// import 'package:mc_common_app/generated/locale_keys.g.dart';
|
||||||
import 'package:mc_common_app/theme/colors.dart';
|
// import 'package:mc_common_app/models/advertisment_models/ad_details_model.dart';
|
||||||
import 'package:mc_common_app/utils/enums.dart';
|
// import 'package:mc_common_app/theme/colors.dart';
|
||||||
import 'package:mc_common_app/utils/navigator.dart';
|
// import 'package:mc_common_app/utils/enums.dart';
|
||||||
import 'package:mc_common_app/view_models/ad_view_model.dart';
|
// import 'package:mc_common_app/utils/navigator.dart';
|
||||||
import 'package:mc_common_app/views/advertisement/ads_list.dart';
|
// import 'package:mc_common_app/view_models/ad_view_model.dart';
|
||||||
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
|
// import 'package:mc_common_app/views/advertisement/ads_list.dart';
|
||||||
import 'package:mc_common_app/widgets/common_widgets/categories_list.dart';
|
// import 'package:mc_common_app/widgets/button/show_fill_button.dart';
|
||||||
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
// import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
|
||||||
import 'package:provider/provider.dart';
|
// import 'package:mc_common_app/widgets/common_widgets/categories_list.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
// import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
||||||
|
// import 'package:provider/provider.dart';
|
||||||
class AdsFragment extends StatelessWidget {
|
// import 'package:easy_localization/easy_localization.dart';
|
||||||
AdsFragment({Key? key}) : super(key: key);
|
//
|
||||||
|
// class AdsFragment extends StatelessWidget {
|
||||||
Future<void> _onRefreshAds(BuildContext context) async {
|
// AdsFragment({Key? key}) : super(key: key);
|
||||||
AdVM adVM = context.read<AdVM>();
|
//
|
||||||
await adVM.getExploreAds();
|
// List<AdDetailsModel> getAdsList(AdVM adVM) {
|
||||||
await adVM.getMyAds();
|
// if (adVM.isExploreAdsTapped) {
|
||||||
}
|
// return adVM.exploreAdsFilteredList;
|
||||||
|
// }
|
||||||
List<AdDetailsModel> getAdsList(AdVM adVM) {
|
// if (adVM.myAdsFilteredList.isNotEmpty) {
|
||||||
if (adVM.isExploreAdsTapped) {
|
// return adVM.myAdsFilteredList;
|
||||||
return adVM.exploreAdsFilteredList;
|
// }
|
||||||
}
|
// return [];
|
||||||
if (adVM.myAdsFilteredList.isNotEmpty) {
|
// }
|
||||||
return adVM.myAdsFilteredList;
|
//
|
||||||
}
|
// @override
|
||||||
return [];
|
// Widget build(BuildContext context) {
|
||||||
}
|
// return Consumer(
|
||||||
|
// builder: (BuildContext context, AdVM adVM, Widget? child) {
|
||||||
@override
|
// return Scaffold(
|
||||||
Widget build(BuildContext context) {
|
// appBar: CustomAppBar(
|
||||||
return Scaffold(
|
// title: LocaleKeys.ads.tr(),
|
||||||
body: Container(
|
// isRemoveBackButton: true,
|
||||||
color: MyColors.backgroundColor,
|
// actions: [
|
||||||
width: double.infinity,
|
// Padding(
|
||||||
height: double.infinity,
|
// padding: EdgeInsets.only(top: adVM.adsFiltersCounter > 0 ? 20 : 0, right: 21),
|
||||||
child: Column(
|
// child: Badge(
|
||||||
children: [
|
// isLabelVisible: adVM.adsFiltersCounter > 0,
|
||||||
16.height,
|
// largeSize: 15,
|
||||||
Consumer(
|
// smallSize: 20,
|
||||||
builder: (BuildContext context, AdVM adVM, Widget? child) {
|
// backgroundColor: MyColors.darkPrimaryColor,
|
||||||
return Column(
|
// label: Text('${adVM.adsFiltersCounter}'),
|
||||||
children: [
|
// child: MyAssets.searchIcon.buildSvg(),
|
||||||
Row(
|
// ),
|
||||||
children: [
|
// ).onPress(() {
|
||||||
Expanded(
|
// navigateWithName(context, AppRoutes.adsFilterView);
|
||||||
child: ShowFillButton(
|
// })
|
||||||
isFilled: adVM.isExploreAdsTapped,
|
// ],
|
||||||
maxHeight: 55,
|
// ),
|
||||||
title: LocaleKeys.exploreAds.tr(),
|
// body: SizedBox(
|
||||||
txtColor: adVM.isExploreAdsTapped ? MyColors.white : MyColors.darkTextColor,
|
// width: double.infinity,
|
||||||
onPressed: () {
|
// height: double.infinity,
|
||||||
print("ads: ${AppState().getUser.data!.accessToken}");
|
// child: Column(
|
||||||
adVM.populateAdsFilterList();
|
// children: [
|
||||||
if (adVM.myAds.isEmpty) {
|
// 16.height,
|
||||||
adVM.getMyAds();
|
// Consumer(
|
||||||
}
|
// builder: (BuildContext context, AdVM adVM, Widget? child) {
|
||||||
adVM.updateIsExploreAds(true);
|
// return Column(
|
||||||
},
|
// children: [
|
||||||
),
|
// Row(
|
||||||
),
|
// children: [
|
||||||
12.width,
|
// Expanded(
|
||||||
Expanded(
|
// child: ShowFillButton(
|
||||||
child: ShowFillButton(
|
// isFilled: adVM.isExploreAdsTapped,
|
||||||
isFilled: !adVM.isExploreAdsTapped,
|
// maxHeight: 55,
|
||||||
txtColor: !adVM.isExploreAdsTapped ? MyColors.white : MyColors.darkTextColor,
|
// title: LocaleKeys.exploreAds.tr(),
|
||||||
maxHeight: 55,
|
// txtColor: adVM.isExploreAdsTapped ? MyColors.white : MyColors.darkTextColor,
|
||||||
title: LocaleKeys.myAds.tr(),
|
// onPressed: () {
|
||||||
onPressed: () {
|
// print("accessToken: ${AppState().getUser.data!.accessToken}");
|
||||||
adVM.updateIsExploreAds(false);
|
// adVM.populateAdsFilterList();
|
||||||
},
|
// if (adVM.myAds.isEmpty) {
|
||||||
),
|
// adVM.getMyAds();
|
||||||
),
|
// }
|
||||||
],
|
// adVM.updateIsExploreAds(true);
|
||||||
).horPaddingMain(),
|
// },
|
||||||
if (adVM.isExploreAdsTapped) ...[
|
// ),
|
||||||
16.height,
|
// ),
|
||||||
FiltersList(
|
// 12.width,
|
||||||
filterList: adVM.exploreAdsFilterOptions,
|
// Expanded(
|
||||||
onFilterTapped: (index, selectedFilterId) => adVM.applyFilterOnExploreAds(createdByRoleFilter: selectedFilterId.toCreatedByRoleEnum()),
|
// child: ShowFillButton(
|
||||||
needLeftPadding: false)
|
// isFilled: !adVM.isExploreAdsTapped,
|
||||||
.paddingOnly(left: 21),
|
// txtColor: !adVM.isExploreAdsTapped ? MyColors.white : MyColors.darkTextColor,
|
||||||
] else ...[
|
// maxHeight: 55,
|
||||||
16.height,
|
// title: LocaleKeys.myAds.tr(),
|
||||||
FiltersList(
|
// onPressed: () {
|
||||||
filterList: adVM.myAdsFilterOptions,
|
// adVM.updateIsExploreAds(false);
|
||||||
onFilterTapped: (index, selectedFilterId) => adVM.applyFilterOnMyAds(adPostStatusEnum: selectedFilterId.toAdPostEnum()),
|
// },
|
||||||
needLeftPadding: false,
|
// ),
|
||||||
).paddingOnly(left: 21),
|
// ),
|
||||||
],
|
// ],
|
||||||
],
|
// ).horPaddingMain(),
|
||||||
);
|
// if (adVM.isExploreAdsTapped) ...[
|
||||||
},
|
// if (adVM.adsFiltersCounter == 0) ...[
|
||||||
),
|
// 16.height,
|
||||||
16.height,
|
// FiltersList(
|
||||||
Expanded(
|
// filterList: adVM.exploreAdsFilterOptions,
|
||||||
child: RefreshIndicator(
|
// onFilterTapped: (index, selectedFilterId) => adVM.applyFilterOnExploreAds(createdByRoleFilter: selectedFilterId.toCreatedByRoleEnum()),
|
||||||
onRefresh: () => _onRefreshAds(context),
|
// needLeftPadding: false)
|
||||||
child: Consumer(
|
// .paddingOnly(left: 21),
|
||||||
builder: (BuildContext context, AdVM adVM, Widget? child) {
|
// ]
|
||||||
return BuildAdsList(isAdsFragment: true, shouldShowAdStatus: !adVM.isExploreAdsTapped, adsList: getAdsList(adVM));
|
// ] else ...[
|
||||||
},
|
// 16.height,
|
||||||
),
|
// FiltersList(
|
||||||
),
|
// filterList: adVM.myAdsFilterOptions,
|
||||||
)
|
// onFilterTapped: (index, selectedFilterId) => adVM.applyFilterOnMyAds(adPostStatusEnum: selectedFilterId.toAdPostEnum()),
|
||||||
],
|
// needLeftPadding: false,
|
||||||
),
|
// ).paddingOnly(left: 21),
|
||||||
),
|
// ],
|
||||||
floatingActionButton: FloatingActionButton(
|
// ],
|
||||||
onPressed: () async {
|
// );
|
||||||
navigateWithName(context, AppRoutes.selectAdTypeView, arguments: injector.get<AppState>().currentAppType == AppType.provider);
|
// },
|
||||||
},
|
// ),
|
||||||
backgroundColor: MyColors.darkPrimaryColor,
|
// 16.height,
|
||||||
child: Icon(
|
// Expanded(
|
||||||
Icons.add,
|
// child: RefreshIndicator(
|
||||||
color: MyColors.white,
|
// onRefresh: () async {
|
||||||
),
|
// await adVM.getExploreAds();
|
||||||
),
|
// await adVM.getMyAds();
|
||||||
);
|
// },
|
||||||
}
|
// child: BuildAdsList(
|
||||||
}
|
// isAdsFragment: true,
|
||||||
|
// shouldShowAdStatus: !adVM.isExploreAdsTapped,
|
||||||
|
// adsList: getAdsList(adVM),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// )
|
||||||
|
// ],
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// floatingActionButton: FloatingActionButton(
|
||||||
|
// onPressed: () async {
|
||||||
|
// navigateWithName(context, AppRoutes.selectAdTypeView, arguments: injector.get<AppState>().currentAppType == AppType.provider);
|
||||||
|
// },
|
||||||
|
// backgroundColor: MyColors.darkPrimaryColor,
|
||||||
|
// child: Icon(
|
||||||
|
// Icons.add,
|
||||||
|
// color: MyColors.white,
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
@ -1,76 +1,80 @@
|
|||||||
import 'package:mc_common_app/generated/locale_keys.g.dart';
|
// import 'package:mc_common_app/generated/locale_keys.g.dart';
|
||||||
import 'package:mc_common_app/view_models/requests_view_model.dart';
|
// import 'package:mc_common_app/view_models/requests_view_model.dart';
|
||||||
import 'package:flutter/material.dart';
|
// import 'package:flutter/material.dart';
|
||||||
import 'package:mc_common_app/config/routes.dart';
|
// import 'package:mc_common_app/config/routes.dart';
|
||||||
import 'package:mc_common_app/extensions/int_extensions.dart';
|
// import 'package:mc_common_app/extensions/int_extensions.dart';
|
||||||
import 'package:mc_common_app/extensions/string_extensions.dart';
|
// import 'package:mc_common_app/extensions/string_extensions.dart';
|
||||||
import 'package:mc_common_app/theme/colors.dart';
|
// import 'package:mc_common_app/theme/colors.dart';
|
||||||
import 'package:mc_common_app/utils/enums.dart';
|
// import 'package:mc_common_app/utils/enums.dart';
|
||||||
import 'package:mc_common_app/utils/navigator.dart';
|
// import 'package:mc_common_app/utils/navigator.dart';
|
||||||
import 'package:mc_common_app/views/requests/widget/request_item.dart';
|
// import 'package:mc_common_app/views/requests/widget/request_item.dart';
|
||||||
import 'package:mc_common_app/widgets/common_widgets/categories_list.dart';
|
// import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
|
||||||
import 'package:provider/provider.dart';
|
// import 'package:mc_common_app/widgets/common_widgets/categories_list.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
// import 'package:provider/provider.dart';
|
||||||
|
// import 'package:easy_localization/easy_localization.dart';
|
||||||
class MyRequestsFragment extends StatelessWidget {
|
//
|
||||||
const MyRequestsFragment({super.key});
|
// class MyRequestsFragment extends StatelessWidget {
|
||||||
|
// const MyRequestsFragment({super.key});
|
||||||
@override
|
//
|
||||||
Widget build(BuildContext context) {
|
// @override
|
||||||
return Scaffold(
|
// Widget build(BuildContext context) {
|
||||||
body: Container(
|
// return Scaffold(
|
||||||
color: MyColors.backgroundColor,
|
// appBar: CustomAppBar(
|
||||||
width: double.infinity,
|
// title: LocaleKeys.myRequests.tr(),
|
||||||
height: double.infinity,
|
// isRemoveBackButton: true,
|
||||||
child: Consumer(builder: (BuildContext context, RequestsVM requestsVM, Widget? child) {
|
// ),
|
||||||
return Column(
|
// body: SizedBox(
|
||||||
children: [
|
// width: double.infinity,
|
||||||
16.height,
|
// height: double.infinity,
|
||||||
FiltersList(
|
// child: Consumer(builder: (BuildContext context, RequestsVM requestsVM, Widget? child) {
|
||||||
filterList: requestsVM.requestsTypeFilterOptions,
|
// return Column(
|
||||||
onFilterTapped: (index, selectedFilterId) {
|
// children: [
|
||||||
requestsVM.applyFilterOnRequestsVM(requestsTypeEnum: selectedFilterId.toRequestTypeStatusEnum());
|
// 16.height,
|
||||||
},
|
// FiltersList(
|
||||||
),
|
// filterList: requestsVM.requestsTypeFilterOptions,
|
||||||
8.height,
|
// onFilterTapped: (index, selectedFilterId) {
|
||||||
Expanded(
|
// requestsVM.applyFilterOnRequestsVM(requestsTypeEnum: selectedFilterId.toRequestTypeStatusEnum());
|
||||||
child: RefreshIndicator(
|
// },
|
||||||
onRefresh: () async => await requestsVM.getRequests(isNeedToRebuild: true, appType: AppType.customer),
|
// ),
|
||||||
child: requestsVM.state == ViewState.busy
|
// 8.height,
|
||||||
? const Center(child: CircularProgressIndicator())
|
// Expanded(
|
||||||
: requestsVM.myFilteredRequests.isEmpty
|
// child: RefreshIndicator(
|
||||||
? Column(
|
// onRefresh: () async => await requestsVM.getRequests(isNeedToRebuild: true, appType: AppType.customer),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
// child: requestsVM.state == ViewState.busy
|
||||||
children: [
|
// ? const Center(child: CircularProgressIndicator())
|
||||||
LocaleKeys.noRequeststoShow.tr().toText(fontSize: 16, color: MyColors.lightTextColor),
|
// : requestsVM.myFilteredRequests.isEmpty
|
||||||
],
|
// ? Column(
|
||||||
)
|
// mainAxisAlignment: MainAxisAlignment.center,
|
||||||
: ListView.separated(
|
// children: [
|
||||||
itemBuilder: (context, index) {
|
// LocaleKeys.noRequeststoShow.tr().toText(fontSize: 16, color: MyColors.lightTextColor),
|
||||||
return RequestItem(
|
// ],
|
||||||
request: requestsVM.myFilteredRequests[index],
|
// )
|
||||||
appType: AppType.customer,
|
// : ListView.separated(
|
||||||
requestIndex: index,
|
// itemBuilder: (context, index) {
|
||||||
);
|
// return RequestItem(
|
||||||
},
|
// request: requestsVM.myFilteredRequests[index],
|
||||||
separatorBuilder: (context, index) => 16.height,
|
// appType: AppType.customer,
|
||||||
itemCount: requestsVM.myFilteredRequests.length,
|
// requestIndex: index,
|
||||||
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 8),
|
// );
|
||||||
),
|
// },
|
||||||
),
|
// separatorBuilder: (context, index) => 16.height,
|
||||||
)
|
// itemCount: requestsVM.myFilteredRequests.length,
|
||||||
],
|
// padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 8),
|
||||||
);
|
// ),
|
||||||
}),
|
// ),
|
||||||
),
|
// )
|
||||||
floatingActionButton: FloatingActionButton(
|
// ],
|
||||||
onPressed: () => navigateWithName(context, AppRoutes.createRequestPage),
|
// );
|
||||||
backgroundColor: MyColors.darkPrimaryColor,
|
// }),
|
||||||
child: const Icon(
|
// ),
|
||||||
Icons.add,
|
// floatingActionButton: FloatingActionButton(
|
||||||
color: MyColors.white,
|
// onPressed: () => navigateWithName(context, AppRoutes.createRequestPage),
|
||||||
),
|
// backgroundColor: MyColors.darkPrimaryColor,
|
||||||
),
|
// child: const Icon(
|
||||||
);
|
// Icons.add,
|
||||||
}
|
// color: MyColors.white,
|
||||||
}
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|||||||
@ -1,37 +1,45 @@
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:mc_common_app/classes/consts.dart';
|
||||||
|
import 'package:mc_common_app/config/routes.dart';
|
||||||
import 'package:mc_common_app/extensions/int_extensions.dart';
|
import 'package:mc_common_app/extensions/int_extensions.dart';
|
||||||
import 'package:mc_common_app/extensions/string_extensions.dart';
|
import 'package:mc_common_app/extensions/string_extensions.dart';
|
||||||
|
import 'package:mc_common_app/models/provider_branches_models/branch_detail_model.dart';
|
||||||
|
import 'package:mc_common_app/utils/navigator.dart';
|
||||||
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
||||||
|
|
||||||
class ServiceProviderWidget extends StatelessWidget {
|
class MyRecentBranchesWidget extends StatelessWidget {
|
||||||
const ServiceProviderWidget({Key? key}) : super(key: key);
|
final List<BranchDetailModel> nearbyBranches;
|
||||||
|
|
||||||
|
const MyRecentBranchesWidget({Key? key, required this.nearbyBranches}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 150,
|
height: 140,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: 9,
|
itemCount: nearbyBranches.length,
|
||||||
scrollDirection: Axis.horizontal,
|
scrollDirection: Axis.horizontal,
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
BranchDetailModel branchDetailModel = nearbyBranches[index];
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: 90,
|
width: 90,
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Image.asset(
|
Image.asset(
|
||||||
"assets/images/bn_car.jpeg",
|
MyAssets.bnCar,
|
||||||
width: 80,
|
width: 80,
|
||||||
height: 80,
|
height: 80,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
).toCircle(borderRadius: 100),
|
).toCircle(borderRadius: 100),
|
||||||
8.height,
|
8.height,
|
||||||
"Olaya Branch".toText(fontSize: 14, isBold: true, textAlign: TextAlign.center),
|
"${branchDetailModel.branchName}".toText(fontSize: 14, isBold: true, textAlign: TextAlign.center),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
).onPress(() {
|
||||||
|
navigateWithName(context, AppRoutes.branchDetailPage, arguments: branchDetailModel);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
Loading…
Reference in New Issue