pushing again with main activity

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

@ -45,9 +45,7 @@ class _CreateBranchViewState extends State<CreateBranchView> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: CustomAppBar(
title: LocaleKeys.createBranch.tr(),
),
appBar: CustomAppBar(title: LocaleKeys.defineBranches.tr()),
body: Consumer<ServiceVM>(builder: (context, serviceVM, _) {
return SizedBox(
width: double.infinity,
@ -56,152 +54,148 @@ class _CreateBranchViewState extends State<CreateBranchView> {
children: [
Expanded(
child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
children: [
// LocaleKeys.chooseCountry.tr().toText(fontSize: 14, color: MyColors.lightTextColor),
// 8.height,
serviceVM.country != null
? DropdownField(
(DropValue value) {
serviceVM.countryValue = DropValue(value.id, value.value, "");
serviceVM.countryCode = value.subValue;
serviceVM.countryId = value.id;
serviceVM.getAllCities(widget.branchData, EasyLocalization.of(context)?.currentLocale?.countryCode ?? "SA");
},
isSelectAble: widget.branchData == null ? true : false,
list: serviceVM.countryDropList,
dropdownValue: serviceVM.countryValue,
hint: "${LocaleKeys.chooseCountry.tr()}*",
)
child: Column(
children: [
12.height,
serviceVM.country != null
? DropdownField(
(DropValue value) {
serviceVM.countryValue = DropValue(value.id, value.value, "");
serviceVM.countryCode = value.subValue;
serviceVM.countryId = value.id;
serviceVM.getAllCities(widget.branchData, EasyLocalization.of(context)?.currentLocale?.countryCode ?? "SA");
},
isSelectAble: widget.branchData == null ? true : false,
list: serviceVM.countryDropList,
dropdownValue: serviceVM.countryValue,
hint: "${LocaleKeys.chooseCountry.tr()}*",
)
: const CircularProgressIndicator(),
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(),
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(),
12.height,
if (serviceVM.cityId != -1)
Column(
children: [
TxtField(
hint: "${LocaleKeys.branchName.tr()}*",
value: serviceVM.branchName,
onChanged: (v) {
serviceVM.branchName = v;
},
),
12.height,
TxtField(
hint: "${LocaleKeys.branchDescription.tr()}*",
value: serviceVM.branchDescription,
onChanged: (v) {
serviceVM.branchDescription = v;
},
),
12.height,
TxtField(
hint: LocaleKeys.address.tr(),
isNeedClickAll: false,
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)),
12.height,
if (serviceVM.cityId != -1)
Column(
children: [
TxtField(
hint: "${LocaleKeys.branchName.tr()}*",
value: serviceVM.branchName,
onChanged: (v) {
serviceVM.branchName = v;
},
),
12.height,
TxtField(
hint: "${LocaleKeys.branchDescription.tr()}*",
value: serviceVM.branchDescription,
onChanged: (v) {
serviceVM.branchDescription = v;
},
),
12.height,
TxtField(
hint: LocaleKeys.address.tr(),
isNeedClickAll: false,
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: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Icon(
Icons.place_outlined,
size: 18,
);
},
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,
children: [
const Icon(
Icons.place_outlined,
size: 18,
color: MyColors.darkPrimaryColor,
),
8.width,
Text(
LocaleKeys.pickAddress.tr(),
style: const TextStyle(
color: MyColors.darkPrimaryColor,
),
8.width,
Text(
LocaleKeys.pickAddress.tr(),
style: const TextStyle(
color: MyColors.darkPrimaryColor,
),
),
],
),
),
],
),
),
12.height,
DottedRectContainer(
onTap: () => serviceVM.pickMultipleImages(),
text: LocaleKeys.attachImage.tr(),
icon: MyAssets.attachmentIcon.buildSvg(),
),
12.height,
DottedRectContainer(
onTap: () => serviceVM.pickMultipleImages(),
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) ...[
SizedBox(
width: double.infinity,
child: Padding(
padding: const EdgeInsets.only(left: 20, right: 20, bottom: 20),
padding: const EdgeInsets.only(left: 20, right: 20, bottom: 10),
child: ShowFillButton(
maxHeight: 55,
title: LocaleKeys.createBranch.tr(),
@ -222,25 +216,24 @@ class _CreateBranchViewState extends State<CreateBranchView> {
] else ...[
SizedBox(
width: double.infinity,
child: Padding(
padding: const EdgeInsets.only(left: 20, right: 20, bottom: 20),
child: ShowFillButton(
maxHeight: 55,
title: widget.branchData != null ? (widget.branchData!.id == null ? LocaleKeys.createBranch.tr() : LocaleKeys.updateBranch.tr()) : LocaleKeys.createBranch.tr(),
onPressed: () async {
await serviceVM.updateBranch(
widget.branchData!.id ?? 0,
serviceVM.branchName,
serviceVM.branchDescription,
serviceVM.cityId.toString(),
serviceVM.address,
serviceVM.latitude.toString(),
serviceVM.longitude.toString(),
);
},
),
),
child: ShowFillButton(
maxHeight: 55,
title: LocaleKeys.updateBranch.tr(),
onPressed: () async {
await serviceVM.onUpdateBranchPressed(
context: context,
branchID: widget.branchData!.id ?? 0,
branchName: widget.branchData!.branchName ?? "",
branchDesc: widget.branchData!.branchDescription ?? "",
cityID: widget.branchData!.cityId ?? 0,
address: widget.branchData!.address ?? "",
latitude: widget.branchData!.latitude ?? "0",
longitude: widget.branchData!.longitude ?? "0",
);
},
).horPaddingMain(),
),
12.height,
],
],
),

Loading…
Cancel
Save