341 lines
13 KiB
Dart
341 lines
13 KiB
Dart
import 'package:cathaypay_mobile/Pay/QrScanDialog.dart';
|
|
import 'package:cathaypay_mobile/Pay/ThaiQrDialog.dart';
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
import '../Home/home_bottom_menu_widget.dart';
|
|
import '../TransferMoney/TransferPromptPay.dart';
|
|
import '../TransferMoney/transfer_history.dart';
|
|
import 'PayPromptPay.dart';
|
|
|
|
class PayPage extends StatefulWidget {
|
|
const PayPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<PayPage> createState() => _PayPageState();
|
|
}
|
|
|
|
class _PayPageState extends State<PayPage> {
|
|
bool _is_history = false;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
}
|
|
|
|
// {
|
|
// "MobileDeviceNo": "string", "TransactionID": "string", "Amount": 0,
|
|
// "Note": "string"
|
|
// }
|
|
|
|
var isReturn = false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
backgroundColor: Colors.transparent,
|
|
flexibleSpace: Image(
|
|
image: AssetImage('images/home/Head.png'),
|
|
fit: BoxFit.cover,
|
|
),
|
|
leading: CupertinoButton(
|
|
onPressed: () {
|
|
Navigator.pop(context);
|
|
},
|
|
child: const Icon(
|
|
Icons.chevron_left,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
elevation: 0,
|
|
title: Text(
|
|
"Pay".tr(),
|
|
textAlign: TextAlign.center,
|
|
style: GoogleFonts.kanit(
|
|
color: Colors.white,
|
|
fontSize: 20,
|
|
),
|
|
),
|
|
),
|
|
body: Container(
|
|
width: MediaQuery.of(context).size.width,
|
|
child: Column(
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: 15),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
InkWell(
|
|
onTap: () {
|
|
setState(() {
|
|
_is_history = false;
|
|
});
|
|
},
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
"Create Transaction".tr(),
|
|
style: GoogleFonts.kanit(
|
|
color: Colors.black,
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
Container(
|
|
width: 63,
|
|
height: 2,
|
|
decoration: BoxDecoration(
|
|
border: Border.all(
|
|
color: _is_history ? Colors.transparent : Color(0xffd0315a),
|
|
width: 2,
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
InkWell(
|
|
onTap: () {
|
|
setState(() {
|
|
_is_history = true;
|
|
});
|
|
},
|
|
child: Column(
|
|
children: [
|
|
Text(
|
|
"Transaction History".tr(),
|
|
style: GoogleFonts.kanit(
|
|
color: Color(0xff565656),
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
Container(
|
|
width: 63,
|
|
height: 2,
|
|
decoration: BoxDecoration(
|
|
border: Border.all(
|
|
color: _is_history ? Color(0xffd0315a) : Colors.transparent,
|
|
width: 2,
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Divider(
|
|
color: Color.fromRGBO(196, 196, 196, 1),
|
|
thickness: 1,
|
|
height: 1,
|
|
),
|
|
_is_history
|
|
? TransferHistory()
|
|
: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
child: Column(
|
|
children: [
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
InkWell(
|
|
onTap: () {
|
|
showModalBottomSheet<void>(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.vertical(
|
|
top: Radius.circular(16),
|
|
),
|
|
),
|
|
builder: (BuildContext context) {
|
|
return Padding(
|
|
padding: MediaQuery.of(context).viewInsets,
|
|
child: PayPromptPay(),
|
|
);
|
|
});
|
|
},
|
|
child: Container(
|
|
height: 48,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(100),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Color(0x26000000),
|
|
blurRadius: 2,
|
|
offset: Offset(0.75, 1.50),
|
|
),
|
|
],
|
|
color: Color(0xfffbfbfb),
|
|
),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
SizedBox(
|
|
width: 20,
|
|
),
|
|
Text(
|
|
"PromptPay".tr(),
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
Spacer(),
|
|
Container(
|
|
width: 66,
|
|
height: 39,
|
|
child: Image(
|
|
image: AssetImage('images/prompt.png'),
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 20,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
InkWell(
|
|
onTap: () {
|
|
showModalBottomSheet<void>(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
useSafeArea: true,
|
|
builder: (BuildContext context) {
|
|
return ThaiQrDialog();
|
|
});
|
|
},
|
|
child: Container(
|
|
height: 48,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(100),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Color(0x26000000),
|
|
blurRadius: 2,
|
|
offset: Offset(0.75, 1.50),
|
|
),
|
|
],
|
|
color: Color(0xfffbfbfb),
|
|
),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
SizedBox(
|
|
width: 20,
|
|
),
|
|
Text(
|
|
"สแกน Thai QR Code".tr(),
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
Spacer(),
|
|
Container(
|
|
width: 66,
|
|
height: 39,
|
|
child: Image(
|
|
image: AssetImage('images/ci-qrpayment-img-01.png'),
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 20,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
InkWell(
|
|
onTap: () {
|
|
showModalBottomSheet<void>(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
useSafeArea: true,
|
|
builder: (BuildContext context) {
|
|
return QrScanDialog();
|
|
});
|
|
},
|
|
child: Container(
|
|
height: 48,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(100),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Color(0x26000000),
|
|
blurRadius: 2,
|
|
offset: Offset(0.75, 1.50),
|
|
),
|
|
],
|
|
color: Color(0xfffbfbfb),
|
|
),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
SizedBox(
|
|
width: 20,
|
|
),
|
|
Expanded(
|
|
child: Text(
|
|
"สแกน QR Code NEO PAY".tr(),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
width: 30,
|
|
height: 30,
|
|
child: Image(
|
|
image: AssetImage('images/image qr.png'),
|
|
fit: BoxFit.fill,
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 20,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Expanded(child: Container()),
|
|
HomeBottomMenuWidget()
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|