Cleanup code
This commit is contained in:
parent
3a589d5837
commit
09eabb91eb
4 changed files with 56 additions and 68 deletions
|
@ -5,7 +5,7 @@ import 'package:nekoya_flutter/api/api.dart';
|
|||
import 'package:nekoya_flutter/data/cart.dart';
|
||||
|
||||
class CheckoutForm extends StatefulWidget {
|
||||
CheckoutForm({Key? key}) : super(key: key);
|
||||
const CheckoutForm({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<CheckoutForm> createState() => _CheckoutFormState();
|
||||
|
@ -233,13 +233,8 @@ class _CheckoutFormState extends State<CheckoutForm> {
|
|||
.fields["Shipping Method"]!.value,
|
||||
"data": cartData,
|
||||
};
|
||||
var statusCode = await checkoutPost(data);
|
||||
|
||||
if (statusCode == 201) {
|
||||
print("StatusCode" + statusCode.toString());
|
||||
} else {
|
||||
print("StatusCode" + statusCode.toString());
|
||||
}
|
||||
|
||||
await checkoutPost(data);
|
||||
}
|
||||
},
|
||||
color: const Color(0xff8B0000),
|
||||
|
|
|
@ -4,14 +4,13 @@ import 'package:nekoya_flutter/data/cart.dart';
|
|||
import 'package:nekoya_flutter/components/cart_box.dart';
|
||||
|
||||
class CheckoutItems extends StatefulWidget {
|
||||
CheckoutItems({Key? key}) : super(key: key);
|
||||
const CheckoutItems({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<CheckoutItems> createState() => _CheckoutItemsState();
|
||||
}
|
||||
|
||||
class _CheckoutItemsState extends State<CheckoutItems> {
|
||||
Future<dynamic> _viewCart = viewCart();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
|
@ -36,7 +35,7 @@ class _CheckoutItemsState extends State<CheckoutItems> {
|
|||
),
|
||||
),
|
||||
FutureBuilder<dynamic>(
|
||||
future: _viewCart,
|
||||
future: viewCart(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
var data = snapshot.data;
|
||||
|
|
|
@ -41,29 +41,27 @@ class _PaymentBodyState extends State<PaymentBody> {
|
|||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(bottom: 20),
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
child: Container(
|
||||
child: ExpansionTile(
|
||||
backgroundColor: Colors.blue,
|
||||
collapsedBackgroundColor: Colors.blue.shade800,
|
||||
textColor: Colors.white,
|
||||
collapsedTextColor: Colors.white,
|
||||
title: const Text('BCA'),
|
||||
children: const [
|
||||
ListTile(
|
||||
textColor: Colors.white,
|
||||
title: Text(
|
||||
'1. Login pada alamat Internet Banking BCA (***) \n2. Pilih menu Pembayaran Tagihan > Pembayaran \n3. Pada Ke Rekening masukkan Rekening perusahaan \n4. Masukkan Jumlah Nominal yang akan ditransfer \n5. Kemudian tekan send. Cetak/simpan stuck Transfer sebagai bukti pembayaran'),
|
||||
)
|
||||
],
|
||||
),
|
||||
child: ExpansionTile(
|
||||
backgroundColor: Colors.blue,
|
||||
collapsedBackgroundColor: Colors.blue.shade800,
|
||||
textColor: Colors.white,
|
||||
collapsedTextColor: Colors.white,
|
||||
title: const Text('BCA'),
|
||||
children: const [
|
||||
ListTile(
|
||||
textColor: Colors.white,
|
||||
title: Text(
|
||||
'1. Login pada alamat Internet Banking BCA (***) \n2. Pilih menu Pembayaran Tagihan > Pembayaran \n3. Pada Ke Rekening masukkan Rekening perusahaan \n4. Masukkan Jumlah Nominal yang akan ditransfer \n5. Kemudian tekan send. Cetak/simpan stuck Transfer sebagai bukti pembayaran'),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(bottom: 20),
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
child: ExpansionTile(
|
||||
|
@ -82,31 +80,29 @@ class _PaymentBodyState extends State<PaymentBody> {
|
|||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
child: ExpansionTile(
|
||||
backgroundColor: Colors.blue,
|
||||
collapsedBackgroundColor: Colors.blue.shade800,
|
||||
textColor: Colors.white,
|
||||
collapsedTextColor: Colors.white,
|
||||
title: const Text('BRI'),
|
||||
children: const [
|
||||
ListTile(
|
||||
textColor: Colors.white,
|
||||
title: Text(
|
||||
'1. Login pada alamat Internet Banking BRI (***)\n2. Pilih menu Pembayaran Tagihan > Pembayaran > Antar Rekening\n3. Pada Ke Rekening masukkan Rekening perusahaan\n4. Masukkan Jumlah Nominal yang akan ditransfer\n5. Kemudian tekan send. Cetak/simpan stuck Transfer sebagai bukti pembayaran'),
|
||||
)
|
||||
],
|
||||
),
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
child: ExpansionTile(
|
||||
backgroundColor: Colors.blue,
|
||||
collapsedBackgroundColor: Colors.blue.shade800,
|
||||
textColor: Colors.white,
|
||||
collapsedTextColor: Colors.white,
|
||||
title: const Text('BRI'),
|
||||
children: const [
|
||||
ListTile(
|
||||
textColor: Colors.white,
|
||||
title: Text(
|
||||
'1. Login pada alamat Internet Banking BRI (***)\n2. Pilih menu Pembayaran Tagihan > Pembayaran > Antar Rekening\n3. Pada Ke Rekening masukkan Rekening perusahaan\n4. Masukkan Jumlah Nominal yang akan ditransfer\n5. Kemudian tekan send. Cetak/simpan stuck Transfer sebagai bukti pembayaran'),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 40),
|
||||
padding: const EdgeInsets.only(top: 40),
|
||||
color: Colors.transparent,
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
child: const Text(
|
||||
'13000000',
|
||||
style: TextStyle(
|
||||
fontSize: 30,
|
||||
|
@ -120,28 +116,26 @@ class _PaymentBodyState extends State<PaymentBody> {
|
|||
),
|
||||
),
|
||||
Container(
|
||||
padding: EdgeInsets.only(top: 40),
|
||||
padding: const EdgeInsets.only(top: 40),
|
||||
color: Colors.transparent,
|
||||
),
|
||||
Container(
|
||||
child: ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
foregroundColor:
|
||||
MaterialStateProperty.all(Colors.red.shade800),
|
||||
backgroundColor:
|
||||
MaterialStateProperty.all(Colors.red.shade800),
|
||||
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(18.0),
|
||||
side: BorderSide(color: Colors.red)))),
|
||||
onPressed: () {
|
||||
Navigator.push(context,
|
||||
MaterialPageRoute(builder: (context) => Transactions()));
|
||||
},
|
||||
child: Text(
|
||||
'Transaction',
|
||||
style: TextStyle(color: Colors.white, fontSize: 25),
|
||||
),
|
||||
ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
foregroundColor:
|
||||
MaterialStateProperty.all(Colors.red.shade800),
|
||||
backgroundColor:
|
||||
MaterialStateProperty.all(Colors.red.shade800),
|
||||
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
|
||||
RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(18.0),
|
||||
side: const BorderSide(color: Colors.red)))),
|
||||
onPressed: () {
|
||||
Navigator.push(context,
|
||||
MaterialPageRoute(builder: (context) => const Transactions()));
|
||||
},
|
||||
child: const Text(
|
||||
'Transaction',
|
||||
style: TextStyle(color: Colors.white, fontSize: 25),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
@ -22,7 +22,7 @@ class _CheckoutState extends State<Checkout> {
|
|||
body: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
children: const [
|
||||
CheckoutItems(),
|
||||
CheckoutForm(),
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue