Feat: add slicing page Print Boarding Pass

This commit is contained in:
orangdeso 2025-03-19 00:54:04 +07:00
parent 23afed1788
commit 59a0193af1
7 changed files with 142 additions and 35 deletions

View File

@ -19,6 +19,18 @@
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "barcode",
"rootUri": "file:///C:/Users/ASUS/AppData/Local/Pub/Cache/hosted/pub.dev/barcode-2.2.9",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "barcode_widget",
"rootUri": "file:///C:/Users/ASUS/AppData/Local/Pub/Cache/hosted/pub.dev/barcode_widget-2.0.4",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "boolean_selector",
"rootUri": "file:///C:/Users/ASUS/AppData/Local/Pub/Cache/hosted/pub.dev/boolean_selector-2.1.1",
@ -325,6 +337,12 @@
"packageUri": "lib/",
"languageVersion": "3.0"
},
{
"name": "qr",
"rootUri": "file:///C:/Users/ASUS/AppData/Local/Pub/Cache/hosted/pub.dev/qr-3.0.2",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "shared_preferences",
"rootUri": "file:///C:/Users/ASUS/AppData/Local/Pub/Cache/hosted/pub.dev/shared_preferences-2.5.2",
@ -482,7 +500,7 @@
"languageVersion": "3.4"
}
],
"generated": "2025-03-18T16:43:58.907612Z",
"generated": "2025-03-18T17:25:46.276961Z",
"generator": "pub",
"generatorVersion": "3.5.0",
"flutterRoot": "file:///D:/Flutter/flutter_sdk/flutter_3.24.0",

View File

@ -10,6 +10,14 @@ async
2.18
file:///C:/Users/ASUS/AppData/Local/Pub/Cache/hosted/pub.dev/async-2.11.0/
file:///C:/Users/ASUS/AppData/Local/Pub/Cache/hosted/pub.dev/async-2.11.0/lib/
barcode
2.12
file:///C:/Users/ASUS/AppData/Local/Pub/Cache/hosted/pub.dev/barcode-2.2.9/
file:///C:/Users/ASUS/AppData/Local/Pub/Cache/hosted/pub.dev/barcode-2.2.9/lib/
barcode_widget
2.12
file:///C:/Users/ASUS/AppData/Local/Pub/Cache/hosted/pub.dev/barcode_widget-2.0.4/
file:///C:/Users/ASUS/AppData/Local/Pub/Cache/hosted/pub.dev/barcode_widget-2.0.4/lib/
boolean_selector
2.17
file:///C:/Users/ASUS/AppData/Local/Pub/Cache/hosted/pub.dev/boolean_selector-2.1.1/
@ -202,6 +210,10 @@ plugin_platform_interface
3.0
file:///C:/Users/ASUS/AppData/Local/Pub/Cache/hosted/pub.dev/plugin_platform_interface-2.1.8/
file:///C:/Users/ASUS/AppData/Local/Pub/Cache/hosted/pub.dev/plugin_platform_interface-2.1.8/lib/
qr
3.4
file:///C:/Users/ASUS/AppData/Local/Pub/Cache/hosted/pub.dev/qr-3.0.2/
file:///C:/Users/ASUS/AppData/Local/Pub/Cache/hosted/pub.dev/qr-3.0.2/lib/
shared_preferences
3.5
file:///C:/Users/ASUS/AppData/Local/Pub/Cache/hosted/pub.dev/shared_preferences-2.5.2/

View File

