
import 'package:flutter/material.dart';
import 'package:flutter_picker/Picker.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:worker_client/pages/wallet/widget/money.dart';
import 'package:worker_client/pages/wallet/widget/moneyInfo.dart';

import '../../widgets/layout/BasicPage.dart';


class MyWithdrawal extends BasicPage {
  MyWithdrawal({Key? key}) : super(key: key) {
    naviTitle = '我的钱包';
  }
  final bankBrand = Rx<Map>({});


  @override
  Widget builder(BuildContext context) {
    return
        Container(
          alignment: Alignment.center,
          child: Column(
            children: [
              MoneyCard(type: true,),
              Container(
                  margin: EdgeInsets.fromLTRB(20, 30.w, 0, 20.w),
                  alignment: Alignment.topLeft,
                  decoration: const BoxDecoration(
                      border: Border(
                          left: BorderSide(
                              width: 5, color: Color(0xff000000)
                            // 0x17000000
                          ))),
                  child: Padding(
                    padding: EdgeInsets.fromLTRB(13.w, 0, 0, 0),
                    child: Text(
                      '选择银行卡',
                      style: TextStyle(
                        color: Color(0xff333333),
                        fontWeight: FontWeight.w400,
                        fontSize: 18,
                      ),
                    ),
                  )),
              Container(
                width:345.w ,
                  alignment: Alignment.topLeft,
                  decoration:  BoxDecoration(
                    borderRadius: BorderRadius.circular(20),

                    border: Border.all(
                      color: Color(0xffF2F2F2),
                      width: 1,
                    ),
                    ),
                  child: Row(
                    children: [
                      Expanded(
                        child: ListTile(
                          title:Obx(()=>Text(bankBrand.value.length==0?'请选择银行':bankBrand.value['name'])),
                          onTap: () {
                            showPicker(context);
                          },
                        ),
                      ),
                      Icon(Icons.keyboard_arrow_right_outlined,size: 30,color:Color(0xff999999) ,)

                  ],)
              ),


              Container(
                  margin: EdgeInsets.fromLTRB(20, 30.w, 0, 20.w),
                  alignment: Alignment.topLeft,
                  decoration: const BoxDecoration(
                      border: Border(
                          left: BorderSide(
                              width: 5, color: Color(0xff000000)
                            // 0x17000000
                          ))),
                  child: Padding(
                    padding: EdgeInsets.fromLTRB(13.w, 0, 0, 0),
                    child: Text(
                      '提取金额',
                      style: TextStyle(
                        color: Color(0xff333333),
                        fontWeight: FontWeight.w400,
                        fontSize: 18,
                      ),
                    ),
                  )),
              Container(
                  width:345.w ,
                  alignment: Alignment.topLeft,
                  decoration:  BoxDecoration(
                    borderRadius: BorderRadius.circular(20),

                    border: Border.all(
                      color: Color(0xffF2F2F2),
                      width: 1,
                    ),
                  ),
                  child: Row(
                    children: [
                      Padding(padding: EdgeInsets.fromLTRB(20, 0  , 15, 0),
                      child:Icon(Icons.currency_yen_sharp,size: 30 ,) ,
                      ),

                      Expanded(
                        child:TextField(
                          keyboardType: TextInputType.number,
                          decoration: InputDecoration(
                            contentPadding:
                            const EdgeInsets.symmetric(vertical: 4.0),
                            hintText: '请输入提现金额',
                            border: OutlineInputBorder(
                                borderRadius: BorderRadius.circular(15),
                                borderSide: BorderSide.none),
                          ),
                          // obscureText: true,
                        ),
                      ),

                    ],)
              ),

            ],
          ),
    );
  }
  showPicker(BuildContext context) {
    const PickerData = ['中国建设银河','8s鱼就是','我的银行卡'];
    Picker picker = Picker(
        height: 230.w,
        adapter: PickerDataAdapter<String>(
            pickerdata: PickerData),
        changeToFirst: false,
        onCancel: (){
          print('object');
        },
        confirmText: '确定',
        cancelText: '取消',
        textAlign: TextAlign.left,
        textStyle: TextStyle(color: Colors.blue, ),
        selectedTextStyle: TextStyle(color: Colors.red),
        columnPadding: const EdgeInsets.all(8.0),
        onConfirm: (Picker picker, List<int> value) {
          print('666666666$value');
          // bankBrand(picker);
          int index = value.first;
          bankBrand({'id':index,'name':picker.getSelectedValues().first});
          print(bankBrand);
        }
    );
    picker.showModal(context);
  }
}


