Feat: adding id field to airport collection

This commit is contained in:
orangdeso 2025-04-14 23:17:16 +07:00
parent 71a5762fa9
commit 1f83b5f2fd
3 changed files with 28 additions and 17 deletions

View File

@ -1,6 +1,7 @@
import 'package:e_porter/_core/constants/colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:zoom_tap_animation/zoom_tap_animation.dart';
import '../../constants/typography.dart';
@ -26,7 +27,8 @@ class ButtonOutline extends StatelessWidget {
@override
Widget build(BuildContext context) {
return SizedBox(
return ZoomTapAnimation(
child: SizedBox(
width: buttonWidth ?? double.infinity,
child: ElevatedButton(
onPressed: onTap,
@ -45,6 +47,7 @@ class ButtonOutline extends StatelessWidget {
child: isLoading ? _rowLoading() : _buildText(),
),
),
),
);
}

View File

@ -1,12 +1,14 @@
class Airport {
final String? id;
final String? city;
final String? code;
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(
id: documentId,
city: map['city'] as String?,
code: map['kode'] as String?,
name: map['name'] as String?,

View File

@ -1,3 +1,5 @@
import 'dart:developer';
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/card/custome_shadow_cotainner.dart';
@ -210,12 +212,16 @@ class _BookingTicketsState extends State<BookingTickets> {
onTap: () {
if (selectedAirportFrom != null && selectedAirportTo != null) {
final searchParams = {
"toId": selectedAirportTo!.id,
"fromId": selectedAirportFrom!.id,
"from": '${selectedAirportFrom!.city}',
"to": '${selectedAirportTo!.city}',
"leavingDate": selectedDate,
"flightClass": selectedClass.value,
"passengerCount": selectedPassengerCount,
};
log('[To ID] : ${selectedAirportTo!.id}');
log('[From ID] : ${selectedAirportFrom!.id}');
Get.toNamed(Routes.SEARCHTICKETS, arguments: searchParams);
} else {
Get.snackbar("Error", "Silakan pilih bandara keberangkatan dan tujuan");