315 lines
11 KiB
Dart
315 lines
11 KiB
Dart
import 'package:cathaypay_mobile/Home/HomePage.dart';
|
|
import 'package:cathaypay_mobile/utils/utils.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
import '../api/api.dart';
|
|
import '../model/profile_model.dart';
|
|
|
|
class PayQrDialog extends StatefulWidget {
|
|
const PayQrDialog({Key? key, required this.name, required this.phone, required this.transactionId, required this.price}) : super(key: key);
|
|
|
|
final String name;
|
|
final String phone;
|
|
final String transactionId;
|
|
final String price;
|
|
|
|
@override
|
|
State<PayQrDialog> createState() => _PayQrDialogState();
|
|
}
|
|
|
|
class _PayQrDialogState extends State<PayQrDialog> {
|
|
@override
|
|
void initState() {
|
|
getProfile(context);
|
|
super.initState();
|
|
}
|
|
|
|
getProfile(BuildContext context) {
|
|
Api.get(context, Api.profile).then((value) => {
|
|
if (value != null) {profile = Profile.fromJson(value["profile"])} else {}
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsets.only(left: 20, right: 20),
|
|
child: Column(mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [
|
|
// Container(
|
|
// margin: EdgeInsets.only(bottom: 10),
|
|
// height: 80,
|
|
// width: 80,
|
|
// child: Image.asset(
|
|
// 'assets/images/LOGO.gif',
|
|
// height: 120,
|
|
// width: 120,
|
|
// )),
|
|
Card(
|
|
color: Color(0xfffbfbfb),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(10.0),
|
|
child: Column(
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Text(
|
|
"โอน / จ่ายเงินสำเร็จ",
|
|
style: TextStyle(
|
|
color: Colors.black,
|
|
fontSize: 20,
|
|
),
|
|
),
|
|
Spacer(),
|
|
IconButton(
|
|
onPressed: () {
|
|
Navigator.popUntil(context, ModalRoute.withName('/HomePage'));
|
|
},
|
|
icon: const Icon(
|
|
Icons.clear,
|
|
color: Colors.grey,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
Text(
|
|
"เลขที่บิล",
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Text(
|
|
widget.transactionId,
|
|
textAlign: TextAlign.right,
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
))
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 15,
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
"เวลา",
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
Text(
|
|
Utils.getDateTimeCreate(),
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 30,
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
"จาก",
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
Text(
|
|
profile?.fullName ?? "",
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 15,
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
"",
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
Text(
|
|
profile?.phoneNumber ?? "",
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 35,
|
|
),
|
|
Row(
|
|
children: [
|
|
Text(
|
|
"ถึง",
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
Spacer(),
|
|
Text(
|
|
widget.name,
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 15,
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
"",
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
Text(
|
|
widget.phone,
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 20),
|
|
child: Divider(color: Color.fromRGBO(101, 103, 107, 1), thickness: 0.4000000059604645),
|
|
),
|
|
/* Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
"ใช้แต้ม CATHAY PAY แทนเงินสด",
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
Text(
|
|
"฿ 10.00",
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.w800,
|
|
),
|
|
)
|
|
],
|
|
),*/
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
"ยอดเงินทั้งหมด",
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
Text(
|
|
"฿ ${Utils.moneyFormat(widget.price)}",
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.w800,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
InkWell(
|
|
onTap: () async {
|
|
Navigator.popUntil(context, ModalRoute.withName('/HomePage'));
|
|
Navigator.pushReplacementNamed(context, "/HomePage");
|
|
},
|
|
child: Container(
|
|
margin: EdgeInsets.only(top: 20, bottom: 20),
|
|
width: MediaQuery.of(context).size.width,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(40),
|
|
color: Color(0xff9d001b),
|
|
),
|
|
padding: const EdgeInsets.symmetric(
|
|
horizontal: 10,
|
|
vertical: 12,
|
|
),
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
SizedBox(
|
|
width: 106,
|
|
height: 32,
|
|
child: Text(
|
|
"ปิด",
|
|
textAlign: TextAlign.center,
|
|
style: GoogleFonts.kanit(
|
|
color: Colors.white,
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
]),
|
|
);
|
|
}
|
|
}
|