@ -1,4 +1,6 @@
import 'package:barcode_widget/barcode_widget.dart';
import 'package:e_porter/_core/component/card/custome_shadow_cotainner.dart';
import 'package:e_porter/_core/component/dotted/dashed_line_component.dart';
import 'package:e_porter/_core/constants/colors.dart';
import 'package:e_porter/_core/constants/typography.dart';
import 'package:e_porter/presentation/screens/home/component/card_tickets.dart';
@ -16,7 +18,7 @@ class PrintBoardingPassScreen extends StatelessWidget {
return Scaffold(
backgroundColor: GrayColors.gray50,
appBar: DefaultAppbarComponent(
title: 'Detail Tiket',
title: 'Cetak Boarding Pass',
textColor: Colors.white,
backgroundColors: PrimaryColors.primary800,
onTab: () {
@ -49,6 +51,7 @@ class PrintBoardingPassScreen extends StatelessWidget {
),
CardTickets(
withContainer: false,
showFooter: false,
departureCity: 'departureCity',
date: 'date',
arrivalCity: 'arrivalCity',
@ -59,8 +62,25 @@ class PrintBoardingPassScreen extends StatelessWidget {
duration: 'duration',
seatClass: 'seatClass',
price: 'price',
onTap: () {},
)
),
Padding(
padding: EdgeInsets.symmetric(vertical: 10),
child: Divider(thickness: 1, color: GrayColors.gray200),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_buildColumnText(context, label: 'Layanan', value: 'value'),
_buildColumnText(context, label: 'Class', value: 'value'),
_buildColumnText(context, label: 'Gate', value: 'value'),
_buildColumnText(context, label: 'Seat', value: 'value'),
],
),
Padding(
padding: EdgeInsets.symmetric(vertical: 20.h),
child: CustomDashedLine(),
),
_buildBarcode(context, barcodeData: 'PK230222BE143')
],
),
)
@ -71,4 +91,37 @@ class PrintBoardingPassScreen extends StatelessWidget {
),
);
}
Widget _buildColumnText(
BuildContext context, {
required String label,
required String value,
}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TypographyStyles.small(label, color: GrayColors.gray500, fontWeight: FontWeight.w400),
TypographyStyles.caption(
value,
color: GrayColors.gray800,
maxlines: 1,
)
],
);
}
Widget _buildBarcode(BuildContext context, {required String barcodeData}) {
return Column(
children: [
BarcodeWidget(
barcode: Barcode.code128(),
data: barcodeData,
height: 80.h,
drawText: false,
),
SizedBox(height: 10.h),
TypographyStyles.small(barcodeData, color: GrayColors.gray800, fontWeight: FontWeight.w400)
],
);
}
}

View File

@ -18,8 +18,9 @@ class CardTickets extends StatelessWidget {
final String duration;
final String seatClass;
final String price;
final VoidCallback onTap;
final VoidCallback? onTap;
final bool withContainer;
final bool showFooter;
const CardTickets({
Key? key,
@ -33,13 +34,13 @@ class CardTickets extends StatelessWidget {
required this.duration,
required this.seatClass,
required this.price,
required this.onTap,
required this.withContainer,
this.onTap,
this.withContainer = true,
this.showFooter = true,
});
@override
Widget build(BuildContext context) {
// Konten utama card
Widget content = Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -77,6 +78,7 @@ class CardTickets extends StatelessWidget {
TypographyStyles.small(arrivalTime, color: GrayColors.gray600, fontWeight: FontWeight.w400),
],
),
if (showFooter) ...[
SizedBox(height: 16.h),
SvgPicture.asset('assets/images/divider_custome.svg', width: 348.w),
SizedBox(height: 6.h),
@ -99,13 +101,11 @@ class CardTickets extends StatelessWidget {
),
],
)
]
],
);
// Jika withShadow = true, bungkus konten dengan CustomeShadowCotainner
Widget finalWidget = withContainer
? CustomeShadowCotainner(child: content)
: content;
Widget finalWidget = withContainer ? CustomeShadowCotainner(child: content) : content;
return ZoomTapAnimation(
child: GestureDetector(

View File

@ -124,7 +124,6 @@ class _SearchTicketsScreenState extends State<SearchTicketsScreen> {
return Padding(
padding: EdgeInsets.only(bottom: 16.h),
child: CardTickets(
withContainer: true,
departureCity: '${flight.cityDeparture} (${flight.codeDeparture})',
date: ticketDate,
arrivalCity: '${flight.cityArrival} (${flight.codeArrival})',

View File

@ -25,6 +25,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.11.0"
barcode:
dependency: transitive
description:
name: barcode
sha256: "7b6729c37e3b7f34233e2318d866e8c48ddb46c1f7ad01ff7bb2a8de1da2b9f4"
url: "https://pub.dev"
source: hosted
version: "2.2.9"
barcode_widget:
dependency: "direct main"
description:
name: barcode_widget
sha256: "6f2c5b08659b1a5f4d88d183e6007133ea2f96e50e7b8bb628f03266c3931427"
url: "https://pub.dev"
source: hosted
version: "2.0.4"
boolean_selector:
dependency: transitive
description:
@ -424,6 +440,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.8"
qr:
dependency: transitive
description:
name: qr
sha256: "5a1d2586170e172b8a8c8470bbbffd5eb0cd38a66c0d77155ea138d3af3a4445"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
shared_preferences:
dependency: "direct main"
description:

View File

@ -52,6 +52,7 @@ dependencies:
dropdown_button2: ^2.3.9
google_fonts: ^6.2.1
dotted_dashed_line: ^0.0.3
barcode_widget: ^2.0.4
# pin_code_fields: ^8.0.1
# dio: ^5.8.0+1