Merge branch 'aamir_dev' into faiz_development

# Conflicts:
#	lib/views/requests/request_detail_page.dart
aamir_dev
Faiz Hashmi 2 years ago
commit 4079bcfb0f

@ -10,6 +10,7 @@ import 'package:mc_common_app/models/provider_branches_models/branch_detail_mode
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/utils/utils.dart';
import 'package:mc_common_app/view_models/service_view_model.dart'; import 'package:mc_common_app/view_models/service_view_model.dart';
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart'; import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart'; import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
@ -27,8 +28,8 @@ class BranchAppointmentFragment extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: CustomAppBar( appBar: const CustomAppBar(
title: LocaleKeys.appointments.tr(), title: "Select Branch",
isRemoveBackButton: true, isRemoveBackButton: true,
), ),
body: SizedBox( body: SizedBox(
@ -36,19 +37,6 @@ class BranchAppointmentFragment extends StatelessWidget {
height: double.infinity, height: double.infinity,
child: Column( child: Column(
children: [ children: [
Padding(
padding: const EdgeInsets.only(left: 21, right: 21, top: 21),
child: RoleTypeTab(
context.watch<ServiceVM>().selectedBranchStatus == 3 ? 0 : context.watch<ServiceVM>().selectedBranchStatus,
[
DropValue(3, "Active", ""),
DropValue(1, "Requested", ""),
],
onSelect: (DropValue value) {
context.read<ServiceVM>().updateSelectedBranchType(value.id);
},
),
),
Expanded( Expanded(
child: Consumer<ServiceVM>( child: Consumer<ServiceVM>(
builder: (context, ServiceVM serviceVM, _) { builder: (context, ServiceVM serviceVM, _) {
@ -57,7 +45,7 @@ class BranchAppointmentFragment extends StatelessWidget {
} else { } else {
List<BranchDetailModel> branches = []; List<BranchDetailModel> branches = [];
if (serviceVM.branches!.data != null) { if (serviceVM.branches!.data != null) {
branches = serviceVM.branches!.data!.serviceProviderBranch!.where((element) => serviceVM.selectedBranchStatus == element.statusId).toList(); branches = serviceVM.branches!.data!.serviceProviderBranch!.where((element) => 3 == element.statusId).toList();
} }
return RefreshIndicator( return RefreshIndicator(
onRefresh: () async => serviceVM.getBranchAndServices(), onRefresh: () async => serviceVM.getBranchAndServices(),
@ -67,41 +55,44 @@ class BranchAppointmentFragment extends StatelessWidget {
itemBuilder: (context, index) { itemBuilder: (context, index) {
return Row( return Row(
children: [ children: [
Container( branches[index].branchProfileImage.buildNetworkImage(width: 66, height: 53, fit: BoxFit.cover),
width: 74,
height: 50, // Container(
decoration: const BoxDecoration( // width: 74,
color: MyColors.darkPrimaryColor, // height: 50,
borderRadius: BorderRadius.all(Radius.circular(8)), // decoration: const BoxDecoration(
), // color: MyColors.darkPrimaryColor,
padding: const EdgeInsets.all(6), // borderRadius: BorderRadius.all(Radius.circular(8)),
child: SvgPicture.asset( // ),
MyAssets.icBranches, // padding: const EdgeInsets.all(6),
color: Colors.white, // child: SvgPicture.asset(
), // MyAssets.icBranches,
), // color: Colors.white,
// ),
// ),
12.width, 12.width,
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Row(
children: [ // Row(
const Icon( // children: [
Icons.place, // const Icon(
size: 12, // Icons.place,
color: MyColors.darkPrimaryColor, // size: 12,
), // color: MyColors.darkPrimaryColor,
Geolocator.distanceBetween(AppState().currentLocation.latitude, AppState().currentLocation.latitude, double.parse(branches[index].latitude ?? "0"), // ),
double.parse(branches[index].longitude ?? "0")) // Geolocator.distanceBetween(AppState().currentLocation.latitude, AppState().currentLocation.latitude, double.parse(branches[index].latitude ?? "0"),
.toStringAsFixed(2) // double.parse(branches[index].longitude ?? "0"))
.toText( // .toStringAsFixed(2)
fontSize: 12, // .toText(
color: MyColors.darkPrimaryColor, // fontSize: 12,
) // color: MyColors.darkPrimaryColor,
], // )
), // ],
// ),
Text( Text(
branches[index].branchName ?? "", branches[index].branchName ?? "",
style: const TextStyle( style: const TextStyle(
@ -115,7 +106,7 @@ class BranchAppointmentFragment extends StatelessWidget {
), ),
12.width, 12.width,
], ],
).toContainer().onPress(() async { ).toContainer(borderRadius: 0, isShadowEnabled: true).onPress(() async {
branches[index].countryID = serviceVM.branches!.data!.countryID; branches[index].countryID = serviceVM.branches!.data!.countryID;
branches[index].countryName = serviceVM.branches!.data!.countryName; branches[index].countryName = serviceVM.branches!.data!.countryName;
navigateWithName(context, ProviderAppRoutes.appointment, arguments: branches[index]); navigateWithName(context, ProviderAppRoutes.appointment, arguments: branches[index]);
@ -125,7 +116,7 @@ class BranchAppointmentFragment extends StatelessWidget {
return 12.height; return 12.height;
}, },
itemCount: branches.length, itemCount: branches.length,
padding: const EdgeInsets.all(12), padding: const EdgeInsets.only(left: 21, right: 21, top: 8),
), ),
); );
} }

@ -28,6 +28,7 @@ class HomeFragment extends StatelessWidget {
appBar: CustomAppBar( appBar: CustomAppBar(
isDrawerEnabled: true, isDrawerEnabled: true,
leadingWidth: 100, leadingWidth: 100,
toolbarHeight: 59,
onTap: () => navigateWithName(context, AppRoutes.settingOptionsLanguages), onTap: () => navigateWithName(context, AppRoutes.settingOptionsLanguages),
actions: [ actions: [
IconButton( IconButton(
@ -72,8 +73,7 @@ class HomeFragment extends StatelessWidget {
onAppointmentClick: (AppointmentListModel value) { onAppointmentClick: (AppointmentListModel value) {
navigateWithName(context, ProviderAppRoutes.appointmentDetailList, arguments: value); navigateWithName(context, ProviderAppRoutes.appointmentDetailList, arguments: value);
}, },
).horPaddingMain(), ).toWhiteContainer(width: double.infinity,backgroundColor: Colors.transparent).margin(left: 21,right: 21),
//margin: const EdgeInsets.only(bottom: 10, left: 21, right: 21),
24.height, 24.height,
ViewAllWidget( ViewAllWidget(
title: LocaleKeys.myBranches.tr(), title: LocaleKeys.myBranches.tr(),
@ -84,7 +84,7 @@ class HomeFragment extends StatelessWidget {
).horPaddingMain(), ).horPaddingMain(),
const ServiceProviderWidget().horPaddingMain(), const ServiceProviderWidget().horPaddingMain(),
], ],
).toWhiteContainer(width: double.infinity), ).toWhiteContainer(width: double.infinity,),
Consumer( Consumer(
builder: (BuildContext context, AdVM adVM, Widget? child) { builder: (BuildContext context, AdVM adVM, Widget? child) {
if (adVM.state == ViewState.busy) { if (adVM.state == ViewState.busy) {

@ -0,0 +1,223 @@
import 'package:flutter/material.dart';
import 'package:mc_common_app/classes/app_state.dart';
import 'package:mc_common_app/config/routes.dart';
import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/utils/navigator.dart';
import 'package:mc_common_app/utils/utils.dart';
import 'package:mc_common_app/view_models/chat_view_model.dart';
import 'package:mc_common_app/views/advertisement/components/ads_images_corousel_widget.dart';
import 'package:mc_common_app/views/requests/request_bottomsheets.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
import 'package:provider/provider.dart';
import 'package:easy_localization/easy_localization.dart';
class RequestDetailPage extends StatelessWidget {
final RequestDetailPageArguments requestDetailPageArguments;
const RequestDetailPage({Key? key, required this.requestDetailPageArguments}) : super(key: key);
Widget buildBottomButton({
required RequestStatus requestStatus,
required String statusText,
required BuildContext context,
required Function() onViewChatTapped,
}) {
switch (requestStatus) {
case RequestStatus.submitted:
case RequestStatus.inProgress:
case RequestStatus.paid:
case RequestStatus.shipping:
return ShowFillButton(
maxWidth: double.infinity,
margin: const EdgeInsets.all(15),
maxHeight: 55,
title: LocaleKeys.viewChat.tr(),
isBold: false,
onPressed: onViewChatTapped,
);
case RequestStatus.completed:
case RequestStatus.cancelled:
case RequestStatus.expired:
case RequestStatus.pending:
return buildDisabledButton(statusText);
}
}
Widget buildDisabledButton(String text) {
return ShowFillButton(
backgroundColor: MyColors.grey98Color.withOpacity(0.3),
txtColor: MyColors.lightTextColor,
maxWidth: double.infinity,
margin: const EdgeInsets.all(15),
maxHeight: 55,
title: text,
isBold: false,
onPressed: () {},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: CustomAppBar(
title: LocaleKeys.requestDetail.tr(),
),
body: SizedBox(
width: double.infinity,
height: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
ImagesCorouselWidget(imagesList: requestDetailPageArguments.requestModel.requestImages ?? []),
24.height,
buildRequestContainer(context),
],
).toWhiteContainer(
width: double.infinity,
allPading: 12,
margin: const EdgeInsets.only(top: 21, right: 21, left: 21),
),
if (!requestDetailPageArguments.requestModel.isChatted) ...[
ShowFillButton(
maxWidth: double.infinity,
margin: const EdgeInsets.all(15),
maxHeight: 55,
title: LocaleKeys.sendOffer.tr(),
isBold: false,
fontSize: 18,
onPressed: () => buildSendOfferBottomSheet(context, requestDetailPageArguments),
),
] else ...[
buildBottomButton(
requestStatus: requestDetailPageArguments.requestModel.requestStatus,
statusText: "Offer ${requestDetailPageArguments.requestModel.requestStatusName}",
context: context,
onViewChatTapped: () async {
ChatViewArgumentsForRequest chatViewArgumentsForRequest = ChatViewArgumentsForRequest(
chatTypeEnum: ChatTypeEnum.requestOffer,
receiverId: requestDetailPageArguments.requestModel.customerID,
senderId: AppState().getUser.data!.userInfo!.userId.toString(),
requestId: requestDetailPageArguments.requestModel.id,
providerIndex: -1,
// This will be only sent in case of customer
requestModel: requestDetailPageArguments.requestModel,
requestIndex: requestDetailPageArguments.requestIndex, // This will be only sent in case of provider
);
ChatViewArguments chatViewArguments = ChatViewArguments(
chatTypeEnum: ChatTypeEnum.requestOffer,
chatViewArgumentsForRequest: chatViewArgumentsForRequest,
);
final chatVM = context.read<ChatVM>();
await chatVM
.getUsersChatMessagesForProvider(
customerId: requestDetailPageArguments.requestModel.customerId,
context: context,
requestOfferId: 0,
requestId: requestDetailPageArguments.requestModel.id,
customerRequestIndex: requestDetailPageArguments.requestIndex,
)
.whenComplete(
() => navigateWithName(context, AppRoutes.chatView, arguments: chatViewArguments),
);
},
),
],
],
),
),
);
}
Widget buildRequestContainer(BuildContext context) {
final requestDetail = requestDetailPageArguments.requestModel;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
requestDetail.vehicleTypeName.toText(fontSize: 16, letterSpacing: -0.64),
showItem("Manufacturer:", requestDetail.brand),
showItem("Model:", "${requestDetail.year}"),
],
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.start,
children: [
"${requestDetail.city ?? ""} ${requestDetail.countryName}".toText(
color: MyColors.lightTextColor,
),
if (requestDetail.createdOn != null) ...[
DateTime.parse(requestDetail.createdOn!).getTimeAgo().toText(
color: MyColors.lightTextColor,
),
],
],
),
],
),
showItem("Customer Name: ", requestDetail.customerName),
showItem("Description: ", requestDetail.description),
16.height,
showItem("Price Range:", ""),
Row(
children: [
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
"${requestDetail.price.toInt()}".toText(fontSize: 19, isBold: true, letterSpacing: -1.16),
2.width,
LocaleKeys.sar.tr().toText(color: MyColors.lightTextColor, fontSize: 10, letterSpacing: -0.4),
],
),
Row(
children: [
Utils.statusContainerChip(
text: (requestDetail.requestStatusName),
chipColor: MyColors.grey98Color.withOpacity(0.3),
textColor: MyColors.lightTextColor,
),
],
),
],
),
),
// const Icon(Icons.arrow_forward)
],
),
],
);
}
Widget showItem(String title, String value) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (title.isNotEmpty) title.toText(color: MyColors.lightTextColor, letterSpacing: -0.48),
if (title.isNotEmpty) 2.width,
if (value.isNotEmpty) Expanded(child: value.toText(letterSpacing: -0.48)),
],
);
}
}

@ -20,6 +20,7 @@ import 'package:mc_common_app/widgets/bottom_sheet.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart'; import 'package:mc_common_app/widgets/button/show_fill_button.dart';
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart'; import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
import 'package:mc_common_app/widgets/row_with_arrow.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class BranchDetailPage extends StatelessWidget { class BranchDetailPage extends StatelessWidget {
@ -68,6 +69,7 @@ class BranchDetailPage extends StatelessWidget {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
borderColor: MyColors.darkPrimaryColor, borderColor: MyColors.darkPrimaryColor,
txtColor: MyColors.darkPrimaryColor, txtColor: MyColors.darkPrimaryColor,
fontSize: 15,
isFilled: false, isFilled: false,
onPressed: () async { onPressed: () async {
showMyBottomSheet( showMyBottomSheet(
@ -142,6 +144,7 @@ class BranchDetailPage extends StatelessWidget {
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
children: [ children: [
10.height,
Column( Column(
children: [ children: [
Row( Row(
@ -149,12 +152,19 @@ class BranchDetailPage extends StatelessWidget {
Expanded( Expanded(
child: Row( child: Row(
children: [ children: [
branchData.branchProfileImage.buildNetworkImage( branchData.branchProfileImage.buildNetworkImage(height: 66, width: 53, fit: BoxFit.cover),
height: 55, 11.width,
width: 50, Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
(branchData.branchName!).toText(fontSize: 16, color: MyColors.darkTextColor),
showData("${LocaleKeys.city.tr()}:", branchData.cityName.toString()),
showData("${LocaleKeys.country.tr()}:", branchData.countryName.toString()),
],
),
), ),
10.width,
LocaleKeys.branchInfo.tr().toText(fontSize: 16, color: Colors.black, isBold: true),
], ],
), ),
), ),
@ -170,15 +180,15 @@ class BranchDetailPage extends StatelessWidget {
), ),
Column( Column(
children: [ children: [
showData("${LocaleKeys.country.tr()}:", branchData.countryName.toString()), // showData("${LocaleKeys.country.tr()}:", branchData.countryName.toString()),
showData("${LocaleKeys.city.tr()}:", branchData.cityName.toString()), // showData("${LocaleKeys.city.tr()}:", branchData.cityName.toString()),
showData("${LocaleKeys.branchName.tr()}:", branchData.branchName.toString()), showData("${LocaleKeys.branchName.tr()}:", branchData.branchName.toString()),
showData("${LocaleKeys.branchDescription.tr()}:", branchData.branchDescription.toString()), showData("${LocaleKeys.branchDescription.tr()}:", branchData.branchDescription.toString()),
showData("${LocaleKeys.branchDescription.tr()}:", branchData.branchDescription.toString()), // showData("${LocaleKeys.branchDescription.tr()}:", branchData.branchDescription.toString()),
showData("${LocaleKeys.time.tr()}:", "${branchData.openTime.toString()} - ${branchData.closeTime.toString()}"), showData("${LocaleKeys.time.tr()}:", "${branchData.openTime.toString()} - ${branchData.closeTime.toString()}"),
showData("${LocaleKeys.address.tr()}:", branchData.address.toString()), showData("${LocaleKeys.address.tr()}:", branchData.address.toString()),
], ],
).paddingOnly(left: 60), ).paddingOnly(left: 65),
], ],
).horPaddingMain(), ).horPaddingMain(),
10.height, 10.height,
@ -191,6 +201,7 @@ class BranchDetailPage extends StatelessWidget {
const Icon( const Icon(
Icons.calendar_month, Icons.calendar_month,
color: Colors.white, color: Colors.white,
), ),
8.width, 8.width,
Expanded( Expanded(
@ -198,15 +209,18 @@ class BranchDetailPage extends StatelessWidget {
isUnderLine: true, isUnderLine: true,
fontSize: 12, fontSize: 12,
color: Colors.white, color: Colors.white,
decorationColor: MyColors.white,
), ),
), ),
const Icon(
Icons.arrow_forward,
size: 20,
color: Colors.white,
),
], ],
), )
.withArrow(
isArrowEnabled: true,
color: Colors.white,
arrowWidth: 16.16,
arrowHeight: 11.75,
)
.margin(right: 5),
).onPress(() { ).onPress(() {
navigateWithName(context, ProviderAppRoutes.schedulesList, arguments: branchData.id.toString()); navigateWithName(context, ProviderAppRoutes.schedulesList, arguments: branchData.id.toString());
}), }),
@ -224,9 +238,9 @@ class BranchDetailPage extends StatelessWidget {
), ),
8.width, 8.width,
LocaleKeys.addNewService.tr().toText( LocaleKeys.addNewService.tr().toText(
fontSize: 15, fontSize: 13,
color: MyColors.lightTextColor, color: MyColors.lightTextColor,
isBold: true, letterSpacing: -0.52
), ),
], ],
) )
@ -263,8 +277,8 @@ class BranchDetailPage extends StatelessWidget {
padding: const EdgeInsets.only(top: 5), padding: const EdgeInsets.only(top: 5),
child: SvgPicture.asset( child: SvgPicture.asset(
MyAssets.maintenanceIcon, MyAssets.maintenanceIcon,
width: 16, width: 14,
height: 16, height: 14,
), ),
), ),
8.width, 8.width,
@ -276,7 +290,7 @@ class BranchDetailPage extends StatelessWidget {
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
categories[pIndex].categoryName.toString().toText(fontSize: 16, isBold: true), categories[pIndex].categoryName.toString().toText(fontSize: 16),
// Padding( // Padding(
// padding: const EdgeInsets.all(4.0), // padding: const EdgeInsets.all(4.0),
// child: SvgPicture.asset( // child: SvgPicture.asset(
@ -287,6 +301,7 @@ class BranchDetailPage extends StatelessWidget {
// ), // ),
], ],
), ),
8.height,
Row( Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
@ -301,7 +316,7 @@ class BranchDetailPage extends StatelessWidget {
.toText( .toText(
fontSize: 12, fontSize: 12,
color: MyColors.lightTextColor, color: MyColors.lightTextColor,
isBold: true,
), ),
); );
}, },
@ -311,15 +326,15 @@ class BranchDetailPage extends StatelessWidget {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
), ),
), ),
const Padding( // const Padding(
padding: EdgeInsets.all(4.0), // padding: EdgeInsets.all(4.0),
child: Icon( // child: Icon(
Icons.arrow_forward, // Icons.arrow_forward,
size: 20, // size: 20,
), // ),
), // ),
], ],
) ).withArrow(isArrowEnabled: true)
], ],
)), )),
], ],
@ -371,7 +386,10 @@ class BranchDetailPage extends StatelessWidget {
return Row( return Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
title.toText(fontSize: 10, color: Colors.black, isBold: true), title.toText(
fontSize: 12,
color: MyColors.darkTextColor,
),
8.width, 8.width,
Flexible( Flexible(
child: value.toText( child: value.toText(

@ -1,5 +1,9 @@
import 'package:car_provider_app/config/provider_routes.dart'; import 'package:car_provider_app/config/provider_routes.dart';
import 'package:flutter/gestures.dart';
import 'package:mc_common_app/classes/consts.dart';
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/utils/app_permission_handler.dart';
import 'package:mc_common_app/utils/dialogs_and_bottomsheets.dart';
import 'package:mc_common_app/view_models/service_view_model.dart'; import 'package:mc_common_app/view_models/service_view_model.dart';
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -11,16 +15,50 @@ 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/utils/utils.dart'; import 'package:mc_common_app/utils/utils.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart'; import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart'; import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart'; import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
import 'package:mc_common_app/widgets/tab/role_type_tab.dart'; import 'package:mc_common_app/widgets/tab/role_type_tab.dart';
import 'package:mc_common_app/widgets/row_with_arrow.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
class BranchListPage extends StatelessWidget { class BranchListPage extends StatelessWidget {
const BranchListPage({Key? key}) : super(key: key); const BranchListPage({Key? key}) : super(key: key);
void deleteAdBottomSheet(BuildContext context, int branchID) {
return actionConfirmationBottomSheet(
context: context,
title: LocaleKeys.deleteBranchConfirmation.tr().toText(fontSize: 28, isBold: true, letterSpacing: -1.44),
subtitle: LocaleKeys.deleteBranchConfirmationMessage.tr(),
actionButtonYes: Expanded(
child: ShowFillButton(
maxHeight: 55,
title: LocaleKeys.yes.tr(),
fontSize: 15,
onPressed: () async {
Navigator.pop(context);
await context.read<ServiceVM>().onDeleteBranchPressed(context: context, branchID: branchID ?? -1);
},
),
),
actionButtonNo: Expanded(
child: ShowFillButton(
maxHeight: 55,
isFilled: false,
borderColor: MyColors.darkPrimaryColor,
title: LocaleKeys.no.tr(),
txtColor: MyColors.darkPrimaryColor,
fontSize: 15,
onPressed: () {
Navigator.pop(context);
},
),
),
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -70,65 +108,84 @@ class BranchListPage extends StatelessWidget {
? Center(child: LocaleKeys.no_branch.tr().toText(fontSize: 16, color: MyColors.lightTextColor)) ? Center(child: LocaleKeys.no_branch.tr().toText(fontSize: 16, color: MyColors.lightTextColor))
: ListView.separated( : ListView.separated(
itemBuilder: (context, index) { itemBuilder: (context, index) {
BranchDetailModel branchModel = branches[index]; BranchDetailModel branchModel = branches[index];
return Row( return Dismissible(
children: [ key: Key(index.toString()),
branchModel.branchProfileImage.buildNetworkImage(width: 74, height: 50, fit: BoxFit.cover), background: const SizedBox(),
12.width, secondaryBackground: Container(
Expanded( color: const Color(0xFFDD0505),
child: Column( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
Row( LocaleKeys.delete.tr().toText(fontSize: 15, fontWeight: MyFonts.Medium, height: 23 / 25, color: MyColors.white).margin(right: 23),
mainAxisAlignment: MainAxisAlignment.spaceBetween, ],
children: [ ),
Utils.statusContainerChip( ),
text: branchModel.branchStatusLabel ?? "", dragStartBehavior: DragStartBehavior.start,
chipColor: Utils.getChipColorByBranchStatus(branchModel.branchStatus!), direction: DismissDirection.endToStart,
), confirmDismiss: (DismissDirection direction) async {
InkWell( deleteAdBottomSheet(context, branchModel.id!);
onTap: () async { },
await serviceVM.onDeleteBranchPressed(context: context, branchID: branchModel.id ?? -1); child: Row(
}, children: [
child: const Icon( branchModel.branchProfileImage.buildNetworkImage(width: 66, height: 53, fit: BoxFit.cover),
Icons.delete, 12.width,
color: MyColors.grey70Color, Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Utils.statusContainerChip(
text: branchModel.branchStatusLabel ?? "",
chipColor: Utils.getChipColorByBranchStatus(branchModel.branchStatus!),
), ),
), ],
],
),
5.height,
Text(
branchModel.branchName ?? "",
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
), ),
), 2.height,
Row( // branchModel.distanceKm == null
mainAxisAlignment: MainAxisAlignment.spaceBetween, // ? const SizedBox()
children: [ // : Row(
Flexible( // crossAxisAlignment: CrossAxisAlignment.center,
child: (branchModel.branchDescription ?? "").toText( // children: [
fontSize: 10, // const Icon(
overflow: TextOverflow.ellipsis, // Icons.location_on,
color: MyColors.grey70Color, // color: MyColors.darkPrimaryColor,
maxLines: 2, // size: 15,
)), // ),
const Icon(Icons.arrow_forward_rounded, size: 18, color: MyColors.grey70Color), // 2.width,
], // ("${branchModel.distanceKm} KM").toText(
) // color: MyColors.darkPrimaryColor,
], // fontSize: 10,
// )
// ],
// ),
// 5.height,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
(branchModel.branchName ?? "").toText(fontSize: 16, height: 18 / 16),
],
).withArrow(isArrowEnabled: true).margin(right: 10),
(branchModel.branchDescription ?? "").toText(
fontSize: 10,
overflow: TextOverflow.ellipsis,
color: MyColors.grey70Color,
maxLines: 2,
)
],
),
), ),
), ],
], ).toWhiteContainer(width: double.infinity, pading: const EdgeInsets.all(12)).onPress(() async {
).toWhiteContainer(width: double.infinity, pading: const EdgeInsets.all(12)).onPress(() async { branchModel.countryID = serviceVM.branches!.data!.countryID;
branchModel.countryID = serviceVM.branches!.data!.countryID; branchModel.countryName = serviceVM.branches!.data!.countryName;
branchModel.countryName = serviceVM.branches!.data!.countryName; navigateWithName(context, ProviderAppRoutes.branchDetail, arguments: branchModel);
navigateWithName(context, ProviderAppRoutes.branchDetail, arguments: branchModel); }),
}); );
}, },
separatorBuilder: (context, index) => 12.height, separatorBuilder: (context, index) => 12.height,
itemCount: branches.length, itemCount: branches.length,

@ -52,6 +52,8 @@ class _AssignDealerUserSheetState extends State<AssignDealerUserSheet> {
padding: const EdgeInsets.all(21), padding: const EdgeInsets.all(21),
color: Colors.white, color: Colors.white,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Expanded( Expanded(
child: Consumer<ServiceVM>(builder: (context, model, _) { child: Consumer<ServiceVM>(builder: (context, model, _) {
@ -83,6 +85,8 @@ class _AssignDealerUserSheetState extends State<AssignDealerUserSheet> {
title: LocaleKeys.assignDealerUser.tr(), title: LocaleKeys.assignDealerUser.tr(),
maxWidth: double.infinity, maxWidth: double.infinity,
maxHeight: 55, maxHeight: 55,
fontSize: 15,
onPressed: () async { onPressed: () async {
if (validation()) { if (validation()) {
Utils.showLoading(context); Utils.showLoading(context);
@ -113,6 +117,7 @@ class _AssignDealerUserSheetState extends State<AssignDealerUserSheet> {
title: ("+ ${LocaleKeys.createNewUser.tr()}"), title: ("+ ${LocaleKeys.createNewUser.tr()}"),
maxWidth: double.infinity, maxWidth: double.infinity,
maxHeight: 55, maxHeight: 55,
fontSize: 15,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
borderColor: MyColors.darkPrimaryColor, borderColor: MyColors.darkPrimaryColor,
txtColor: MyColors.darkPrimaryColor, txtColor: MyColors.darkPrimaryColor,
@ -136,18 +141,20 @@ class _AssignDealerUserSheetState extends State<AssignDealerUserSheet> {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Checkbox( Checkbox(
value: model.allProviderDealersList[index].isBranchUser, value: model.allProviderDealersList[index].isBranchUser,
onChanged: (v) { onChanged: (v) {
model.allProviderDealersList[index].isBranchUser = v ?? false; model.allProviderDealersList[index].isBranchUser = v ?? false;
model.notifyListeners(); model.notifyListeners();
}), },
visualDensity: VisualDensity.comfortable,
),
4.width, 4.width,
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
("${model.allProviderDealersList[index].firstName} ${model.allProviderDealersList[index].lastName}").toText(fontSize: 16, isBold: true), ("${model.allProviderDealersList[index].firstName} ${model.allProviderDealersList[index].lastName}").toText(fontSize: 16),
8.height, 8.height,
itemWidget("Role", "Dealer User"), itemWidget("Role", "Dealer User"),
itemWidget("Email", model.allProviderDealersList[index].email ?? ""), itemWidget("Email", model.allProviderDealersList[index].email ?? ""),

@ -41,7 +41,7 @@ dependencies:
mc_common_app: mc_common_app:
# path: /Users/amir/StudioProjects/car_common_app # path: /Users/amir/StudioProjects/car_common_app
path: /Volumes/Data/Projects/Flutter/car_common_app path: /Users/amir/StudioProjects/car_common_app

Loading…
Cancel
Save