| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- import 'package:bbyyy/https/MyDio.dart';
- import 'package:bbyyy/my_tools/my_colors.dart';
- import 'package:bbyyy/my_tools/my_cookie.dart';
- import 'package:bbyyy/my_tools/my_tools.dart';
- import 'package:bbyyy/my_tools/my_views.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- class SetAlipayPage extends StatefulWidget {
- @override
- _SetAlipayPageState createState() => _SetAlipayPageState();
- }
- class _SetAlipayPageState extends State<SetAlipayPage> {
- TextEditingController controller = TextEditingController();
- @override
- void initState() {
- // TODO: implement initState
- super.initState();
- if(MyCookie().userBean.aliPayAccount!=null&&MyCookie().userBean.aliPayAccount!=''){
- controller.text = MyCookie().userBean.aliPayAccount;
- }
- }
- @override
- Widget build(BuildContext context) {
- return GestureDetector(
- onTap: () {
- MyTools().hideKeyboard(context);
- },
- behavior: HitTestBehavior.translucent,
- child: Scaffold(
- backgroundColor: Colors.white,
- body: Column(
- children: [
- MyViews().myAppBar('绑定支付宝账号', context, []),
- Expanded(
- child: SingleChildScrollView(
- child: Column(
- children: [
- Container(
- height: 10,
- color: MyColors.cF7F7F7,
- ),
- Container(
- child: MyViews().myText('绑定支付宝账号 ', MyColors.c333333, 15),
- margin:
- EdgeInsets.symmetric(horizontal: 16, vertical: 17),
- ),
- Container(
- decoration: BoxDecoration(
- border: Border.all(color: MyColors.cE7E7E7, width: 1),
- borderRadius: BorderRadius.circular(4),
- ),
- margin: EdgeInsets.symmetric(horizontal: 16),
- padding: EdgeInsets.all(12),
- child: TextField(
- controller: controller,
- cursorColor: MyColors.cFF4233,
- cursorWidth: 1.0,
- onTap: () {},
- decoration: InputDecoration(
- border: InputBorder.none,
- disabledBorder: InputBorder.none,
- enabledBorder: InputBorder.none,
- focusedBorder: InputBorder.none,
- isDense: true,
- hintText: '请输入支付宝账号',
- hintStyle:
- TextStyle(color: MyColors.c999999, fontSize: 16),
- contentPadding:
- const EdgeInsets.fromLTRB(14, 4.5, 8, 4.5),
- ),
- maxLines: 1,
- style: TextStyle(
- color: MyColors.c333333,
- fontSize: 16,
- height: 1.3,
- letterSpacing: 0.2),
- keyboardType: TextInputType.text,
- onChanged: (t) {},
- ),
- ),
- GestureDetector(
- onTap: () {
- if (controller.text.isEmpty) {
- showToast('请填写支付宝账号');
- return;
- }
- MyTools().hideKeyboard(context);
- saveAlipayNum();
- },
- behavior: HitTestBehavior.translucent,
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(22.5),
- color: MyColors.cFF4233),
- height: 45,
- margin:
- EdgeInsets.symmetric(horizontal: 63, vertical: 157),
- child: MyViews().myText('确定修改', Colors.white, 15),
- alignment: Alignment.center,
- ),
- )
- ],
- crossAxisAlignment: CrossAxisAlignment.start,
- ),
- ),
- ),
- ],
- ),
- ),
- );
- }
- void saveAlipayNum() {
- MyDio().update({
- "key": "user",
- "values": {
- "name": MyCookie().loginInformation.data.extra.name,
- "picture": MyCookie().loginInformation.data.extra.picture,
- "id": MyCookie().loginInformation.data.extra.id,
- "alipay_account": controller.text.toString()
- }
- }, (response, hasError) {
- if (!hasError) {
- MyCookie().userBean.aliPayAccount = controller.text.toString();
- Navigator.pop(context);
- }
- }, (error) {});
- }
- }
|