import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/view_widget/keyboard/custom_password_field_widget.dart'; import 'package:huixiang/view_widget/keyboard/keyboard_widget.dart'; import 'package:huixiang/view_widget/keyboard/pay_password.dart' as keyevent; class PayInputWidget extends StatefulWidget { @override State createState() { return _PayInputWidget(); } } class _PayInputWidget extends State { @override Widget build(BuildContext context) { var height = (MediaQuery.of(context).size.width - (20 * 7.0)) / 6.0; return Scaffold( appBar: AppBar( centerTitle: true, title: Text( S.of(context).shuruzhifumima, style: TextStyle( fontSize: 14, fontWeight: FontWeight.bold, color: Color(0xFF353535), ), ), backgroundColor: Colors.white, elevation: 0, leading: GestureDetector( onTap: () { Navigator.of(context).pop(); }, child: Container( margin: EdgeInsets.only(left: 25), child: Icon( Icons.arrow_back_ios, color: Colors.black, size: 24, ), ), ), ), body: Container( color: Color(0xFFD5D7DD).withAlpha(237), child: Column( mainAxisSize: MainAxisSize.max, children: [ Container( width: double.infinity, color: Color(0xFFE6E6E6), height: height + 80, padding: EdgeInsets.fromLTRB(16, 40, 16, 40), child: CustomJPasswordField(password,), ), Container( child: MyKeyboard((event){ keyevent.KeyEvent keyEvent = event; setState(() { if (!keyEvent.isCommit() && !keyEvent.isDelete() && password.length < 6) { setState(() { password += (event as keyevent.KeyEvent).key; }); } else { if (keyEvent.isDelete() && password.length > 0) { setState(() { password = password.substring(0, password.length - 1); }); } else if (keyEvent.isCommit() && password.length == 6) { } } }); }), ), ], ), ), ); } var password = ""; }