|
|
|
|
@ -8,19 +8,40 @@ import 'package:mc_common_app/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:mc_common_app/generated/locale_keys.g.dart';
|
|
|
|
|
import 'package:mc_common_app/models/user_models/user.dart';
|
|
|
|
|
import 'package:mc_common_app/utils/date_helper.dart';
|
|
|
|
|
import 'package:mc_common_app/utils/dialogs_and_bottomsheets.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/view_models/requests_view_model.dart';
|
|
|
|
|
import 'package:mc_common_app/views/advertisement/ad_creation_steps/ad_review_containers.dart';
|
|
|
|
|
import 'package:mc_common_app/views/location_views/pick_location_page.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/info_bottom_sheet.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/txt_field.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
class ReviewRequestOffer extends StatelessWidget {
|
|
|
|
|
class ReviewRequestOffer extends StatefulWidget {
|
|
|
|
|
const ReviewRequestOffer({super.key});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<ReviewRequestOffer> createState() => _ReviewRequestOfferState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _ReviewRequestOfferState extends State<ReviewRequestOffer> {
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
final requestVM = context.read<RequestsVM>();
|
|
|
|
|
|
|
|
|
|
if (requestVM.currentSelectedRequest != null && requestVM.currentSelectedRequest!.address.isEmpty) {
|
|
|
|
|
requestVM.addressSparePartRequestDelivery = "";
|
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async => buildLocationInformationEditBottomSheet(context, requestVM));
|
|
|
|
|
}
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget buildPersonalInformation() {
|
|
|
|
|
UserInfo userInfo = AppState().getUser.data!.userInfo!;
|
|
|
|
|
return Column(
|
|
|
|
|
@ -30,7 +51,7 @@ class ReviewRequestOffer extends StatelessWidget {
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.personalInformation.tr().toText(fontSize: 18),
|
|
|
|
|
MyAssets.icEdit.buildSvg().onPress(() {}),
|
|
|
|
|
const SizedBox(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
@ -44,6 +65,7 @@ class ReviewRequestOffer extends StatelessWidget {
|
|
|
|
|
children: [
|
|
|
|
|
SingleDetailWidget(text: "${userInfo.firstName ?? ""} ${userInfo.lastName ?? ""}", type: LocaleKeys.name.tr()),
|
|
|
|
|
16.height,
|
|
|
|
|
SingleDetailWidget(text: userInfo.email ?? "", type: LocaleKeys.email.tr()),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -52,8 +74,9 @@ class ReviewRequestOffer extends StatelessWidget {
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
SingleDetailWidget(text: userInfo.email ?? "", type: "${LocaleKeys.email.tr()} / ${LocaleKeys.phone.tr()}"),
|
|
|
|
|
SingleDetailWidget(text: userInfo.mobileNo ?? "", type: LocaleKeys.phone.tr()),
|
|
|
|
|
16.height,
|
|
|
|
|
const SingleDetailWidget(text: "", type: ""),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
@ -64,7 +87,8 @@ class ReviewRequestOffer extends StatelessWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget buildLocationInformation(BuildContext context) {
|
|
|
|
|
final requestVM = context.read<RequestsVM>();
|
|
|
|
|
final requestVM = context.watch<RequestsVM>();
|
|
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
@ -72,7 +96,7 @@ class ReviewRequestOffer extends StatelessWidget {
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.locationInformation.tr().toText(fontSize: 18),
|
|
|
|
|
MyAssets.icEdit.buildSvg().onPress(() {}),
|
|
|
|
|
MyAssets.icEdit.buildSvg().onPress(() => buildLocationInformationEditBottomSheet(context, requestVM)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
@ -81,7 +105,7 @@ class ReviewRequestOffer extends StatelessWidget {
|
|
|
|
|
children: [
|
|
|
|
|
SingleDetailWidget(text: requestVM.currentSelectedRequest!.address ?? "", type: LocaleKeys.location.tr()),
|
|
|
|
|
16.height,
|
|
|
|
|
SingleDetailWidget(text: "N/A", type: "${LocaleKeys.email.tr()} / ${LocaleKeys.additionalAddressDetails.tr()}"),
|
|
|
|
|
SingleDetailWidget(text: requestVM.additionalAddressSparePartRequestDelivery.isNotEmpty ? requestVM.additionalAddressSparePartRequestDelivery : "N/A", type: LocaleKeys.additionalAddressDetails.tr()),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
@ -100,9 +124,9 @@ class ReviewRequestOffer extends StatelessWidget {
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
LocaleKeys.serviceInformation.tr().toText(fontSize: 18),
|
|
|
|
|
MyAssets.icEdit.buildSvg().onPress(() {}),
|
|
|
|
|
const SizedBox(),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
@ -155,6 +179,82 @@ class ReviewRequestOffer extends StatelessWidget {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future buildLocationInformationEditBottomSheet(BuildContext context, RequestsVM requestsVM) async {
|
|
|
|
|
String additionalDetails = "";
|
|
|
|
|
return showModalBottomSheet(
|
|
|
|
|
context: context,
|
|
|
|
|
isScrollControlled: true,
|
|
|
|
|
enableDrag: true,
|
|
|
|
|
builder: (BuildContext context) {
|
|
|
|
|
return InfoBottomSheet(
|
|
|
|
|
title: LocaleKeys.locationInformation.tr().toText(fontSize: 28, isBold: true, letterSpacing: -1.44),
|
|
|
|
|
description: Padding(
|
|
|
|
|
padding: MediaQuery.of(context).viewInsets,
|
|
|
|
|
child: StatefulBuilder(
|
|
|
|
|
builder: (BuildContext context, setState) {
|
|
|
|
|
return Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
"Update your location information".toText(fontSize: 14, fontWeight: MyFonts.Medium),
|
|
|
|
|
8.height,
|
|
|
|
|
TxtField(
|
|
|
|
|
hint: LocaleKeys.address.tr(),
|
|
|
|
|
isNeedClickAll: false,
|
|
|
|
|
value: requestsVM.addressSparePartRequestDelivery,
|
|
|
|
|
postfixWidget: IconButton(
|
|
|
|
|
icon: const Icon(
|
|
|
|
|
size: 28,
|
|
|
|
|
Icons.add_location_outlined,
|
|
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
navigateTo(
|
|
|
|
|
context,
|
|
|
|
|
PickLocationPage(
|
|
|
|
|
onPickAddress: (double latitude, double longitude, String address) {
|
|
|
|
|
requestsVM.updateAddressSparePartRequestDelivery(address);
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
onChanged: (e) => requestsVM.updateAddressSparePartRequestDelivery(e),
|
|
|
|
|
),
|
|
|
|
|
8.height,
|
|
|
|
|
TxtField(
|
|
|
|
|
hint: LocaleKeys.additionalAddressDetails.tr(),
|
|
|
|
|
isNeedClickAll: false,
|
|
|
|
|
value: requestsVM.additionalAddressSparePartRequestDelivery,
|
|
|
|
|
onChanged: (e) {
|
|
|
|
|
additionalDetails = e;
|
|
|
|
|
}),
|
|
|
|
|
19.height,
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ShowFillButton(
|
|
|
|
|
title: LocaleKeys.submit.tr(),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
// TODO: Call some api here to update this info for this specific request.
|
|
|
|
|
requestsVM.currentSelectedRequest!.address = requestsVM.addressSparePartRequestDelivery;
|
|
|
|
|
requestsVM.updateAdditionalAddressSparePartRequestDelivery(additionalDetails);
|
|
|
|
|
requestsVM.notifyListeners();
|
|
|
|
|
pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
25.height,
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
|