1106 lines
38 KiB
Dart
1106 lines
38 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'package:cathaypay_mobile/Home/HomePage.dart';
|
|
import 'package:cathaypay_mobile/Numpad.dart';
|
|
import 'package:cathaypay_mobile/PinCodeVadidate.dart';
|
|
import 'package:cathaypay_mobile/utils/utils.dart';
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'package:mask_text_input_formatter/mask_text_input_formatter.dart';
|
|
|
|
import '../api/api.dart';
|
|
import '../utils/color_custom.dart';
|
|
import 'TransferPromtptPayDialog.dart';
|
|
|
|
class TransferPromptPay extends StatefulWidget {
|
|
const TransferPromptPay({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<TransferPromptPay> createState() => _TransferPromptPayState();
|
|
}
|
|
|
|
class _TransferPromptPayState extends State<TransferPromptPay> {
|
|
TextEditingController _phone = TextEditingController();
|
|
|
|
bool get hasFocus => false;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final keyboardHeight = MediaQuery.of(context).viewInsets.bottom;
|
|
final maxHeight = MediaQuery.of(context).size.height - keyboardHeight;
|
|
|
|
return Container(
|
|
height: 300,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
IconButton(
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
icon: Icon(
|
|
Icons.arrow_back_ios,
|
|
color: Colors.black,
|
|
)),
|
|
Text(
|
|
"Transfer money via PromptPay".tr(),
|
|
style: TextStyle(
|
|
color: Color(0xff050505),
|
|
fontSize: 20,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
Container(
|
|
child: TextField(
|
|
keyboardType: TextInputType.number,
|
|
inputFormatters: [
|
|
FilteringTextInputFormatter.allow(RegExp(r'[0-9]')),
|
|
],
|
|
controller: _phone,
|
|
decoration: InputDecoration(
|
|
hintText: 'Mobilephone number'.tr(),
|
|
border: InputBorder.none,
|
|
contentPadding: EdgeInsets.symmetric(horizontal: 16),
|
|
),
|
|
),
|
|
margin: EdgeInsets.symmetric(horizontal: 20),
|
|
height: 48,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(100),
|
|
color: Color(0xfff2f2f2),
|
|
),
|
|
),
|
|
Spacer(),
|
|
InkWell(
|
|
onTap: () async {
|
|
showModalBottomSheet<void>(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
useSafeArea: true,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.vertical(
|
|
top: Radius.circular(16),
|
|
),
|
|
),
|
|
builder: (BuildContext context) {
|
|
return TransferPromptPayDetail(
|
|
phone: _phone.text,
|
|
);
|
|
});
|
|
},
|
|
child: Container(
|
|
width: double.infinity,
|
|
margin: const EdgeInsets.symmetric(horizontal: 15),
|
|
child: Card(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(40),
|
|
),
|
|
child: Container(
|
|
padding: EdgeInsets.all(10),
|
|
child: Text(
|
|
"Next".tr(),
|
|
textAlign: TextAlign.center,
|
|
style: GoogleFonts.kanit(
|
|
color: ColorCustom.greyBorder,
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class TransferPromptPayDetail extends StatefulWidget {
|
|
const TransferPromptPayDetail({
|
|
Key? key,
|
|
required this.phone,
|
|
}) : super(key: key);
|
|
|
|
final String phone;
|
|
|
|
@override
|
|
State<TransferPromptPayDetail> createState() => _TransferPromptPayDetailState();
|
|
}
|
|
|
|
class _TransferPromptPayDetailState extends State<TransferPromptPayDetail> {
|
|
String number = '';
|
|
TextEditingController price = TextEditingController();
|
|
String priceTemp = "";
|
|
|
|
setValue(String val) {
|
|
if (priceTemp.contains(".") && priceTemp.split(".")[1].length == 2) {
|
|
return;
|
|
}
|
|
setState(() {
|
|
priceTemp += val;
|
|
if (val == ".") {
|
|
price.text = Utils.moneyFormat(priceTemp) + ".";
|
|
} else {
|
|
price.text = Utils.moneyFormat(priceTemp);
|
|
}
|
|
// price.text = decimalFormat.formatString(priceTemp);
|
|
});
|
|
}
|
|
|
|
backspace() {
|
|
if (priceTemp.length > 0) {
|
|
setState(() {
|
|
priceTemp = priceTemp.substring(0, priceTemp.length - 1);
|
|
price.text = Utils.moneyFormat(priceTemp);
|
|
// price.text = decimalFormat.formatString(priceTemp);
|
|
});
|
|
}
|
|
}
|
|
|
|
initPromptPay(BuildContext context) {
|
|
var param = jsonEncode(<dynamic, dynamic>{"IDCardOrMobileDeviceNo": widget.phone, "Amount": price.text.replaceAll(",", "")});
|
|
Api.post(context, Api.transferedPromptPayInitial, param).then((value) => {
|
|
if (value != null)
|
|
{
|
|
showModalBottomSheet(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
useSafeArea: true,
|
|
shape: const RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.vertical(
|
|
top: Radius.circular(16),
|
|
),
|
|
),
|
|
builder: (BuildContext context) {
|
|
return TransferBankConfirm(
|
|
json: value,
|
|
phone: widget.phone,
|
|
price: price.text,
|
|
);
|
|
})
|
|
}
|
|
else
|
|
{}
|
|
});
|
|
}
|
|
|
|
var maskFormatter = MaskTextInputFormatter(mask: '#,###,###', filter: {"#": RegExp('[0-9]')});
|
|
|
|
// CurrencyTextInputFormatter decimalFormat = CurrencyTextInputFormatter.currency(symbol: "", decimalDigits: 2);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: SingleChildScrollView(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(20.0),
|
|
child: Container(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
IconButton(
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
icon: Icon(
|
|
Icons.arrow_back_ios,
|
|
color: Colors.black,
|
|
)),
|
|
Expanded(
|
|
child: Text(
|
|
"Transfer money via PromptPay".tr(),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
color: Color(0xff050505),
|
|
fontSize: 20,
|
|
),
|
|
),
|
|
),
|
|
IconButton(
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
icon: Icon(
|
|
Icons.close,
|
|
color: Colors.black,
|
|
)),
|
|
],
|
|
),
|
|
Text(
|
|
"Mobilephone number".tr(),
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
Container(
|
|
child: Row(
|
|
children: [
|
|
Spacer(),
|
|
Text(
|
|
widget.phone,
|
|
textAlign: TextAlign.right,
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 20,
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 20,
|
|
)
|
|
],
|
|
),
|
|
height: 48,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(100),
|
|
color: Color(0xfff2f2f2),
|
|
),
|
|
),
|
|
Text(
|
|
"Amount transferred".tr(),
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
Container(
|
|
width: double.infinity,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(100),
|
|
color: Color(0xfff2f2f2),
|
|
),
|
|
child: TextField(
|
|
showCursor: true,
|
|
readOnly: true,
|
|
textAlign: TextAlign.end,
|
|
keyboardType: TextInputType.number,
|
|
inputFormatters: [
|
|
TextInputFormatter.withFunction((TextEditingValue oldValue, TextEditingValue newValue) {
|
|
var formatter = NumberFormat('#,###,###.##', 'en_US');
|
|
var value = formatter.parse(newValue.text) ?? 0;
|
|
|
|
// If a decimal point was just added to the end of the value, keep it.
|
|
if (newValue.text.endsWith('.') && '.'.allMatches(newValue.text).length == 1) {
|
|
return newValue;
|
|
}
|
|
|
|
// Otherwise, format the value correctly.
|
|
return TextEditingValue(
|
|
text: formatter.format(value),
|
|
);
|
|
})
|
|
],
|
|
controller: price,
|
|
style: TextStyle(fontSize: 24),
|
|
decoration: InputDecoration(
|
|
hintText: 'Amount transferred'.tr(),
|
|
border: InputBorder.none,
|
|
contentPadding: EdgeInsets.symmetric(horizontal: 16),
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
// padding: EdgeInsets.symmetric(horizontal: 50.0),
|
|
child: Column(
|
|
children: <Widget>[
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: <Widget>[
|
|
NumpadButton(
|
|
text: '1',
|
|
onPressed: () => setValue('1'),
|
|
),
|
|
NumpadButton(
|
|
text: '2',
|
|
onPressed: () => setValue('2'),
|
|
),
|
|
NumpadButton(
|
|
text: '3',
|
|
onPressed: () => setValue('3'),
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: <Widget>[
|
|
NumpadButton(
|
|
text: '4',
|
|
onPressed: () => setValue('4'),
|
|
),
|
|
NumpadButton(
|
|
text: '5',
|
|
onPressed: () => setValue('5'),
|
|
),
|
|
NumpadButton(
|
|
text: '6',
|
|
onPressed: () => setValue('6'),
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: <Widget>[
|
|
NumpadButton(
|
|
text: '7',
|
|
onPressed: () => setValue('7'),
|
|
),
|
|
NumpadButton(
|
|
text: '8',
|
|
onPressed: () => setValue('8'),
|
|
),
|
|
NumpadButton(
|
|
text: '9',
|
|
onPressed: () => setValue('9'),
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: <Widget>[
|
|
// Visibility(
|
|
// child: NumpadButton(
|
|
// text: '0',
|
|
// onPressed: () {},
|
|
// ),
|
|
// maintainSize: true,
|
|
// maintainAnimation: true,
|
|
// maintainState: true,
|
|
// visible: false,
|
|
// ),
|
|
NumpadButton(
|
|
text: '.',
|
|
onPressed: () => setValue('.'),
|
|
),
|
|
NumpadButton(
|
|
text: '0',
|
|
onPressed: () => setValue('0'),
|
|
),
|
|
NumpadButton(
|
|
haveBorder: false,
|
|
icon: Icons.backspace,
|
|
onPressed: () => backspace(),
|
|
),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
),
|
|
InkWell(
|
|
onTap: () async {
|
|
initPromptPay(context);
|
|
},
|
|
child: SizedBox(
|
|
width: double.infinity,
|
|
child: Card(
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(40),
|
|
),
|
|
child: Container(
|
|
padding: EdgeInsets.all(10),
|
|
child: Text(
|
|
"Confirm".tr(),
|
|
textAlign: TextAlign.center,
|
|
style: GoogleFonts.kanit(
|
|
color: ColorCustom.greyBorder,
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 10,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
));
|
|
}
|
|
}
|
|
|
|
/*class TransferPromptPayConfirm extends StatefulWidget {
|
|
const TransferPromptPayConfirm({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<TransferPromptPayConfirm> createState() => _TransferPromptPayConfirmState();
|
|
}
|
|
|
|
class _TransferPromptPayConfirmState extends State<TransferPromptPayConfirm> {
|
|
String number = '';
|
|
TextEditingController price = TextEditingController();
|
|
|
|
setValue(String val) {
|
|
setState(() {
|
|
price.text += val;
|
|
});
|
|
}
|
|
|
|
backspace(String text) {
|
|
if (price.text.length > 0) {
|
|
setState(() {
|
|
price.text = price.text.substring(0, price.text.length - 1);
|
|
});
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: SingleChildScrollView(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(20.0),
|
|
child: Container(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
IconButton(
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
icon: Icon(
|
|
Icons.arrow_back_ios,
|
|
color: Colors.black,
|
|
)),
|
|
Text(
|
|
"โอนเงินผ่านธนาคาร",
|
|
style: TextStyle(
|
|
color: Color(0xff050505),
|
|
fontSize: 20,
|
|
),
|
|
),
|
|
Spacer(),
|
|
IconButton(
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
icon: Icon(
|
|
Icons.close,
|
|
color: Colors.black,
|
|
)),
|
|
],
|
|
),
|
|
Container(
|
|
child: Row(
|
|
children: [
|
|
Image(
|
|
image: AssetImage('images/bank/kbank.png'),
|
|
fit: BoxFit.cover,
|
|
),
|
|
SizedBox(
|
|
width: 20,
|
|
),
|
|
Text(
|
|
"KASIKORNBANK",
|
|
style: TextStyle(
|
|
color: Color(0xff050505),
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
height: 56,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(6),
|
|
color: Colors.grey.shade100,
|
|
),
|
|
),
|
|
Text(
|
|
"หมายเลขบัญชี",
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
Container(
|
|
child: Row(
|
|
children: [
|
|
Spacer(),
|
|
Text(
|
|
"201-5-41801-9",
|
|
textAlign: TextAlign.right,
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 20,
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 20,
|
|
)
|
|
],
|
|
),
|
|
height: 48,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(100),
|
|
color: Color(0xfff2f2f2),
|
|
),
|
|
),
|
|
Text(
|
|
"จำนวนเงินที่โอน",
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
Container(
|
|
child: Row(
|
|
children: [
|
|
Spacer(),
|
|
Text(
|
|
"฿ 200.00",
|
|
textAlign: TextAlign.right,
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 36,
|
|
),
|
|
),
|
|
SizedBox(
|
|
width: 20,
|
|
)
|
|
],
|
|
),
|
|
height: 66,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(100),
|
|
color: Color(0xfff2f2f2),
|
|
),
|
|
),
|
|
Container(
|
|
// padding: EdgeInsets.symmetric(horizontal: 50.0),
|
|
child: Column(
|
|
children: <Widget>[
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: <Widget>[
|
|
NumpadButton(
|
|
text: '1',
|
|
onPressed: () => setValue('1'),
|
|
),
|
|
NumpadButton(
|
|
text: '2',
|
|
onPressed: () => setValue('2'),
|
|
),
|
|
NumpadButton(
|
|
text: '3',
|
|
onPressed: () => setValue('2'),
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: <Widget>[
|
|
NumpadButton(
|
|
text: '4',
|
|
onPressed: () => setValue('4'),
|
|
),
|
|
NumpadButton(
|
|
text: '5',
|
|
onPressed: () => setValue('5'),
|
|
),
|
|
NumpadButton(
|
|
text: '6',
|
|
onPressed: () => setValue('6'),
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: <Widget>[
|
|
NumpadButton(
|
|
text: '7',
|
|
onPressed: () => setValue('7'),
|
|
),
|
|
NumpadButton(
|
|
text: '8',
|
|
onPressed: () => setValue('8'),
|
|
),
|
|
NumpadButton(
|
|
text: '9',
|
|
onPressed: () => setValue('9'),
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: <Widget>[
|
|
Container(
|
|
padding: EdgeInsets.symmetric(vertical: 10.0),
|
|
child: OutlinedButton(
|
|
style: OutlinedButton.styleFrom(
|
|
side: BorderSide.none,
|
|
backgroundColor: Colors.transparent,
|
|
),
|
|
onPressed: () {},
|
|
child: Padding(
|
|
padding: EdgeInsets.all(20.0),
|
|
child: Text(
|
|
"0",
|
|
style: GoogleFonts.kanit(
|
|
color: Colors.transparent,
|
|
fontSize: 30,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
NumpadButton(
|
|
text: '0',
|
|
onPressed: () => setValue('0'),
|
|
),
|
|
NumpadButton(
|
|
haveBorder: false,
|
|
icon: Icons.backspace,
|
|
onPressed: () => backspace(number),
|
|
),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
),
|
|
InkWell(
|
|
onTap: () async {
|
|
showModalBottomSheet<void>(
|
|
context: context,
|
|
isScrollControlled: true,
|
|
useSafeArea: true,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.vertical(
|
|
top: Radius.circular(16),
|
|
),
|
|
),
|
|
builder: (BuildContext context) {
|
|
return TransferBankConfirm();
|
|
});
|
|
// final result = await Navigator.push(
|
|
// context,
|
|
// MaterialPageRoute(
|
|
// builder: (context) => PinCodeValidatePage()),
|
|
// );
|
|
// if (result == true) {
|
|
// showDialog(
|
|
// context: context,
|
|
// builder: (BuildContext context) {
|
|
// return TransferBankDialog();
|
|
// });
|
|
// }
|
|
},
|
|
child: Container(
|
|
width: MediaQuery.of(context).size.width,
|
|
height: 51,
|
|
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: 10,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
));
|
|
}
|
|
}*/
|
|
|
|
class TransferBankConfirm extends StatefulWidget {
|
|
const TransferBankConfirm({Key? key, this.json, required this.phone, required this.price}) : super(key: key);
|
|
|
|
final dynamic json;
|
|
final String phone;
|
|
final String price;
|
|
|
|
@override
|
|
State<TransferBankConfirm> createState() => _TransferBankConfirmState();
|
|
}
|
|
|
|
class _TransferBankConfirmState extends State<TransferBankConfirm> {
|
|
var name = "";
|
|
var code = "";
|
|
var trans = "";
|
|
var qrID = "";
|
|
|
|
@override
|
|
void initState() {
|
|
name = widget.json["promptPayname"];
|
|
code = widget.json["promptPayCode"];
|
|
trans = widget.json["transactionlogid"];
|
|
qrID = widget.json["qrId"];
|
|
|
|
super.initState();
|
|
}
|
|
|
|
confirmPromptPay(BuildContext context) {
|
|
// {
|
|
// "IDCardOrMobileDeviceNo": "string",
|
|
// "TransactionID": "string",
|
|
// "Amount": 0,
|
|
// "Note": "string"
|
|
// }
|
|
var param = jsonEncode(<dynamic, dynamic>{"IDCardOrMobileDeviceNo": widget.phone, "Amount": widget.price.replaceAll(",", ""), "TransactionID": trans, "NOTE": ""});
|
|
Api.post(context, Api.transferedPromptPayConfirm, param).then((value) => {
|
|
if (value != null)
|
|
{
|
|
showDialog(
|
|
context: context,
|
|
builder: (BuildContext context) {
|
|
return TransferPromtptPayDialog(
|
|
price: widget.price,
|
|
bill: value["data"]["_TranID"],
|
|
phone: code,
|
|
name: name,
|
|
);
|
|
})
|
|
}
|
|
else
|
|
{}
|
|
});
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(children: [
|
|
Row(children: [
|
|
IconButton(
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
icon: Icon(
|
|
Icons.arrow_back_ios,
|
|
color: Colors.black,
|
|
)),
|
|
Text(
|
|
"Transfer money via PromptPay".tr(),
|
|
style: TextStyle(
|
|
color: Color(0xff050505),
|
|
fontSize: 20,
|
|
),
|
|
),
|
|
Spacer(),
|
|
IconButton(
|
|
onPressed: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
icon: Icon(
|
|
Icons.close,
|
|
color: Colors.black,
|
|
)),
|
|
]),
|
|
Container(
|
|
width: 200,
|
|
child: Image(
|
|
image: AssetImage('images/neopay_logo.png'),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: SingleChildScrollView(
|
|
child: Column(mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [
|
|
Card(
|
|
margin: EdgeInsets.all(10),
|
|
color: Color(0xfffbfbfb),
|
|
elevation: 5,
|
|
child: Container(
|
|
padding: const EdgeInsets.all(10.0),
|
|
child: Column(
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
"เลขที่บิล".tr(),
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
Expanded(
|
|
child: Text(
|
|
trans,
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
textAlign: TextAlign.end,
|
|
))
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 15,
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
"วันที่ทำรายการ".tr(),
|
|
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(
|
|
"จาก".tr(),
|
|
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?.personalCardId ?? "",
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 35,
|
|
),
|
|
Row(
|
|
children: [
|
|
Text(
|
|
"ถึง".tr(),
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
Spacer(),
|
|
Text(
|
|
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(
|
|
"จำนวนเงิน".tr(),
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
),
|
|
Text(
|
|
"฿ ${Utils.moneyFormat(widget.price.replaceAll(",", ""))}",
|
|
style: TextStyle(
|
|
color: Color(0xff65676b),
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.w800,
|
|
),
|
|
)
|
|
],
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
SizedBox(
|
|
height: 20,
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
children: [
|
|
InkWell(
|
|
onTap: () {
|
|
Navigator.of(context).pop();
|
|
},
|
|
child: Container(
|
|
margin: EdgeInsets.only(bottom: 15),
|
|
width: MediaQuery.of(context).size.width / 4,
|
|
height: 46,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(100),
|
|
color: Color(0xff2d2d2d),
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
"ยกเลิก".tr(),
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
)),
|
|
)),
|
|
InkWell(
|
|
onTap: () async {
|
|
final result = await Navigator.push(
|
|
context,
|
|
MaterialPageRoute(builder: (context) => PinCodeValidatePage()),
|
|
);
|
|
if (result == true) {
|
|
confirmPromptPay(context);
|
|
}
|
|
},
|
|
child: Container(
|
|
margin: EdgeInsets.only(bottom: 15),
|
|
width: MediaQuery.of(context).size.width / 4,
|
|
height: 46,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(100),
|
|
color: Colors.white,
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.grey.withOpacity(0.5),
|
|
spreadRadius: 2,
|
|
blurRadius: 4,
|
|
offset: Offset(0, 2), // changes position of shadow
|
|
),
|
|
],
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
"Confirm".tr(),
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
color: ColorCustom.greyBorder,
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.w300,
|
|
),
|
|
)),
|
|
)),
|
|
],
|
|
)
|
|
]),
|
|
))
|
|
]);
|
|
}
|
|
}
|