|
|
|
|
@ -1,23 +1,22 @@
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:mc_common_app/classes/consts.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/models/chat_models/chat_message_model.dart';
|
|
|
|
|
import 'package:mc_common_app/theme/colors.dart';
|
|
|
|
|
import 'package:mc_common_app/utils/navigator.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/extensions/extensions_widget.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/checkbox_with_title_desc.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/common_widgets/info_bottom_sheet.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/txt_field.dart';
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ShowCollectPaymentSheet extends StatelessWidget {
|
|
|
|
|
Function() onClickYes;
|
|
|
|
|
Function() onClickNo;
|
|
|
|
|
final Function() onClickYes;
|
|
|
|
|
final Function() onClickNo;
|
|
|
|
|
|
|
|
|
|
ShowCollectPaymentSheet(
|
|
|
|
|
{required this.onClickYes, required this.onClickNo, Key? key})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
const ShowCollectPaymentSheet({required this.onClickYes, required this.onClickNo, super.key});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
@ -26,9 +25,9 @@ class ShowCollectPaymentSheet extends StatelessWidget {
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.collectMoneyBefore.tr().toText(
|
|
|
|
|
fontSize: 24,
|
|
|
|
|
isBold: true,
|
|
|
|
|
),
|
|
|
|
|
fontSize: 24,
|
|
|
|
|
isBold: true,
|
|
|
|
|
),
|
|
|
|
|
21.height,
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
@ -55,134 +54,91 @@ class ShowCollectPaymentSheet extends StatelessWidget {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class Reason {
|
|
|
|
|
String title;
|
|
|
|
|
bool isSelected;
|
|
|
|
|
|
|
|
|
|
Reason(this.title, this.isSelected);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class CancelAppointmentReasonSheet extends StatefulWidget {
|
|
|
|
|
Function(String) onCancelClick;
|
|
|
|
|
final Function(String) onCancelClick;
|
|
|
|
|
|
|
|
|
|
CancelAppointmentReasonSheet({required this.onCancelClick, Key? key})
|
|
|
|
|
: super(key: key);
|
|
|
|
|
const CancelAppointmentReasonSheet({required this.onCancelClick, super.key});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
State<CancelAppointmentReasonSheet> createState() =>
|
|
|
|
|
_CancelAppointmentReasonSheetState();
|
|
|
|
|
State<CancelAppointmentReasonSheet> createState() => _CancelAppointmentReasonSheetState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _CancelAppointmentReasonSheetState
|
|
|
|
|
extends State<CancelAppointmentReasonSheet> {
|
|
|
|
|
class _CancelAppointmentReasonSheetState extends State<CancelAppointmentReasonSheet> {
|
|
|
|
|
String reason = "";
|
|
|
|
|
List<Reason> reasonList = [
|
|
|
|
|
Reason("Operational Issue", true),
|
|
|
|
|
Reason("Material Issue", false),
|
|
|
|
|
Reason("The customer no longer responding", false),
|
|
|
|
|
Reason("Other", false),
|
|
|
|
|
List<OfferRequestCommentModel> reasonList = [
|
|
|
|
|
OfferRequestCommentModel(title: LocaleKeys.operationalIssue.tr(), isSelected: true, index: 0),
|
|
|
|
|
OfferRequestCommentModel(title: LocaleKeys.materialIssue.tr(), isSelected: false, index: 1),
|
|
|
|
|
OfferRequestCommentModel(title: LocaleKeys.customerNotResponding.tr(), isSelected: false, index: 2),
|
|
|
|
|
OfferRequestCommentModel(title: LocaleKeys.otherVar.tr(), isSelected: false, index: 3),
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Container(
|
|
|
|
|
padding: const EdgeInsets.only(left: 21, right: 21, top: 12, bottom: 21),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.reason.tr().toText(fontSize: 24, isBold: true),
|
|
|
|
|
ListView.separated(
|
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
|
return Padding(
|
|
|
|
|
padding: const EdgeInsets.only(top: 12, bottom: 12),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: 14,
|
|
|
|
|
height: 14,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: reasonList[index].isSelected
|
|
|
|
|
? MyColors.darkPrimaryColor
|
|
|
|
|
: Colors.transparent,
|
|
|
|
|
borderRadius: BorderRadius.circular(122),
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: reasonList[index].isSelected
|
|
|
|
|
? MyColors.darkPrimaryColor
|
|
|
|
|
: borderColor,
|
|
|
|
|
width: 1),
|
|
|
|
|
),
|
|
|
|
|
child: const Icon(
|
|
|
|
|
Icons.done,
|
|
|
|
|
size: 12,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
return InfoBottomSheet(
|
|
|
|
|
title: LocaleKeys.pleaseSpecify.tr().toText(fontSize: 28, isBold: true, letterSpacing: -1.44, height: 1),
|
|
|
|
|
description: Padding(
|
|
|
|
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.selectReasonBeforeCancel.tr().toText(fontSize: 13, color: MyColors.lightTextColor, fontWeight: MyFonts.Medium),
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
12.height,
|
|
|
|
|
ListView.separated(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: reasonList.length,
|
|
|
|
|
separatorBuilder: (BuildContext context, int index) {
|
|
|
|
|
return const Divider(thickness: 0.5);
|
|
|
|
|
},
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
OfferRequestCommentModel offerRequestCommentModel = reasonList[index];
|
|
|
|
|
return CircleCheckBoxWithTitle(
|
|
|
|
|
isChecked: offerRequestCommentModel.isSelected ?? false,
|
|
|
|
|
title: '${offerRequestCommentModel.title}',
|
|
|
|
|
onSelected: () {
|
|
|
|
|
for (var element in reasonList) {
|
|
|
|
|
element.isSelected = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
reason = reasonList[index].title ?? "";
|
|
|
|
|
reasonList[index].isSelected = true;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
selectedColor: MyColors.darkPrimaryColor,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
if (reason == LocaleKeys.otherVar.tr()) ...[
|
|
|
|
|
12.height,
|
|
|
|
|
TxtField(
|
|
|
|
|
maxLines: 5,
|
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
|
hint: LocaleKeys.description.tr(),
|
|
|
|
|
onChanged: (v) {
|
|
|
|
|
reason = v;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
12.width,
|
|
|
|
|
reasonList[index].title.toText(isBold: true)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
).onPress(() {
|
|
|
|
|
for (var element in reasonList) {
|
|
|
|
|
element.isSelected = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
setState(() {
|
|
|
|
|
reason = reasonList[index].title;
|
|
|
|
|
reasonList[index].isSelected = true;
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
separatorBuilder: (context, index) {
|
|
|
|
|
return Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 1,
|
|
|
|
|
color: MyColors.borderColor,
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: reasonList.length,
|
|
|
|
|
),
|
|
|
|
|
if (reason == "Other")
|
|
|
|
|
TxtField(
|
|
|
|
|
hint: LocaleKeys.typeHere.tr(),
|
|
|
|
|
maxLines: 5,
|
|
|
|
|
onChanged: (v) {
|
|
|
|
|
reason = v;
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
12.height,
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ShowFillButton(
|
|
|
|
|
title: LocaleKeys.no.tr(),
|
|
|
|
|
isFilled: false,
|
|
|
|
|
txtColor: MyColors.darkPrimaryColor,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
12.width,
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ShowFillButton(
|
|
|
|
|
title: LocaleKeys.yes.tr(),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
if (reason.isEmpty || reason == "Other") {
|
|
|
|
|
Utils.showToast(LocaleKeys.pleaseSelectReason.tr());
|
|
|
|
|
} else {
|
|
|
|
|
widget.onCancelClick(reason);
|
|
|
|
|
pop(context);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
25.height,
|
|
|
|
|
ShowFillButton(
|
|
|
|
|
title: LocaleKeys.cancel.tr(),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
if (reason.isEmpty && reason == LocaleKeys.otherVar.tr()) {
|
|
|
|
|
Utils.showToast(LocaleKeys.pleaseSelectReason.tr());
|
|
|
|
|
} else {
|
|
|
|
|
widget.onCancelClick(reason);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
maxWidth: double.infinity,
|
|
|
|
|
),
|
|
|
|
|
19.height,
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|