Feat: add argument for page ticket booking step 4
This commit is contained in:
parent
210209b376
commit
491ba3b55f
|
@ -500,7 +500,7 @@
|
||||||
"languageVersion": "3.4"
|
"languageVersion": "3.4"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"generated": "2025-03-21T19:39:10.352546Z",
|
"generated": "2025-03-26T12:09:54.704663Z",
|
||||||
"generator": "pub",
|
"generator": "pub",
|
||||||
"generatorVersion": "3.5.0",
|
"generatorVersion": "3.5.0",
|
||||||
"flutterRoot": "file:///D:/Flutter/flutter_sdk/flutter_3.24.0",
|
"flutterRoot": "file:///D:/Flutter/flutter_sdk/flutter_3.24.0",
|
||||||
|
|
|
@ -150,7 +150,6 @@ class _TicketBookingStep3ScreenState extends State<TicketBookingStep3Screen> {
|
||||||
selectedDepartureService = null;
|
selectedDepartureService = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (serviceType == 'arrival') {
|
} else if (serviceType == 'arrival') {
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
if (selectedArrivalService != null) {
|
if (selectedArrivalService != null) {
|
||||||
|
@ -164,7 +163,6 @@ class _TicketBookingStep3ScreenState extends State<TicketBookingStep3Screen> {
|
||||||
selectedArrivalService = null;
|
selectedArrivalService = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (serviceType == 'transit') {
|
} else if (serviceType == 'transit') {
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
if (selectedTransitService != null) {
|
if (selectedTransitService != null) {
|
||||||
|
@ -196,92 +194,121 @@ class _TicketBookingStep3ScreenState extends State<TicketBookingStep3Screen> {
|
||||||
double grandTotal = totalPrice + totalPriceService;
|
double grandTotal = totalPrice + totalPriceService;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: GrayColors.gray50,
|
backgroundColor: GrayColors.gray50,
|
||||||
appBar: ProgressAppbarComponent(
|
appBar: ProgressAppbarComponent(
|
||||||
title: 'Pesan Tiket',
|
title: 'Pesan Tiket',
|
||||||
subTitle: 'Langkah 3 dari 4',
|
subTitle: 'Langkah 3 dari 4',
|
||||||
onTab: () {
|
onTab: () {
|
||||||
Get.back();
|
Get.back();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 20.h),
|
padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 20.h),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
CardFlightInformation(
|
CardFlightInformation(
|
||||||
date: '$ticketDate',
|
date: '$ticketDate',
|
||||||
time: "${departureTime} - ${arrivalTime}",
|
time: "${departureTime} - ${arrivalTime}",
|
||||||
departureCity: '${flightData?.cityDeparture}',
|
departureCity: '${flightData?.cityDeparture}',
|
||||||
arrivalCity: "${flightData?.cityArrival}",
|
arrivalCity: "${flightData?.cityArrival}",
|
||||||
plane: "${flightData?.airLines} (${flightData?.code})",
|
plane: "${flightData?.airLines} (${flightData?.code})",
|
||||||
seatClass: "${flightData?.flightClass}",
|
seatClass: "${flightData?.flightClass}",
|
||||||
passenger: "$passenger",
|
passenger: "$passenger",
|
||||||
stop: "${flightData?.stop}",
|
stop: "${flightData?.stop}",
|
||||||
transiAirplane: "${flightData?.transitAirplane}",
|
transiAirplane: "${flightData?.transitAirplane}",
|
||||||
),
|
),
|
||||||
SizedBox(height: 32.h),
|
SizedBox(height: 32.h),
|
||||||
TypographyStyles.h6("Layanan Porter", color: GrayColors.gray800),
|
TypographyStyles.h6("Layanan Porter", color: GrayColors.gray800),
|
||||||
SizedBox(height: 10.h),
|
SizedBox(height: 10.h),
|
||||||
TypographyStyles.caption(
|
TypographyStyles.caption(
|
||||||
"Silahkan pilih opsi penerbangan untuk mencari layanan porter yang cocok untuk perjalanan Anda",
|
"Silahkan pilih opsi penerbangan untuk mencari layanan porter yang cocok untuk perjalanan Anda",
|
||||||
color: GrayColors.gray600,
|
color: GrayColors.gray600,
|
||||||
fontWeight: FontWeight.w400,
|
fontWeight: FontWeight.w400,
|
||||||
maxlines: 3,
|
maxlines: 3,
|
||||||
),
|
),
|
||||||
SizedBox(height: 16.h),
|
SizedBox(height: 16.h),
|
||||||
|
_buildCheckBox(
|
||||||
|
context,
|
||||||
|
label: "Keberangkatan",
|
||||||
|
Widget: CustomeIcons.AirplaneTakeOffOutline(color: Colors.white),
|
||||||
|
value: _isChecked1,
|
||||||
|
onTap: (bool? value) {
|
||||||
|
_onCheckboxChanged(1, value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (_isChecked1)
|
||||||
|
_buildPorterServicesList(selectedPorter: selectedPorter1, serviceType: layananTipe[1]!),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
_buildCheckBox(
|
||||||
|
context,
|
||||||
|
label: "Kedatangan",
|
||||||
|
Widget: CustomeIcons.AirplaneLandingOutline(color: Colors.white),
|
||||||
|
value: _isChecked2,
|
||||||
|
onTap: (bool? value) {
|
||||||
|
_onCheckboxChanged(2, value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (_isChecked2)
|
||||||
|
_buildPorterServicesList(selectedPorter: selectedPorter2, serviceType: layananTipe[2]!),
|
||||||
|
SizedBox(height: 10.h),
|
||||||
|
if (flightData?.stop != null && flightData!.stop.isNotEmpty) ...[
|
||||||
_buildCheckBox(
|
_buildCheckBox(
|
||||||
context,
|
context,
|
||||||
label: "Keberangkatan",
|
label: "Transit",
|
||||||
Widget: CustomeIcons.AirplaneTakeOffOutline(color: Colors.white),
|
Widget: CustomeIcons.TransitOutline(color: Colors.white),
|
||||||
value: _isChecked1,
|
value: _isChecked3,
|
||||||
onTap: (bool? value) {
|
onTap: (bool? value) {
|
||||||
_onCheckboxChanged(1, value);
|
_onCheckboxChanged(3, value);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (_isChecked1)
|
if (_isChecked3)
|
||||||
_buildPorterServicesList(selectedPorter: selectedPorter1, serviceType: layananTipe[1]!),
|
_buildPorterServicesList(selectedPorter: selectedPorter3, serviceType: layananTipe[3]!),
|
||||||
SizedBox(height: 10.h),
|
|
||||||
_buildCheckBox(
|
|
||||||
context,
|
|
||||||
label: "Kedatangan",
|
|
||||||
Widget: CustomeIcons.AirplaneLandingOutline(color: Colors.white),
|
|
||||||
value: _isChecked2,
|
|
||||||
onTap: (bool? value) {
|
|
||||||
_onCheckboxChanged(2, value);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (_isChecked2)
|
|
||||||
_buildPorterServicesList(selectedPorter: selectedPorter2, serviceType: layananTipe[2]!),
|
|
||||||
SizedBox(height: 10.h),
|
|
||||||
if (flightData?.stop != null && flightData!.stop.isNotEmpty) ...[
|
|
||||||
_buildCheckBox(
|
|
||||||
context,
|
|
||||||
label: "Transit",
|
|
||||||
Widget: CustomeIcons.TransitOutline(color: Colors.white),
|
|
||||||
value: _isChecked3,
|
|
||||||
onTap: (bool? value) {
|
|
||||||
_onCheckboxChanged(3, value);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (_isChecked3)
|
|
||||||
_buildPorterServicesList(selectedPorter: selectedPorter3, serviceType: layananTipe[3]!),
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
bottomNavigationBar: FooterPrice(
|
),
|
||||||
price: "Rp ${NumberFormat.decimalPattern('id_ID').format(grandTotal)}",
|
bottomNavigationBar: FooterPrice(
|
||||||
labelText: "Pesanan",
|
price: "Rp ${NumberFormat.decimalPattern('id_ID').format(grandTotal)}",
|
||||||
labelButton: "Lanjut",
|
labelText: "Pesanan",
|
||||||
onTap: () {
|
labelButton: "Lanjut",
|
||||||
Get.toNamed(Routes.TICKETBOOKINGSTEP4);
|
onTap: () {
|
||||||
},
|
List<String> selectedServiceLabels = [];
|
||||||
));
|
Map<String, PorterServiceModel?> selectedPorterServices = {};
|
||||||
|
|
||||||
|
if (_isChecked1) {
|
||||||
|
selectedServiceLabels.add("Keberangkatan");
|
||||||
|
selectedPorterServices['departure'] = selectedDepartureService;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_isChecked2) {
|
||||||
|
selectedServiceLabels.add("Kedatangan");
|
||||||
|
selectedPorterServices['arrival'] = selectedArrivalService;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_isChecked3) {
|
||||||
|
selectedServiceLabels.add("Transit");
|
||||||
|
selectedPorterServices['transit'] = selectedTransitService;
|
||||||
|
}
|
||||||
|
final argument = {
|
||||||
|
'tickedId': ticketId,
|
||||||
|
'flightId': flightId,
|
||||||
|
'ticketDate': ticketDate,
|
||||||
|
'passenger': passenger,
|
||||||
|
'selectedPassenger': selectedPassengers,
|
||||||
|
'numberSeat': numberSeat,
|
||||||
|
'grandTotal': grandTotal,
|
||||||
|
'selectedServiceLabels': selectedServiceLabels,
|
||||||
|
'selectedPorter': selectedPorterServices,
|
||||||
|
};
|
||||||
|
Get.toNamed(Routes.TICKETBOOKINGSTEP4, arguments: argument);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCheckBox(
|
Widget _buildCheckBox(
|
||||||
|
|
|
@ -7,8 +7,11 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
import '../../../../_core/component/appbar/appbar_component.dart';
|
import '../../../../_core/component/appbar/appbar_component.dart';
|
||||||
import '../../../../_core/component/icons/icons_library.dart';
|
import '../../../../_core/component/icons/icons_library.dart';
|
||||||
|
import '../../../../domain/models/porter_service_model.dart';
|
||||||
|
import '../../../../domain/models/user_entity.dart';
|
||||||
import '../component/card_flight_information.dart';
|
import '../component/card_flight_information.dart';
|
||||||
|
|
||||||
class TicketBookingStep4Screen extends StatefulWidget {
|
class TicketBookingStep4Screen extends StatefulWidget {
|
||||||
|
@ -19,6 +22,31 @@ class TicketBookingStep4Screen extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _TicketBookingStep4ScreenState extends State<TicketBookingStep4Screen> {
|
class _TicketBookingStep4ScreenState extends State<TicketBookingStep4Screen> {
|
||||||
|
late final String ticketId;
|
||||||
|
late final String flightId;
|
||||||
|
late String? ticketDate;
|
||||||
|
late final int passenger;
|
||||||
|
late final List<PassengerModel?> selectedPassengers;
|
||||||
|
late List<String> numberSeat;
|
||||||
|
late double? grandTotal;
|
||||||
|
late List<String> selectedServiceLabels;
|
||||||
|
late Map<String, PorterServiceModel?> selectedPorterServices;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
final args = Get.arguments as Map<String, dynamic>;
|
||||||
|
ticketId = args['ticketId'] ?? '';
|
||||||
|
flightId = args['flightId'] ?? '';
|
||||||
|
ticketDate = args['date'] ?? '';
|
||||||
|
passenger = args['passenger'] ?? 0;
|
||||||
|
selectedPassengers = args['selectedPassenger'] ?? [];
|
||||||
|
numberSeat = args['numberSeat'] ?? '';
|
||||||
|
grandTotal = args['grandTotal'] ?? 0;
|
||||||
|
selectedServiceLabels = args['selectedServiceLabels'] ?? [];
|
||||||
|
selectedPorterServices = args['selectedPorterServices'] ?? {};
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
@ -130,7 +158,7 @@ class _TicketBookingStep4ScreenState extends State<TicketBookingStep4Screen> {
|
||||||
)),
|
)),
|
||||||
bottomNavigationBar: FooterPrice(
|
bottomNavigationBar: FooterPrice(
|
||||||
labelText: "Pembayaran",
|
labelText: "Pembayaran",
|
||||||
price: "1.450.000",
|
price: "Rp ${NumberFormat.decimalPattern('id_ID').format(grandTotal)}",
|
||||||
labelButton: "Buat Pesanan",
|
labelButton: "Buat Pesanan",
|
||||||
iconButton: CustomeIcons.ProtectOutline(color: Colors.white),
|
iconButton: CustomeIcons.ProtectOutline(color: Colors.white),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
|
|
Loading…
Reference in New Issue