处理IOS密码不能输入非数字的内容
This commit is contained in:
parent
7f3961c8ea
commit
d125a2b470
|
|
@ -81,16 +81,19 @@ class _LoginPageState extends State<LoginPage> {
|
|||
child: SizedBox(
|
||||
height: 77.w,
|
||||
width: 77.w,
|
||||
child: Image.asset('assets/images/login_logo_icon.png', fit: BoxFit.cover),
|
||||
child: Image.asset('assets/images/login_logo_icon.png',
|
||||
fit: BoxFit.cover),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 90.r),
|
||||
padding: EdgeInsets.only(top: 50.h, bottom: 16.h, left: 40.w, right: 40.w),
|
||||
padding: EdgeInsets.only(
|
||||
top: 50.h, bottom: 16.h, left: 40.w, right: 40.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius:
|
||||
BorderRadius.only(topLeft: Radius.circular(30.r), topRight: Radius.circular(30.r)),
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(30.r),
|
||||
topRight: Radius.circular(30.r)),
|
||||
/*boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Color.fromRGBO(46, 91, 255, 0.1),
|
||||
|
|
@ -107,8 +110,10 @@ class _LoginPageState extends State<LoginPage> {
|
|||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
border: Border.all(width: 1.w, color: const Color(0xFF434343)),
|
||||
borderRadius: BorderRadius.all(Radius.circular(17.w)),
|
||||
border: Border.all(
|
||||
width: 1.w, color: const Color(0xFF434343)),
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(17.w)),
|
||||
),
|
||||
child: TextField(
|
||||
controller: state.userNameController,
|
||||
|
|
@ -160,24 +165,29 @@ class _LoginPageState extends State<LoginPage> {
|
|||
padding: EdgeInsets.symmetric(horizontal: 15.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.transparent,
|
||||
border: Border.all(width: 1.w, color: const Color(0xFF434343)),
|
||||
borderRadius: BorderRadius.all(Radius.circular(17.w)),
|
||||
border: Border.all(
|
||||
width: 1.w, color: const Color(0xFF434343)),
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(17.w)),
|
||||
),
|
||||
child: TextField(
|
||||
focusNode: state.pwdFocus,
|
||||
controller: state.passwordController,
|
||||
keyboardType: TextInputType.number,
|
||||
// keyboardType: TextInputType.number,
|
||||
maxLines: 1,
|
||||
obscureText: state.isShowPwd.value,
|
||||
//隐藏密码显示
|
||||
// textInputAction: state.isShowPwd.value?TextInputAction.go:TextInputAction.next,
|
||||
textInputAction: TextInputAction.send,
|
||||
enableInteractiveSelection: false,
|
||||
onSubmitted: (_) => easyThrottle('LOGIN_EASYTHROTTLE', () async {
|
||||
onSubmitted: (_) =>
|
||||
easyThrottle('LOGIN_EASYTHROTTLE', () async {
|
||||
Utils.hideKeyboard();
|
||||
await Future.delayed(const Duration(milliseconds: 300));
|
||||
WidgetsBinding.instance
|
||||
.addPostFrameCallback((_) => logic.toLogin(context, upgradeLogic));
|
||||
await Future.delayed(
|
||||
const Duration(milliseconds: 300));
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) =>
|
||||
logic.toLogin(context, upgradeLogic));
|
||||
}),
|
||||
style: TextStyle(
|
||||
color: const Color(0xFF434343),
|
||||
|
|
@ -203,7 +213,8 @@ class _LoginPageState extends State<LoginPage> {
|
|||
),
|
||||
suffixIcon: InkWell(
|
||||
onTap: () {
|
||||
state.isShowPwd.value = !state.isShowPwd.value;
|
||||
state.isShowPwd.value =
|
||||
!state.isShowPwd.value;
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(right: 5.r),
|
||||
|
|
@ -246,24 +257,35 @@ class _LoginPageState extends State<LoginPage> {
|
|||
child: Checkbox(
|
||||
// activeColor: Colors.transparent, //去掉勾选时背景颜色
|
||||
|
||||
activeColor: Theme.of(context).primaryColor,
|
||||
activeColor:
|
||||
Theme.of(context).primaryColor,
|
||||
// checkColor: Colors.white,
|
||||
value: state.keepPwd.value,
|
||||
onChanged: (value) {
|
||||
// Get.focusScope?.nextFocus();
|
||||
FocusScope.of(context).requestFocus(state.pwdFocus);
|
||||
FocusScope.of(context).requestFocus(state.theFocus);
|
||||
state.keepPwd.value = value ?? false;
|
||||
FocusScope.of(context)
|
||||
.requestFocus(state.pwdFocus);
|
||||
FocusScope.of(context)
|
||||
.requestFocus(state.theFocus);
|
||||
state.keepPwd.value =
|
||||
value ?? false;
|
||||
},
|
||||
side: WidgetStateBorderSide.resolveWith(
|
||||
side: WidgetStateBorderSide
|
||||
.resolveWith(
|
||||
(Set<WidgetState> states) {
|
||||
if (states.contains(WidgetState.selected)) {
|
||||
if (states.contains(
|
||||
WidgetState.selected)) {
|
||||
//修改勾选时边框颜色为红色
|
||||
return BorderSide(
|
||||
width: 1.5.r, color: Theme.of(context).primaryColor);
|
||||
width: 1.5.r,
|
||||
color: Theme.of(context)
|
||||
.primaryColor);
|
||||
}
|
||||
//修改默认时边框颜色为绿色
|
||||
return BorderSide(width: 1.r, color: const Color(0xFF434343));
|
||||
return BorderSide(
|
||||
width: 1.r,
|
||||
color: const Color(
|
||||
0xFF434343));
|
||||
},
|
||||
)),
|
||||
);
|
||||
|
|
@ -274,9 +296,12 @@ class _LoginPageState extends State<LoginPage> {
|
|||
Utils.hideKeyboard();
|
||||
Get.focusScope?.nextFocus();
|
||||
Get.focusScope?.nextFocus();
|
||||
FocusScope.of(context).requestFocus(state.pwdFocus);
|
||||
FocusScope.of(context).requestFocus(state.theFocus);
|
||||
state.keepPwd.value = !state.keepPwd.value;
|
||||
FocusScope.of(context)
|
||||
.requestFocus(state.pwdFocus);
|
||||
FocusScope.of(context)
|
||||
.requestFocus(state.theFocus);
|
||||
state.keepPwd.value =
|
||||
!state.keepPwd.value;
|
||||
},
|
||||
child: Text(
|
||||
'记住密码',
|
||||
|
|
@ -291,21 +316,26 @@ class _LoginPageState extends State<LoginPage> {
|
|||
),
|
||||
InkWell(
|
||||
onTap: () => Get.toNamed(Routes.register),
|
||||
child: quickText('账号注册', color: const Color(0xFF434343)),
|
||||
child: quickText('账号注册',
|
||||
color: const Color(0xFF434343)),
|
||||
)
|
||||
],
|
||||
),
|
||||
InkWell(
|
||||
onTap: () => easyThrottle('LOGIN_EASYTHROTTLE', () async {
|
||||
onTap: () =>
|
||||
easyThrottle('LOGIN_EASYTHROTTLE', () async {
|
||||
Utils.hideKeyboard();
|
||||
await Future.delayed(Duration.zero);
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) => logic.toLogin(context, upgradeLogic));
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => logic.toLogin(context, upgradeLogic));
|
||||
}),
|
||||
child: Obx(() {
|
||||
return Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 10.h),
|
||||
decoration: BoxDecoration(
|
||||
color: state.canLogin.value ? const Color(0xFF8C68FF) : const Color(0xFFdddddd),
|
||||
color: state.canLogin.value
|
||||
? const Color(0xFF8C68FF)
|
||||
: const Color(0xFFdddddd),
|
||||
/*boxShadow: [
|
||||
BoxShadow(
|
||||
color:
|
||||
|
|
@ -322,7 +352,8 @@ class _LoginPageState extends State<LoginPage> {
|
|||
alignment: Alignment.center,
|
||||
width: double.infinity,
|
||||
height: 50.h,
|
||||
child: quickText('登 录', size: 18.sp, color: Colors.white));
|
||||
child: quickText('登 录',
|
||||
size: 18.sp, color: Colors.white));
|
||||
}),
|
||||
),
|
||||
Row(
|
||||
|
|
@ -343,16 +374,23 @@ class _LoginPageState extends State<LoginPage> {
|
|||
state.pwdFocus);
|
||||
FocusScope.of(context).requestFocus(
|
||||
state.theFocus);*/
|
||||
state.readAgreement.value = value ?? false;
|
||||
state.readAgreement.value =
|
||||
value ?? false;
|
||||
},
|
||||
side: WidgetStateBorderSide.resolveWith(
|
||||
(Set<WidgetState> states) {
|
||||
if (states.contains(WidgetState.selected)) {
|
||||
if (states
|
||||
.contains(WidgetState.selected)) {
|
||||
//修改勾选时边框颜色为红色
|
||||
return BorderSide(width: 1.5.r, color: Theme.of(context).primaryColor);
|
||||
return BorderSide(
|
||||
width: 1.5.r,
|
||||
color: Theme.of(context)
|
||||
.primaryColor);
|
||||
}
|
||||
//修改默认时边框颜色为绿色
|
||||
return BorderSide(width: 1.r, color: const Color(0xFF434343));
|
||||
return BorderSide(
|
||||
width: 1.r,
|
||||
color: const Color(0xFF434343));
|
||||
},
|
||||
),
|
||||
),
|
||||
|
|
@ -361,8 +399,9 @@ class _LoginPageState extends State<LoginPage> {
|
|||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed(Routes.agreementPage,
|
||||
arguments: {"type": AGREEMENT_KEY.USER_AGREEMENT.name});
|
||||
Get.toNamed(Routes.agreementPage, arguments: {
|
||||
"type": AGREEMENT_KEY.USER_AGREEMENT.name
|
||||
});
|
||||
},
|
||||
child: quickText(
|
||||
'请仔细阅读',
|
||||
|
|
@ -371,18 +410,22 @@ class _LoginPageState extends State<LoginPage> {
|
|||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed(Routes.agreementPage,
|
||||
arguments: {"type": AGREEMENT_KEY.USER_AGREEMENT.name});
|
||||
Get.toNamed(Routes.agreementPage, arguments: {
|
||||
"type": AGREEMENT_KEY.USER_AGREEMENT.name
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
'《用户协议》',
|
||||
style: TextStyle(fontSize: 12.r, color: Theme.of(context).primaryColor),
|
||||
style: TextStyle(
|
||||
fontSize: 12.r,
|
||||
color: Theme.of(context).primaryColor),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
Get.toNamed(Routes.agreementPage,
|
||||
arguments: {"type": AGREEMENT_KEY.PRIVACY_GREEMENT.name});
|
||||
Get.toNamed(Routes.agreementPage, arguments: {
|
||||
"type": AGREEMENT_KEY.PRIVACY_GREEMENT.name
|
||||
});
|
||||
},
|
||||
child: quickText(
|
||||
'《隐私协议》',
|
||||
|
|
|
|||
Loading…
Reference in New Issue