Files
Neo_wallet/neowallet_mobile/lib/Withdraw/WithDraw.dart
Manasit.K 43c32ef6cf init
2024-10-31 15:57:57 +07:00

331 lines
12 KiB
Dart

import 'package:cathaypay_mobile/Numpad.dart';
import 'package:cathaypay_mobile/PinCodeVadidate.dart';
import 'package:cathaypay_mobile/TopUp/TopUpDialog.dart';
import 'package:cathaypay_mobile/Withdraw/WithDrawDialog.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
TextEditingController _pin = TextEditingController();
class WithDrawPage extends StatefulWidget {
const WithDrawPage({Key? key}) : super(key: key);
@override
State<WithDrawPage> createState() => _WithDrawPageState();
}
class _WithDrawPageState extends State<WithDrawPage> {
setValue(String val) {
setState(() {
_pin.text += val;
});
if (_pin.text.length == 6) {
_saveText(_pin.text);
Navigator.pushNamed(context, '/RegisterPicturePage');
}
}
backspace(String text) {
if (_pin.text.length > 0) {
setState(() {
_pin.text = _pin.text.substring(0, _pin.text.length - 1);
});
}
}
void _saveText(String text) async {
// SharedPreferences prefs = await SharedPreferences.getInstance();
// await prefs.setString('PinCode', text);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
actions: [
CupertinoButton(
onPressed: () {
Navigator.pop(context);
},
child: IconButton(
onPressed: () {
Navigator.of(context).pop();
},
icon: const Icon(Icons.clear,color: Colors.grey,),
),
)
],
leading: CupertinoButton(
onPressed: () {
Navigator.pop(context);
},
child: const Icon(
Icons.chevron_left,
color: Colors.black54,
),
),
elevation: 0,
title: Text(
"จ่ายเงิน",
textAlign: TextAlign.center,
style: GoogleFonts.kanit(
color: Colors.black,
fontSize: 20,
),
),
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
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,
),
),
SizedBox(
height: 20,
),
Text(
"เลขที่บัญชี",
style: TextStyle(
color: Color(0xff65676b),
fontSize: 16,
fontWeight: FontWeight.w300,
),
),
SizedBox(
height: 20,
),
Container(
height: 48,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: Color(0xfff2f2f2),
),
child: Row(
children: [
Spacer(),
Text(
"015-5-40141-2",
textAlign: TextAlign.right,
style: TextStyle(
color: Color(0xff65676b),
fontSize: 20,
),
),
SizedBox(
width: 20,
)
],
),
),
SizedBox(
height: 20,
),
Text(
"จำนวนเงินที่เติม",
style: TextStyle(
color: Color(0xff65676b),
fontSize: 16,
fontWeight: FontWeight.w300,
),
),
SizedBox(
height: 20,
),
Container(
height: 60,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
color: Colors.grey.shade300,
),
child: Row(
children: [
Spacer(),
Text(
"0",
textAlign: TextAlign.right,
style: TextStyle(
color: Color(0xff65676b),
fontSize: 25,
),
),
SizedBox(
width: 20,
)
],
),
),
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(_pin.text),
),
],
)
],
),
),
InkWell(
onTap: () async {
final result = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PinCodeValidatePage()),
);
if (result == true) {
showDialog(
context: context,
builder: (BuildContext context) {
return WithDrawDialog();
});
}
},
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,
),
),
),
],
),
),
)
],
)),
));
}
}