短信帮手

dyb
王亚玲 2 years ago
parent 53e05e0f62
commit c5ffb51db4

@ -46,6 +46,7 @@ class _LoginPageState extends State<LoginPage> {
// _phone = '12345678909'; // _phone = '12345678909';
} }
String ploneText = "";
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CloudScaffold( return CloudScaffold(
@ -89,11 +90,13 @@ class _LoginPageState extends State<LoginPage> {
style: TextStyle(fontSize: 32.sp, color: const Color(0xFF999999)), style: TextStyle(fontSize: 32.sp, color: const Color(0xFF999999)),
), ),
80.hb, 80.hb,
_getBox('+86', 36), _getBox('+86', 36, "请输入手机号", 11),
_getBox('验证码', 32), _getBox('验证码', 32, "请输入验证码", 6),
112.hb, 112.hb,
PloneBottom( PloneBottom(
blM: false, blM: false,
border: ploneText.length != 11,
opacity: ploneText.length == 11 ? 1 : 0.4,
onTap: () { onTap: () {
Get.to(() => const TabNavigator()); Get.to(() => const TabNavigator());
}, },
@ -107,7 +110,7 @@ class _LoginPageState extends State<LoginPage> {
); );
} }
_getBox(String text, int fontSize) { _getBox(String text, int fontSize, String hit, int num) {
return Container( return Container(
height: 144.w, height: 144.w,
width: double.infinity, width: double.infinity,
@ -135,28 +138,32 @@ class _LoginPageState extends State<LoginPage> {
margin: EdgeInsets.symmetric(horizontal: 32.w), margin: EdgeInsets.symmetric(horizontal: 32.w),
color: const Color(0xFFE8E8E8), color: const Color(0xFFE8E8E8),
), ),
_phoneTFWidget(), _phoneTFWidget(hit, num),
]), ]),
); );
} }
// //
_phoneTFWidget() { _phoneTFWidget(String hit, int num) {
return SizedBox( return SizedBox(
// alignment: Alignment.centerLeft, // alignment: Alignment.centerLeft,
// padding: EdgeInsets.symmetric(horizontal: 72.w), // padding: EdgeInsets.symmetric(horizontal: 72.w),
width: 300.w, width: 300.w,
height: 50.w, height: 50.w,
child: TextField( child: TextField(
maxLength: 11, maxLength: num,
inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r'[0-9]'))], inputFormatters: [FilteringTextInputFormatter.allow(RegExp(r'[0-9]'))],
textCapitalization: TextCapitalization.none, textCapitalization: TextCapitalization.none,
onChanged: (text) {
ploneText = text;
setState(() {});
},
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: EdgeInsets.only(bottom: 20.w), contentPadding: EdgeInsets.only(bottom: 20.w),
border: InputBorder.none, border: InputBorder.none,
counterText: "", counterText: "",
//textfieldiOSplaceholder //textfieldiOSplaceholder
hintText: "请输入手机号", hintText: hit,
// //
hintStyle: TextStyle(color: Colors.black12), hintStyle: TextStyle(color: Colors.black12),
), ),

Loading…
Cancel
Save