Feat: adding id field to airport collection
This commit is contained in:
parent
71a5762fa9
commit
1f83b5f2fd
|
@ -1,6 +1,7 @@
|
||||||
import 'package:e_porter/_core/constants/colors.dart';
|
import 'package:e_porter/_core/constants/colors.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:zoom_tap_animation/zoom_tap_animation.dart';
|
||||||
|
|
||||||
import '../../constants/typography.dart';
|
import '../../constants/typography.dart';
|
||||||
|
|
||||||
|
@ -26,7 +27,8 @@ class ButtonOutline extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox(
|
return ZoomTapAnimation(
|
||||||
|
child: SizedBox(
|
||||||
width: buttonWidth ?? double.infinity,
|
width: buttonWidth ?? double.infinity,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: onTap,
|
onPressed: onTap,
|
||||||
|
@ -45,6 +47,7 @@ class ButtonOutline extends StatelessWidget {
|
||||||
child: isLoading ? _rowLoading() : _buildText(),
|
child: isLoading ? _rowLoading() : _buildText(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
class Airport {
|
class Airport {
|
||||||
|
final String? id;
|
||||||
final String? city;
|
final String? city;
|
||||||
final String? code;
|
final String? code;
|
||||||
final String? name;
|
final String? name;
|
||||||
|
|
||||||
Airport({required this.city, required this.code, required this.name});
|
Airport({this.id, required this.city, required this.code, required this.name});
|
||||||
|
|
||||||
factory Airport.fromMap(Map<String, dynamic> map) {
|
factory Airport.fromMap(Map<String, dynamic> map, String documentId) {
|
||||||
return Airport(
|
return Airport(
|
||||||
|
id: documentId,
|
||||||
city: map['city'] as String?,
|
city: map['city'] as String?,
|
||||||
code: map['kode'] as String?,
|
code: map['kode'] as String?,
|
||||||
name: map['name'] as String?,
|
name: map['name'] as String?,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
import 'package:e_porter/_core/component/appbar/appbar_component.dart';
|
import 'package:e_porter/_core/component/appbar/appbar_component.dart';
|
||||||
import 'package:e_porter/_core/component/button/button_fill.dart';
|
import 'package:e_porter/_core/component/button/button_fill.dart';
|
||||||
import 'package:e_porter/_core/component/card/custome_shadow_cotainner.dart';
|
import 'package:e_porter/_core/component/card/custome_shadow_cotainner.dart';
|
||||||
|
@ -210,12 +212,16 @@ class _BookingTicketsState extends State<BookingTickets> {
|
||||||
onTap: () {
|
onTap: () {
|
||||||
if (selectedAirportFrom != null && selectedAirportTo != null) {
|
if (selectedAirportFrom != null && selectedAirportTo != null) {
|
||||||
final searchParams = {
|
final searchParams = {
|
||||||
|
"toId": selectedAirportTo!.id,
|
||||||
|
"fromId": selectedAirportFrom!.id,
|
||||||
"from": '${selectedAirportFrom!.city}',
|
"from": '${selectedAirportFrom!.city}',
|
||||||
"to": '${selectedAirportTo!.city}',
|
"to": '${selectedAirportTo!.city}',
|
||||||
"leavingDate": selectedDate,
|
"leavingDate": selectedDate,
|
||||||
"flightClass": selectedClass.value,
|
"flightClass": selectedClass.value,
|
||||||
"passengerCount": selectedPassengerCount,
|
"passengerCount": selectedPassengerCount,
|
||||||
};
|
};
|
||||||
|
log('[To ID] : ${selectedAirportTo!.id}');
|
||||||
|
log('[From ID] : ${selectedAirportFrom!.id}');
|
||||||
Get.toNamed(Routes.SEARCHTICKETS, arguments: searchParams);
|
Get.toNamed(Routes.SEARCHTICKETS, arguments: searchParams);
|
||||||
} else {
|
} else {
|
||||||
Get.snackbar("Error", "Silakan pilih bandara keberangkatan dan tujuan");
|
Get.snackbar("Error", "Silakan pilih bandara keberangkatan dan tujuan");
|
||||||
|
|
Loading…
Reference in New Issue