2022-05-16 02:51:47 +02:00
import ' package:intl/intl.dart ' ;
2022-04-26 11:15:38 +02:00
import ' package:flutter/material.dart ' ;
2022-05-16 02:51:47 +02:00
2022-05-15 10:14:07 +02:00
import ' package:nekoya_flutter/api/api.dart ' ;
import ' package:nekoya_flutter/data/cart.dart ' ;
2022-04-29 12:50:01 +02:00
import ' package:nekoya_flutter/components/menu.dart ' ;
2022-04-26 11:15:38 +02:00
class PaymentBody extends StatefulWidget {
const PaymentBody ( { Key ? key } ) : super ( key: key ) ;
@ override
State < PaymentBody > createState ( ) = > _PaymentBodyState ( ) ;
}
class _PaymentBodyState extends State < PaymentBody > {
@ override
Widget build ( BuildContext context ) {
2022-05-15 10:14:07 +02:00
Future < dynamic > getTotal ( ) async {
dynamic totalPrice = 0 ;
var orderData = await viewCart ( ) ;
await orderData . forEach ( ( x ) async {
var product = await getProduct ( x [ ' product_id ' ] ) ;
totalPrice + = product [ 0 ] [ ' PRICE ' ] * x [ ' quantity ' ] ;
} ) ;
return Future . delayed ( const Duration ( seconds: 2 ) , ( ) {
return totalPrice ;
} ) ;
}
2022-04-26 11:15:38 +02:00
return Container (
2022-04-28 16:17:54 +02:00
decoration: const BoxDecoration ( color: Colors . transparent ) ,
child: ListView (
scrollDirection: Axis . vertical ,
shrinkWrap: true ,
children: [
Container (
padding: const EdgeInsets . only ( top: 40 , bottom: 30 ) ,
child: Row (
mainAxisAlignment: MainAxisAlignment . spaceEvenly ,
children: [
Image . asset (
2022-05-16 02:58:54 +02:00
' assets/images/bca.webp ' ,
2022-04-28 16:17:54 +02:00
cacheHeight: 40 ,
cacheWidth: 100 ,
) ,
Image . asset (
2022-05-16 02:58:54 +02:00
' assets/images/bni.webp ' ,
2022-04-28 16:17:54 +02:00
cacheHeight: 40 ,
cacheWidth: 100 ,
) ,
Image . asset (
2022-05-16 02:58:54 +02:00
' assets/images/bri.webp ' ,
2022-04-28 16:17:54 +02:00
cacheHeight: 40 ,
cacheWidth: 100 ,
) ,
] ,
) ,
) ,
2022-05-21 10:41:03 +02:00
Padding (
padding: const EdgeInsets . only ( right: 15 , left: 15 ) ,
child: Container (
padding: const EdgeInsets . only ( bottom: 20 ) ,
child: ClipRRect (
borderRadius: BorderRadius . circular ( 18 ) ,
child: const ExpansionTile (
2022-05-21 12:12:03 +02:00
backgroundColor: Color ( 0xff212226 ) ,
collapsedBackgroundColor: Color ( 0xff212226 ) ,
2022-05-21 10:41:03 +02:00
textColor: Colors . white ,
collapsedTextColor: Colors . white ,
title: Text (
' BCA ' ,
style: TextStyle (
color: Colors . white ,
fontWeight: FontWeight . bold ,
fontSize: 20 ) ,
) ,
children: [
ListTile (
textColor: Colors . white ,
title: Text (
' 1. Login pada alamat Internet Banking BCA (***) \n 2. Pilih menu Pembayaran Tagihan > Pembayaran \n 3. Pada Ke Rekening masukkan Rekening perusahaan \n 4. Masukkan Jumlah Nominal yang akan ditransfer \n 5. Kemudian tekan send. Cetak/simpan stuck Transfer sebagai bukti pembayaran ' ) ,
)
] ,
2022-05-21 10:34:55 +02:00
) ,
2022-04-26 11:15:38 +02:00
) ,
2022-04-28 16:17:54 +02:00
) ,
) ,
2022-05-21 10:41:03 +02:00
Padding (
padding: const EdgeInsets . only ( right: 15 , left: 15 ) ,
child: Container (
padding: const EdgeInsets . only ( bottom: 20 ) ,
child: ClipRRect (
borderRadius: BorderRadius . circular ( 18 ) ,
child: const ExpansionTile (
2022-05-21 12:12:03 +02:00
backgroundColor: Color ( 0xff212226 ) ,
collapsedBackgroundColor: Color ( 0xff212226 ) ,
2022-05-21 10:41:03 +02:00
textColor: Colors . white ,
collapsedTextColor: Colors . white ,
title: Text (
' BNI ' ,
style: TextStyle (
color: Colors . white ,
fontWeight: FontWeight . bold ,
fontSize: 20 ) ,
) ,
children: [
ListTile (
textColor: Colors . white ,
title: Text (
' 1. Login pada alamat Internet Banking BNI (***) \n 2. Pilih menu Pembayaran Tagihan > Pembayaran > Antar Rekening \n 3. Pada Ke Rekening masukkan Rekening perusahaan \n 4. Masukkan Jumlah Nominal yang akan ditransfer \n 5. Kemudian tekan send. Cetak/simpan stuck Transfer sebagai bukti pembayaran ' ) ,
)
] ,
) ,
) ,
) ,
) ,
Padding (
padding: const EdgeInsets . only ( right: 15 , left: 15 ) ,
2022-04-28 16:17:54 +02:00
child: ClipRRect (
borderRadius: BorderRadius . circular ( 18 ) ,
2022-04-29 15:32:17 +02:00
child: const ExpansionTile (
2022-05-21 12:12:03 +02:00
backgroundColor: Color ( 0xff212226 ) ,
collapsedBackgroundColor: Color ( 0xff212226 ) ,
2022-04-27 11:01:34 +02:00
textColor: Colors . white ,
collapsedTextColor: Colors . white ,
2022-05-21 10:34:55 +02:00
title: Text (
2022-05-21 10:41:03 +02:00
' BRI ' ,
2022-05-21 10:34:55 +02:00
style: TextStyle (
color: Colors . white ,
fontWeight: FontWeight . bold ,
fontSize: 20 ) ,
) ,
2022-04-29 15:32:17 +02:00
children: [
2022-04-27 11:01:34 +02:00
ListTile (
textColor: Colors . white ,
2022-04-27 12:16:07 +02:00
title: Text (
2022-05-21 10:41:03 +02:00
' 1. Login pada alamat Internet Banking BRI (***) \n 2. Pilih menu Pembayaran Tagihan > Pembayaran > Antar Rekening \n 3. Pada Ke Rekening masukkan Rekening perusahaan \n 4. Masukkan Jumlah Nominal yang akan ditransfer \n 5. Kemudian tekan send. Cetak/simpan stuck Transfer sebagai bukti pembayaran ' ) ,
2022-04-27 11:01:34 +02:00
)
] ,
) ,
2022-04-28 16:17:54 +02:00
) ,
) ,
Container (
2022-04-28 21:20:36 +02:00
padding: const EdgeInsets . only ( top: 40 ) ,
2022-04-28 16:17:54 +02:00
color: Colors . transparent ,
) ,
2022-05-21 10:41:03 +02:00
Padding (
padding: const EdgeInsets . only ( right: 15 , left: 15 ) ,
child: Container (
decoration: BoxDecoration (
border: Border . all ( color: Colors . orange . shade800 ) ,
borderRadius: BorderRadius . circular ( 18 ) ,
//color: const Color.fromARGB(255, 38, 173, 54),
) ,
child: FutureBuilder < dynamic > (
future: getTotal ( ) ,
builder: ( context , snapshot ) {
if ( snapshot . hasData ) {
var price = snapshot . data ;
return Row (
mainAxisAlignment: MainAxisAlignment . center ,
children: [
Text (
" Rp ${ NumberFormat ( ' #,##0.00 ' , ' ID ' ) . format ( price ) } " ,
style: const TextStyle (
color: Colors . white ,
fontSize: 30 ,
fontWeight: FontWeight . w600 ) ,
)
] ,
) ;
}
2022-05-15 10:14:07 +02:00
return Row (
mainAxisAlignment: MainAxisAlignment . center ,
2022-05-21 10:41:03 +02:00
children: const [
2022-05-15 10:14:07 +02:00
Text (
2022-05-21 10:41:03 +02:00
" Count total price on process! " ,
style: TextStyle (
2022-05-15 10:14:07 +02:00
color: Colors . white ,
2022-05-21 10:41:03 +02:00
fontSize: 25 ,
2022-05-15 10:14:07 +02:00
fontWeight: FontWeight . w600 ) ,
)
] ,
) ;
2022-05-21 10:41:03 +02:00
} ,
) ,
2022-04-28 16:17:54 +02:00
) ,
) ,
Container (
2022-04-28 21:20:36 +02:00
padding: const EdgeInsets . only ( top: 40 ) ,
2022-04-28 16:17:54 +02:00
color: Colors . transparent ,
) ,
2022-05-21 10:34:55 +02:00
Padding (
padding: const EdgeInsets . only ( right: 30 , left: 30 ) ,
child: ElevatedButton (
style: ButtonStyle (
foregroundColor:
MaterialStateProperty . all ( const Color ( 0xff8B0000 ) ) ,
backgroundColor:
MaterialStateProperty . all ( const Color ( 0xff8B0000 ) ) ,
shape: MaterialStateProperty . all < RoundedRectangleBorder > (
RoundedRectangleBorder (
borderRadius: BorderRadius . circular ( 18.0 ) ,
side: const BorderSide ( color: Color ( 0xff8B0000 ) ) ) ) ) ,
onPressed: ( ) {
2022-05-21 12:22:27 +02:00
Navigator . pushReplacementNamed ( context , ' ' ) ;
2022-05-21 10:34:55 +02:00
} ,
child: const Text (
' Transaction ' ,
style: TextStyle ( color: Colors . white , fontSize: 30 ) ,
) ,
2022-04-28 16:17:54 +02:00
) ,
) ,
] ,
) ,
) ;
2022-04-26 11:15:38 +02:00
}
}