pushing again with main activity

aamir_dev
Faiz Hashmi 2 years ago
parent b38a5e4b69
commit 3ccb9d4955

@ -0,0 +1,7 @@
package com.cloud.solutions.mowater.ksa.provider
import io.flutter.embedding.android.FlutterFragmentActivity
class MainActivity: FlutterFragmentActivity() {
}

@ -1,7 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'package:car_provider_app/config/provider_routes.dart'; import 'package:car_provider_app/config/provider_routes.dart';
import 'package:car_provider_app/views/settings/branch/dealer/widget/assign_dealer_user_sheet.dart'; import 'package:car_provider_app/views/settings/branch/dealer/widget/assign_dealer_user_sheet.dart';
import 'package:flutter/cupertino.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/view_models/service_view_model.dart'; import 'package:mc_common_app/view_models/service_view_model.dart';
import 'package:car_provider_app/views/settings/services/services_list_page.dart'; import 'package:car_provider_app/views/settings/services/services_list_page.dart';
@ -96,21 +95,31 @@ class BranchDetailPage extends StatelessWidget {
actionWidget = Column( actionWidget = Column(
children: [ children: [
Row( Row(
children: [ children: [('${LocaleKeys.rejectionComments.tr()}:').toText(fontSize: 16, color: MyColors.darkTextColor, textAlign: TextAlign.right)],
('${LocaleKeys.rejectionComments.tr()}:').toText(fontSize: 16, color: MyColors.darkTextColor),
],
), ),
Row( Row(
children: [ children: [
Flexible( if (branchData.branchAuditTrial != null && branchData.branchAuditTrial!.isNotEmpty) ...[
child: ('These are some dummy static comments from the Admin. Which will guide you regarding the next steps to resubmit.').toText( Flexible(
fontSize: 14, child: ("${branchData.branchAuditTrial!.first.comment}").toText(
color: MyColors.primaryColor, fontSize: 14,
isItalic: true, color: MyColors.primaryColor,
isItalic: true,
),
), ),
), ]
], ],
), ),
12.height,
ShowFillButton(
title: LocaleKeys.rejectedFormAdmin.tr(),
maxWidth: double.infinity,
backgroundColor: MyColors.darkWhiteColor,
borderColor: MyColors.darkPrimaryColor,
txtColor: MyColors.lightTextColor,
isFilled: true,
onPressed: () {},
),
], ],
); );
} }
@ -120,7 +129,7 @@ class BranchDetailPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
filterBranch(); filterBranch();
getBranchUsers(context); // getBranchUsers(context);
return Scaffold( return Scaffold(
appBar: CustomAppBar(title: LocaleKeys.branchDetail.tr()), appBar: CustomAppBar(title: LocaleKeys.branchDetail.tr()),
body: Consumer<ServiceVM>(builder: (context, model, _) { body: Consumer<ServiceVM>(builder: (context, model, _) {
@ -140,8 +149,11 @@ class BranchDetailPage extends StatelessWidget {
Expanded( Expanded(
child: Row( child: Row(
children: [ children: [
branchData.branchProfileImage.buildNetworkImage(), branchData.branchProfileImage.buildNetworkImage(
12.width, height: 55,
width: 50,
),
10.width,
LocaleKeys.branchInfo.tr().toText(fontSize: 16, color: Colors.black, isBold: true), LocaleKeys.branchInfo.tr().toText(fontSize: 16, color: Colors.black, isBold: true),
], ],
), ),
@ -162,9 +174,11 @@ class BranchDetailPage extends StatelessWidget {
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.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),
], ],
).horPaddingMain(), ).horPaddingMain(),
10.height, 10.height,
@ -181,10 +195,10 @@ class BranchDetailPage extends StatelessWidget {
8.width, 8.width,
Expanded( Expanded(
child: LocaleKeys.setorEditBranchSchedule.tr().toText( child: LocaleKeys.setorEditBranchSchedule.tr().toText(
isUnderLine: true, isUnderLine: true,
fontSize: 12, fontSize: 12,
color: Colors.white, color: Colors.white,
), ),
), ),
const Icon( const Icon(
Icons.arrow_forward, Icons.arrow_forward,
@ -210,10 +224,10 @@ class BranchDetailPage extends StatelessWidget {
), ),
8.width, 8.width,
LocaleKeys.addNewService.tr().toText( LocaleKeys.addNewService.tr().toText(
fontSize: 15, fontSize: 15,
color: MyColors.lightTextColor, color: MyColors.lightTextColor,
isBold: true, isBold: true,
), ),
], ],
) )
.toContainer( .toContainer(
@ -256,61 +270,58 @@ class BranchDetailPage extends StatelessWidget {
8.width, 8.width,
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Row( categories[pIndex].categoryName.toString().toText(fontSize: 16, isBold: true),
mainAxisAlignment: MainAxisAlignment.spaceBetween, // Padding(
children: [ // padding: const EdgeInsets.all(4.0),
categories[pIndex].categoryName.toString().toText(fontSize: 16, isBold: true), // child: SvgPicture.asset(
// Padding( // MyAssets.icEdit,
// padding: const EdgeInsets.all(4.0), // width: 16,
// child: SvgPicture.asset( // height: 16,
// MyAssets.icEdit, // ),
// width: 16, // ),
// height: 16, ],
// ), ),
// ), Row(
], mainAxisAlignment: MainAxisAlignment.end,
), crossAxisAlignment: CrossAxisAlignment.end,
Row( children: [
mainAxisAlignment: MainAxisAlignment.end, Expanded(
crossAxisAlignment: CrossAxisAlignment.end, child: ListView.builder(
children: [ itemBuilder: (context, index) {
Expanded( return Container(
child: ListView.builder( child: (EasyLocalization.of(context)?.currentLocale?.countryCode == "SA"
itemBuilder: (context, index) {
return Container(
child: (EasyLocalization
.of(context)
?.currentLocale
?.countryCode == "SA"
? categories[pIndex].services![index].serviceDescriptionN.toString() ? categories[pIndex].services![index].serviceDescriptionN.toString()
: categories[pIndex].services![index].serviceDescription.toString()) : categories[pIndex].services![index].serviceDescription.toString())
.toText( .toText(
fontSize: 12, fontSize: 12,
color: MyColors.lightTextColor, color: MyColors.lightTextColor,
isBold: true, isBold: true,
), ),
); );
}, },
itemCount: categories[pIndex].services?.length, itemCount: categories[pIndex].services?.length,
physics: const NeverScrollableScrollPhysics(), physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
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,
), ),
), ),
],
)
], ],
)), )
],
)),
], ],
).toContainer( ).toContainer(
borderRadius: 0, borderRadius: 0,
@ -348,9 +359,7 @@ class BranchDetailPage extends StatelessWidget {
bool validation(BuildContext context) { bool validation(BuildContext context) {
bool isValid = false; bool isValid = false;
for (var element in context for (var element in context.read<ServiceVM>().allProviderDealersList) {
.read<ServiceVM>()
.allProviderDealersList) {
if (element.isBranchUser ?? false) { if (element.isBranchUser ?? false) {
isValid = true; isValid = true;
} }

@ -45,9 +45,7 @@ class _CreateBranchViewState extends State<CreateBranchView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: CustomAppBar( appBar: CustomAppBar(title: LocaleKeys.defineBranches.tr()),
title: LocaleKeys.createBranch.tr(),
),
body: Consumer<ServiceVM>(builder: (context, serviceVM, _) { body: Consumer<ServiceVM>(builder: (context, serviceVM, _) {
return SizedBox( return SizedBox(
width: double.infinity, width: double.infinity,
@ -56,152 +54,148 @@ class _CreateBranchViewState extends State<CreateBranchView> {
children: [ children: [
Expanded( Expanded(
child: SingleChildScrollView( child: SingleChildScrollView(
child: Padding( child: Column(
padding: const EdgeInsets.all(20.0), children: [
child: Column( 12.height,
children: [ serviceVM.country != null
// LocaleKeys.chooseCountry.tr().toText(fontSize: 14, color: MyColors.lightTextColor), ? DropdownField(
// 8.height, (DropValue value) {
serviceVM.country != null serviceVM.countryValue = DropValue(value.id, value.value, "");
? DropdownField( serviceVM.countryCode = value.subValue;
(DropValue value) { serviceVM.countryId = value.id;
serviceVM.countryValue = DropValue(value.id, value.value, ""); serviceVM.getAllCities(widget.branchData, EasyLocalization.of(context)?.currentLocale?.countryCode ?? "SA");
serviceVM.countryCode = value.subValue; },
serviceVM.countryId = value.id; isSelectAble: widget.branchData == null ? true : false,
serviceVM.getAllCities(widget.branchData, EasyLocalization.of(context)?.currentLocale?.countryCode ?? "SA"); list: serviceVM.countryDropList,
}, dropdownValue: serviceVM.countryValue,
isSelectAble: widget.branchData == null ? true : false, hint: "${LocaleKeys.chooseCountry.tr()}*",
list: serviceVM.countryDropList, )
dropdownValue: serviceVM.countryValue, : const CircularProgressIndicator(),
hint: "${LocaleKeys.chooseCountry.tr()}*", 12.height,
) if (serviceVM.countryId != -1)
serviceVM.cities != null
? serviceVM.citiesDropList.isEmpty
? Text(LocaleKeys.no_city_available.tr())
: DropdownField(
(DropValue value) {
serviceVM.cityValue = DropValue(value.id, value.value, "");
serviceVM.setOnlyState(ViewState.busy);
serviceVM.cityId = value.id;
serviceVM.setState(ViewState.idle);
},
list: serviceVM.citiesDropList,
dropdownValue: serviceVM.cityValue,
hint: "${LocaleKeys.chooseCity.tr()}*",
)
: const CircularProgressIndicator(), : const CircularProgressIndicator(),
12.height, 12.height,
if (serviceVM.countryId != -1) if (serviceVM.cityId != -1)
serviceVM.cities != null Column(
? serviceVM.citiesDropList.isEmpty children: [
? Text(LocaleKeys.no_city_available.tr()) TxtField(
: DropdownField( hint: "${LocaleKeys.branchName.tr()}*",
(DropValue value) { value: serviceVM.branchName,
serviceVM.cityValue = DropValue(value.id, value.value, ""); onChanged: (v) {
serviceVM.setOnlyState(ViewState.busy); serviceVM.branchName = v;
serviceVM.cityId = value.id; },
serviceVM.setState(ViewState.idle); ),
}, 12.height,
list: serviceVM.citiesDropList, TxtField(
dropdownValue: serviceVM.cityValue, hint: "${LocaleKeys.branchDescription.tr()}*",
hint: "${LocaleKeys.chooseCity.tr()}*", value: serviceVM.branchDescription,
) onChanged: (v) {
: const CircularProgressIndicator(), serviceVM.branchDescription = v;
12.height, },
if (serviceVM.cityId != -1) ),
Column( 12.height,
children: [ TxtField(
TxtField( hint: LocaleKeys.address.tr(),
hint: "${LocaleKeys.branchName.tr()}*", isNeedClickAll: false,
value: serviceVM.branchName, maxLines: 3,
onChanged: (v) { value: serviceVM.address,
serviceVM.branchName = v; onChanged: (v) {
}, serviceVM.address = v;
), },
12.height, ),
TxtField( 12.height,
hint: "${LocaleKeys.branchDescription.tr()}*", InkWell(
value: serviceVM.branchDescription, onTap: () {
onChanged: (v) { navigateTo(
serviceVM.branchDescription = v; context,
}, PickLocationPage(
), onPickAddress: (double latitude, double longitude, String address) {
12.height, serviceVM.latitude = latitude;
TxtField( serviceVM.longitude = longitude;
hint: LocaleKeys.address.tr(), serviceVM.address = address;
isNeedClickAll: false, serviceVM.setState(ViewState.idle);
maxLines: 3, },
value: serviceVM.address,
onChanged: (v) {
serviceVM.address = v;
},
),
12.height,
InkWell(
onTap: () {
navigateTo(
context,
PickLocationPage(
onPickAddress: (double latitude, double longitude, String address) {
serviceVM.latitude = latitude;
serviceVM.longitude = longitude;
serviceVM.address = address;
serviceVM.setState(ViewState.idle);
},
),
);
},
child: Container(
width: double.infinity,
height: 45,
decoration: BoxDecoration(
color: Colors.transparent,
border: Border.all(color: MyColors.darkPrimaryColor, width: 2),
borderRadius: const BorderRadius.all(Radius.circular(8)),
), ),
child: Row( );
mainAxisAlignment: MainAxisAlignment.center, },
crossAxisAlignment: CrossAxisAlignment.center, child: Container(
children: [ width: double.infinity,
const Icon( height: 45,
Icons.place_outlined, decoration: BoxDecoration(
size: 18, color: Colors.transparent,
border: Border.all(color: MyColors.darkPrimaryColor, width: 2),
borderRadius: const BorderRadius.all(Radius.circular(8)),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Icon(
Icons.place_outlined,
size: 18,
color: MyColors.darkPrimaryColor,
),
8.width,
Text(
LocaleKeys.pickAddress.tr(),
style: const TextStyle(
color: MyColors.darkPrimaryColor, color: MyColors.darkPrimaryColor,
), ),
8.width, ),
Text( ],
LocaleKeys.pickAddress.tr(),
style: const TextStyle(
color: MyColors.darkPrimaryColor,
),
),
],
),
), ),
), ),
12.height, ),
DottedRectContainer( 12.height,
onTap: () => serviceVM.pickMultipleImages(), DottedRectContainer(
text: LocaleKeys.attachImage.tr(), onTap: () => serviceVM.pickMultipleImages(),
icon: MyAssets.attachmentIcon.buildSvg(), text: LocaleKeys.attachImage.tr(),
icon: MyAssets.attachmentIcon.buildSvg(),
),
if (serviceVM.branchImageError != "") ...[
10.height,
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
serviceVM.branchImageError.toText(fontSize: 14, color: Colors.red),
],
).paddingOnly(right: 10)
],
if (serviceVM.pickedBranchImages.isNotEmpty) ...[
16.height,
PickedFilesContainer(
pickedFiles: serviceVM.pickedBranchImages,
onCrossPressedPrimary: serviceVM.removeImageFromList,
onAddFilePressed: () {
serviceVM.pickMultipleImages();
},
), ),
if (serviceVM.branchImageError != "") ...[
10.height,
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
serviceVM.branchImageError.toText(fontSize: 14, color: Colors.red),
],
).paddingOnly(right: 10)
],
if (serviceVM.pickedBranchImages.isNotEmpty) ...[
16.height,
PickedFilesContainer(
pickedFiles: serviceVM.pickedBranchImages,
onCrossPressedPrimary: serviceVM.removeImageFromList,
onAddFilePressed: () {
serviceVM.pickMultipleImages();
},
),
],
], ],
), ],
], ),
), ],
), ).horPaddingMain(),
), ),
), ),
if (widget.branchData == null || widget.branchData!.id == null) ...[ if (widget.branchData == null || widget.branchData!.id == null) ...[
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
child: Padding( child: Padding(
padding: const EdgeInsets.only(left: 20, right: 20, bottom: 20), padding: const EdgeInsets.only(left: 20, right: 20, bottom: 10),
child: ShowFillButton( child: ShowFillButton(
maxHeight: 55, maxHeight: 55,
title: LocaleKeys.createBranch.tr(), title: LocaleKeys.createBranch.tr(),
@ -222,25 +216,24 @@ class _CreateBranchViewState extends State<CreateBranchView> {
] else ...[ ] else ...[
SizedBox( SizedBox(
width: double.infinity, width: double.infinity,
child: Padding( child: ShowFillButton(
padding: const EdgeInsets.only(left: 20, right: 20, bottom: 20), maxHeight: 55,
child: ShowFillButton( title: LocaleKeys.updateBranch.tr(),
maxHeight: 55, onPressed: () async {
title: widget.branchData != null ? (widget.branchData!.id == null ? LocaleKeys.createBranch.tr() : LocaleKeys.updateBranch.tr()) : LocaleKeys.createBranch.tr(), await serviceVM.onUpdateBranchPressed(
onPressed: () async { context: context,
await serviceVM.updateBranch( branchID: widget.branchData!.id ?? 0,
widget.branchData!.id ?? 0, branchName: widget.branchData!.branchName ?? "",
serviceVM.branchName, branchDesc: widget.branchData!.branchDescription ?? "",
serviceVM.branchDescription, cityID: widget.branchData!.cityId ?? 0,
serviceVM.cityId.toString(), address: widget.branchData!.address ?? "",
serviceVM.address, latitude: widget.branchData!.latitude ?? "0",
serviceVM.latitude.toString(), longitude: widget.branchData!.longitude ?? "0",
serviceVM.longitude.toString(), );
); },
}, ).horPaddingMain(),
),
),
), ),
12.height,
], ],
], ],
), ),

Loading…
Cancel
Save