264 lines
10 KiB
Dart
264 lines
10 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:initial_folder/providers/order_provider.dart' as orderProvider;
|
|
import 'package:initial_folder/providers/payments_provider.dart';
|
|
import 'package:initial_folder/providers/user_info_provider.dart'
|
|
as userInfoProvider;
|
|
import 'package:initial_folder/size_config.dart';
|
|
import 'package:initial_folder/theme.dart';
|
|
import 'package:intl/intl.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class BottomSheetDetail extends StatelessWidget {
|
|
Map<String, String> paymentMethod = {
|
|
'echannel': 'Bank Transfer',
|
|
'bank_transfer': 'Bank Transfer',
|
|
'credit_card': 'Kartu Kredit',
|
|
'gopay': 'GoPay',
|
|
'cstore': 'Gerai'
|
|
};
|
|
|
|
Widget listCourse({String? title, String? instructor, String? price}) {
|
|
return Container(
|
|
padding: EdgeInsets.symmetric(vertical: 8),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Flexible(
|
|
flex: 7,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
title!,
|
|
// "428 Menit Menjadi Pengusaha Sukses",
|
|
maxLines: 2,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: primaryTextStyle.copyWith(
|
|
letterSpacing: 0.5,
|
|
fontWeight: reguler,
|
|
fontSize: getProportionateScreenWidth(11),
|
|
color: tenthColor,
|
|
),
|
|
),
|
|
SizedBox(height: 4),
|
|
Text(
|
|
'Oleh $instructor',
|
|
// 'Oleh Farid Subkhan',
|
|
|
|
style: primaryTextStyle.copyWith(
|
|
letterSpacing: 0.5,
|
|
fontWeight: reguler,
|
|
fontSize: getProportionateScreenWidth(9.5),
|
|
color: secondaryColor,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Flexible(
|
|
flex: 3,
|
|
child: Text(
|
|
'Rp. ${NumberFormat.currency(locale: 'id', symbol: '', decimalDigits: 0).format(double.parse(price!))}',
|
|
// 'Rp. ${NumberFormat.currency(locale: 'id', symbol: '', decimalDigits: 0).format(50000.0)}',
|
|
|
|
style: primaryTextStyle.copyWith(
|
|
letterSpacing: 0.5,
|
|
fontWeight: reguler,
|
|
fontSize: getProportionateScreenWidth(12),
|
|
color: tenthColor,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var dataOrder =
|
|
Provider.of<PaymentsProvider>(context, listen: false).detailOrder;
|
|
var dataCourse =
|
|
Provider.of<orderProvider.OrderProvider>(context, listen: false).orders;
|
|
var dataUser =
|
|
Provider.of<userInfoProvider.UserInfoProvider>(context, listen: false)
|
|
.result;
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
// color: Colors.red,
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(20))),
|
|
foregroundDecoration: BoxDecoration(
|
|
// color: Colors.red,
|
|
borderRadius: BorderRadius.all(Radius.circular(20))),
|
|
child: ListView(
|
|
shrinkWrap: true,
|
|
physics: NeverScrollableScrollPhysics(),
|
|
children: [
|
|
Row(
|
|
children: [
|
|
IconButton(
|
|
onPressed: () {
|
|
Navigator.pop(context);
|
|
},
|
|
icon: Icon(Icons.keyboard_arrow_down)),
|
|
Text('Detail Pembayaran')
|
|
],
|
|
),
|
|
Container(
|
|
height: 6,
|
|
color: Color(0xff181818),
|
|
),
|
|
Container(
|
|
height: MediaQuery.of(context).size.height * 0.4,
|
|
child: ListView(
|
|
shrinkWrap: true,
|
|
children: [
|
|
Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text('Informasi Pembeli'),
|
|
Divider(),
|
|
Text(
|
|
'Order ID',
|
|
style: primaryTextStyle.copyWith(
|
|
fontSize: 10, color: Color(0xffbfbfbf)),
|
|
),
|
|
Text(
|
|
dataOrder[0].idOrder,
|
|
style: primaryTextStyle.copyWith(
|
|
fontSize: 12, color: Color(0xffF4f4f4)),
|
|
),
|
|
SizedBox(
|
|
height: 15,
|
|
),
|
|
Text(
|
|
'Nama Lengkap',
|
|
style: primaryTextStyle.copyWith(
|
|
fontSize: 10, color: Color(0xffbfbfbf)),
|
|
),
|
|
Text(
|
|
dataUser!.data[0].fullname!,
|
|
style: primaryTextStyle.copyWith(
|
|
fontSize: 12, color: Color(0xffF4f4f4)),
|
|
),
|
|
SizedBox(
|
|
height: 15,
|
|
),
|
|
Text(
|
|
'Email',
|
|
style: primaryTextStyle.copyWith(
|
|
fontSize: 10, color: Color(0xffbfbfbf)),
|
|
),
|
|
Text(
|
|
dataUser.data[0].email!,
|
|
style: primaryTextStyle.copyWith(
|
|
fontSize: 12, color: Color(0xffF4f4f4)),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
height: 6,
|
|
color: Color(0xff181818),
|
|
),
|
|
Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text('Informasi Pembayaran'),
|
|
Divider(),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text('Metode Pembayaran',
|
|
style: primaryTextStyle.copyWith(
|
|
fontSize: 12, color: Color(0xffbfbfbf))),
|
|
Text(paymentMethod[dataOrder[0].paymentType]!,
|
|
style: primaryTextStyle.copyWith(
|
|
fontSize: 12, color: Color(0xffF4f4f4))),
|
|
],
|
|
),
|
|
Divider(),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text('Total Harga',
|
|
style: primaryTextStyle.copyWith(
|
|
fontSize: 10, color: Color(0xffbfbfbf))),
|
|
Text(
|
|
'Rp. ${NumberFormat.currency(locale: 'id', symbol: '', decimalDigits: 0).format(double.parse(dataOrder[0].totalPayment))}',
|
|
style: primaryTextStyle.copyWith(
|
|
fontSize: 12, color: Color(0xffF4f4f4))),
|
|
],
|
|
),
|
|
SizedBox(height: 15),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text('Potongan Kupon',
|
|
style: primaryTextStyle.copyWith(
|
|
fontSize: 10, color: Color(0xffbfbfbf))),
|
|
Text('Rp. 0',
|
|
style: primaryTextStyle.copyWith(
|
|
fontSize: 12, color: Color(0xffF4f4f4))),
|
|
],
|
|
),
|
|
Divider(),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text('Total Bayar',
|
|
style: primaryTextStyle.copyWith(
|
|
fontSize: 12, color: Color(0xffbfbfbf))),
|
|
Text(
|
|
'Rp. ${NumberFormat.currency(locale: 'id', symbol: '', decimalDigits: 0).format(double.parse(dataOrder[0].totalPayment))}',
|
|
style: primaryTextStyle.copyWith(
|
|
fontSize: 12, color: Color(0xffF4f4f4))),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
height: 6,
|
|
color: Color(0xff181818),
|
|
),
|
|
Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 15, vertical: 20),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text('Kursus Yang Dibeli'),
|
|
Divider(),
|
|
Column(
|
|
children: dataCourse.map((course) {
|
|
return listCourse(
|
|
title: course.title,
|
|
instructor: course.instructor,
|
|
price: course.discountPrice == "0"
|
|
? course.price
|
|
: course.discountPrice,
|
|
);
|
|
}).toList()),
|
|
// listCourse(),
|
|
// listCourse(),
|
|
// listCourse(),
|
|
// Text('Halo'),
|
|
// Text('Halo'),
|
|
// Text('Halo'),
|
|
// Text('Halo')
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|