|
|
|
@ -8,12 +8,12 @@ import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class RRTRequestPage extends StatefulWidget {
|
|
|
|
class RRTRequestPage extends StatefulWidget {
|
|
|
|
|
|
|
|
|
|
|
|
final List<PrescriptionsOrder> pendingOrders;
|
|
|
|
final List<PrescriptionsOrder> pendingOrders;
|
|
|
|
final ServicePrice servicePrice;
|
|
|
|
final ServicePrice servicePrice;
|
|
|
|
|
|
|
|
|
|
|
|
@ -21,8 +21,8 @@ class RRTRequestPage extends StatefulWidget{
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() => RRTRequestPageState();
|
|
|
|
State<StatefulWidget> createState() => RRTRequestPageState();
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class RRTRequestPageState extends State<RRTRequestPage> {
|
|
|
|
class RRTRequestPageState extends State<RRTRequestPage> {
|
|
|
|
bool acceptTerms = false;
|
|
|
|
bool acceptTerms = false;
|
|
|
|
|
|
|
|
|
|
|
|
@ -37,15 +37,12 @@ class RRTRequestPageState extends State<RRTRequestPage>{
|
|
|
|
viewModel = vm;
|
|
|
|
viewModel = vm;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
builder: (ctx, vm, widgetState) {
|
|
|
|
builder: (ctx, vm, widgetState) {
|
|
|
|
|
|
|
|
|
|
|
|
if (widget.pendingOrders.isNotEmpty)
|
|
|
|
if (widget.pendingOrders.isNotEmpty)
|
|
|
|
return currentOrderContent();
|
|
|
|
return currentOrderContent();
|
|
|
|
else
|
|
|
|
else
|
|
|
|
return requestContent();
|
|
|
|
return requestContent();
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Widget requestContent() {
|
|
|
|
Widget requestContent() {
|
|
|
|
@ -66,14 +63,12 @@ class RRTRequestPageState extends State<RRTRequestPage>{
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.only(top: 20, bottom: 5),
|
|
|
|
padding: EdgeInsets.only(top: 20, bottom: 5),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Text(localize.youCanPayByTheFollowingOptions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w500), maxLines: 2)
|
|
|
|
child: Text(localize.youCanPayByTheFollowingOptions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: FontWeight.w500), maxLines: 2)),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
paymentOptions(),
|
|
|
|
paymentOptions(),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
actionButtons()
|
|
|
|
actionButtons()
|
|
|
|
],
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@ -86,12 +81,10 @@ class RRTRequestPageState extends State<RRTRequestPage>{
|
|
|
|
itemBuilder: (ctx, idx) {
|
|
|
|
itemBuilder: (ctx, idx) {
|
|
|
|
var order = orders[idx];
|
|
|
|
var order = orders[idx];
|
|
|
|
return RRTLogListItem(order, onCancel: deleteOrder);
|
|
|
|
return RRTLogListItem(order, onCancel: deleteOrder);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Widget serviceDescription(BuildContext context) =>
|
|
|
|
Widget serviceDescription(BuildContext context) => Padding(
|
|
|
|
Padding(
|
|
|
|
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 10),
|
|
|
|
child: Text(
|
|
|
|
child: Text(
|
|
|
|
localize.rrtDDetails,
|
|
|
|
localize.rrtDDetails,
|
|
|
|
@ -113,13 +106,10 @@ class RRTRequestPageState extends State<RRTRequestPage>{
|
|
|
|
decoration: BoxDecoration(color: Theme.of(context).appBarTheme.color, borderRadius: BorderRadius.only(topLeft: radius, topRight: radius)),
|
|
|
|
decoration: BoxDecoration(color: Theme.of(context).appBarTheme.color, borderRadius: BorderRadius.only(topLeft: radius, topRight: radius)),
|
|
|
|
child: Center(child: Text(localize.approximateServiceFee, style: TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500, letterSpacing: 1))),
|
|
|
|
child: Center(child: Text(localize.approximateServiceFee, style: TextStyle(color: Colors.white, fontSize: 12, fontWeight: FontWeight.w500, letterSpacing: 1))),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
pricingRow(label: localize.amountBeforeTax, value: '$amount ${localize.sar}'),
|
|
|
|
pricingRow(label: localize.amountBeforeTax, value: '$amount ${localize.sar}'),
|
|
|
|
Container(height: 0.5, color: Theme.of(context).appBarTheme.color),
|
|
|
|
Container(height: 0.5, color: Theme.of(context).appBarTheme.color),
|
|
|
|
|
|
|
|
|
|
|
|
pricingRow(label: localize.taxAmount, value: '$vat ${localize.sar}'),
|
|
|
|
pricingRow(label: localize.taxAmount, value: '$vat ${localize.sar}'),
|
|
|
|
Container(height: 0.5, color: Theme.of(context).appBarTheme.color),
|
|
|
|
Container(height: 0.5, color: Theme.of(context).appBarTheme.color),
|
|
|
|
|
|
|
|
|
|
|
|
pricingRow(label: localize.totalAmountPayable, value: '$total ${localize.sar}', labelBold: true),
|
|
|
|
pricingRow(label: localize.totalAmountPayable, value: '$total ${localize.sar}', labelBold: true),
|
|
|
|
Container(height: 0.5, color: Theme.of(context).appBarTheme.color),
|
|
|
|
Container(height: 0.5, color: Theme.of(context).appBarTheme.color),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
@ -127,49 +117,47 @@ class RRTRequestPageState extends State<RRTRequestPage>{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Widget pricingRow({@required String label, @required String value, bool labelBold = false, bool valueBold = false}) {
|
|
|
|
Widget pricingRow({@required String label, @required String value, bool labelBold = false, bool valueBold = false}) {
|
|
|
|
return
|
|
|
|
return Container(
|
|
|
|
Container(
|
|
|
|
height: 40,
|
|
|
|
height: 40, margin: EdgeInsets.symmetric(horizontal: 10),
|
|
|
|
margin: EdgeInsets.symmetric(horizontal: 10),
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Text(label, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: labelBold ? FontWeight.bold : FontWeight.normal)),
|
|
|
|
Text(label, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: labelBold ? FontWeight.bold : FontWeight.normal)),
|
|
|
|
Spacer(),
|
|
|
|
Spacer(),
|
|
|
|
Container(height: 40, color: Theme.of(context).appBarTheme.color, width: 0.5,),
|
|
|
|
Container(
|
|
|
|
|
|
|
|
height: 40,
|
|
|
|
|
|
|
|
color: Theme.of(context).appBarTheme.color,
|
|
|
|
|
|
|
|
width: 0.5,
|
|
|
|
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: MediaQuery.of(context).size.width * 0.25,
|
|
|
|
width: MediaQuery.of(context).size.width * 0.25,
|
|
|
|
child: Text(value, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: valueBold ? FontWeight.bold : FontWeight.normal))
|
|
|
|
child: Text(value, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color, fontWeight: valueBold ? FontWeight.bold : FontWeight.normal))),
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget acceptPolicy() {
|
|
|
|
Widget acceptPolicy() {
|
|
|
|
return Padding(
|
|
|
|
return Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 10),
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 10),
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Checkbox(value: acceptTerms, onChanged: (v){
|
|
|
|
Checkbox(
|
|
|
|
|
|
|
|
value: acceptTerms,
|
|
|
|
|
|
|
|
onChanged: (v) {
|
|
|
|
setState(() => acceptTerms = v);
|
|
|
|
setState(() => acceptTerms = v);
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
SizedBox(width: 10),
|
|
|
|
SizedBox(width: 10),
|
|
|
|
Expanded(
|
|
|
|
Expanded(child: Text(localize.iAcceptTermsConditions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color), maxLines: 2)),
|
|
|
|
child: Text(localize.iAcceptTermsConditions, style: TextStyle(fontSize: 13, color: Theme.of(context).appBarTheme.color), maxLines: 2)
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: MediaQuery.of(context).size.width * 0.25,
|
|
|
|
width: MediaQuery.of(context).size.width * 0.25,
|
|
|
|
child: TextButton(
|
|
|
|
child: TextButton(
|
|
|
|
child: Text(localize.clickHere, style: TextStyle(fontSize: 12, color: Colors.blue, fontWeight: FontWeight.w400)),
|
|
|
|
child: Text(localize.clickHere, style: TextStyle(fontSize: 12, color: Colors.blue, fontWeight: FontWeight.w400)),
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () {
|
|
|
|
Navigator.push(
|
|
|
|
Navigator.push(context, FadePage(page: RRTAgreementPage()));
|
|
|
|
context,
|
|
|
|
}),
|
|
|
|
FadePage(
|
|
|
|
|
|
|
|
page: RRTAgreementPage()));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -179,8 +167,10 @@ class RRTRequestPageState extends State<RRTRequestPage>{
|
|
|
|
Widget paymentOptions() => Container(
|
|
|
|
Widget paymentOptions() => Container(
|
|
|
|
height: 30,
|
|
|
|
height: 30,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Image.asset("assets/payment_options/payment_options.png", fit: BoxFit.fill,)
|
|
|
|
child: Image.asset(
|
|
|
|
);
|
|
|
|
"assets/payment_options/payment_options.png",
|
|
|
|
|
|
|
|
fit: BoxFit.fill,
|
|
|
|
|
|
|
|
));
|
|
|
|
|
|
|
|
|
|
|
|
Widget actionButtons() {
|
|
|
|
Widget actionButtons() {
|
|
|
|
return Container(
|
|
|
|
return Container(
|
|
|
|
@ -188,30 +178,16 @@ class RRTRequestPageState extends State<RRTRequestPage>{
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: MaterialButton(
|
|
|
|
child: DefaultButton(
|
|
|
|
height: 50,
|
|
|
|
TranslationBase.of(context).next,
|
|
|
|
color: Theme.of(context).appBarTheme.color,
|
|
|
|
() {
|
|
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ),
|
|
|
|
|
|
|
|
onPressed: () { },
|
|
|
|
|
|
|
|
child: Text(localize.cancel, style: TextStyle(color: Colors.white, fontSize: 13, letterSpacing: 1),),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
SizedBox(width: 20,),
|
|
|
|
|
|
|
|
Expanded(
|
|
|
|
|
|
|
|
child: MaterialButton(
|
|
|
|
|
|
|
|
height: 50,
|
|
|
|
|
|
|
|
color: Theme.of(context).appBarTheme.color,
|
|
|
|
|
|
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10) ),
|
|
|
|
|
|
|
|
child: Text(localize.ok, style: TextStyle(color: Colors.white, fontSize: 13, letterSpacing: 1),),
|
|
|
|
|
|
|
|
onPressed: () {
|
|
|
|
|
|
|
|
if (acceptTerms)
|
|
|
|
if (acceptTerms)
|
|
|
|
goToPickupAddress();
|
|
|
|
goToPickupAddress();
|
|
|
|
else
|
|
|
|
else
|
|
|
|
AppToast.showErrorToast(message: localize.pleaseAcceptTerms);
|
|
|
|
AppToast.showErrorToast(message: localize.pleaseAcceptTerms);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
@ -220,12 +196,12 @@ class RRTRequestPageState extends State<RRTRequestPage>{
|
|
|
|
goToPickupAddress() async {
|
|
|
|
goToPickupAddress() async {
|
|
|
|
Navigator.push(
|
|
|
|
Navigator.push(
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
FadePage(page: RRTRequestPickupAddressPage(servicePrice: widget.servicePrice,))
|
|
|
|
FadePage(
|
|
|
|
);
|
|
|
|
page: RRTRequestPickupAddressPage(
|
|
|
|
|
|
|
|
servicePrice: widget.servicePrice,
|
|
|
|
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deleteOrder(PrescriptionsOrder order) async {
|
|
|
|
deleteOrder(PrescriptionsOrder order) async {
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
var success = await viewModel.cancelOrder(order);
|
|
|
|
var success = await viewModel.cancelOrder(order);
|
|
|
|
|