feat:调整输入框样式
This commit is contained in:
parent
155ec4cf15
commit
5e3bb17c2d
@ -83,11 +83,9 @@ class _StarLockForgetPasswordPageState
|
|||||||
logic.checkNext(state.phoneController);
|
logic.checkNext(state.phoneController);
|
||||||
},
|
},
|
||||||
leftWidget: Padding(
|
leftWidget: Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(top: 30.w, bottom: 20.w, left: 5.w),
|
||||||
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
|
||||||
),
|
),
|
||||||
label:
|
label: TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
||||||
TranslationLoader.lanKeys!.pleaseEnterNumberOrEmail!.tr,
|
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
LengthLimitingTextInputFormatter(30),
|
LengthLimitingTextInputFormatter(30),
|
||||||
@ -99,8 +97,7 @@ class _StarLockForgetPasswordPageState
|
|||||||
},
|
},
|
||||||
isPwd: true,
|
isPwd: true,
|
||||||
leftWidget: Padding(
|
leftWidget: Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(top: 30.w, bottom: 20.w, left: 5.w),
|
||||||
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
|
||||||
),
|
),
|
||||||
label:
|
label:
|
||||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||||
@ -119,8 +116,7 @@ class _StarLockForgetPasswordPageState
|
|||||||
},
|
},
|
||||||
isPwd: true,
|
isPwd: true,
|
||||||
leftWidget: Padding(
|
leftWidget: Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(top: 30.w, bottom: 20.w, left: 5.w),
|
||||||
top: 30.w, bottom: 20.w, right: 20.w, left: 5.w),
|
|
||||||
),
|
),
|
||||||
label:
|
label:
|
||||||
"${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
"${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||||
@ -135,9 +131,7 @@ class _StarLockForgetPasswordPageState
|
|||||||
onchangeAction: (v) {
|
onchangeAction: (v) {
|
||||||
logic.checkNext(state.codeController);
|
logic.checkNext(state.codeController);
|
||||||
},
|
},
|
||||||
leftWidget: Padding(
|
leftWidget: SizedBox(),
|
||||||
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
|
||||||
),
|
|
||||||
hintText:
|
hintText:
|
||||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
@ -147,7 +141,7 @@ class _StarLockForgetPasswordPageState
|
|||||||
Obx(() => GestureDetector(
|
Obx(() => GestureDetector(
|
||||||
onTap: (state.phoneStrIsOK.value && state.canResend.value)
|
onTap: (state.phoneStrIsOK.value && state.canResend.value)
|
||||||
? () async {
|
? () async {
|
||||||
var result = await Navigator.pushNamed(
|
var result = await Navigator.pushNamed(
|
||||||
context, Routers.safetyVerificationPage,
|
context, Routers.safetyVerificationPage,
|
||||||
arguments: {
|
arguments: {
|
||||||
"countryCode": state.countryCode.value,
|
"countryCode": state.countryCode.value,
|
||||||
|
|||||||
@ -88,7 +88,6 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
|
|||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
top: 30.w,
|
top: 30.w,
|
||||||
bottom: 20.w,
|
bottom: 20.w,
|
||||||
right: 20.w,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
rightSlot: IconButton(
|
rightSlot: IconButton(
|
||||||
@ -110,7 +109,6 @@ class _StarLockLoginPageState extends State<StarLockLoginXHJPage> {
|
|||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
top: 30.w,
|
top: 30.w,
|
||||||
bottom: 20.w,
|
bottom: 20.w,
|
||||||
right: 20.w,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
label:
|
label:
|
||||||
|
|||||||
@ -140,9 +140,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
|||||||
onchangeAction: (v) {
|
onchangeAction: (v) {
|
||||||
logic.checkNext(state.phoneOrEmailController);
|
logic.checkNext(state.phoneOrEmailController);
|
||||||
},
|
},
|
||||||
leftWidget: Padding(
|
leftWidget: SizedBox(),
|
||||||
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
|
||||||
),
|
|
||||||
label:
|
label:
|
||||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${state.isIphoneType.value ? "手机号".tr : TranslationLoader.lanKeys!.email!.tr}",
|
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${state.isIphoneType.value ? "手机号".tr : TranslationLoader.lanKeys!.email!.tr}",
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
@ -155,9 +153,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
|||||||
logic.checkNext(state.pwdController);
|
logic.checkNext(state.pwdController);
|
||||||
},
|
},
|
||||||
isPwd: true,
|
isPwd: true,
|
||||||
leftWidget: Padding(
|
leftWidget: SizedBox(),
|
||||||
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
|
||||||
),
|
|
||||||
label:
|
label:
|
||||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
@ -174,9 +170,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
|||||||
logic.checkNext(state.sureController);
|
logic.checkNext(state.sureController);
|
||||||
},
|
},
|
||||||
isPwd: true,
|
isPwd: true,
|
||||||
leftWidget: Padding(
|
leftWidget: SizedBox(),
|
||||||
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
|
||||||
),
|
|
||||||
label:
|
label:
|
||||||
"${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
"${TranslationLoader.lanKeys!.sure!.tr}${TranslationLoader.lanKeys!.password!.tr}",
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
@ -190,9 +184,7 @@ class _StarLockRegisterPageState extends State<StarLockRegisterXHJPage> {
|
|||||||
onchangeAction: (v) {
|
onchangeAction: (v) {
|
||||||
logic.checkNext(state.codeController);
|
logic.checkNext(state.codeController);
|
||||||
},
|
},
|
||||||
leftWidget: Padding(
|
leftWidget: SizedBox(),
|
||||||
padding: EdgeInsets.only(right: 10.w, left: 5.w),
|
|
||||||
),
|
|
||||||
label:
|
label:
|
||||||
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
"${TranslationLoader.lanKeys!.pleaseEnter!.tr}${TranslationLoader.lanKeys!.verificationCode!.tr}",
|
||||||
inputFormatters: [
|
inputFormatters: [
|
||||||
|
|||||||
@ -3,7 +3,9 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||||
|
import 'package:get/get.dart';
|
||||||
import 'package:star_lock/app_settings/app_colors.dart';
|
import 'package:star_lock/app_settings/app_colors.dart';
|
||||||
|
import 'package:star_lock/flavors.dart';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 登录注册页面 input
|
* 登录注册页面 input
|
||||||
@ -55,8 +57,12 @@ class LoginInput extends StatefulWidget {
|
|||||||
class _LoginInputState extends State<LoginInput> {
|
class _LoginInputState extends State<LoginInput> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
return GetPlatform.isAndroid ? androidView() : iosView();
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget androidView() {
|
||||||
bool isPwd = widget.isPwd ?? false;
|
bool isPwd = widget.isPwd ?? false;
|
||||||
String pwd = (widget.controller?.text ?? '').replaceAll(RegExp(r'.'), '*');
|
String pwd = (widget.controller?.text ?? '').replaceAll(RegExp(r'.'), '●');
|
||||||
return Container(
|
return Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border(bottom: BorderSide(width: 0.5.h, color: Colors.grey)),
|
border: Border(bottom: BorderSide(width: 0.5.h, color: Colors.grey)),
|
||||||
@ -64,7 +70,7 @@ class _LoginInputState extends State<LoginInput> {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
widget.isHaveLeftWidget == true
|
widget.isHaveLeftWidget == true
|
||||||
? widget.leftWidget ?? SizedBox()
|
? widget.leftWidget ?? const SizedBox()
|
||||||
: SizedBox(
|
: SizedBox(
|
||||||
width: 20.w,
|
width: 20.w,
|
||||||
height: 40.w,
|
height: 40.w,
|
||||||
@ -117,7 +123,9 @@ class _LoginInputState extends State<LoginInput> {
|
|||||||
),
|
),
|
||||||
if (isPwd)
|
if (isPwd)
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(top: 30.h),
|
padding: EdgeInsets.only(
|
||||||
|
top:
|
||||||
|
F.sw(defaultCall: () => 27.h, xhjCall: () => 39.h)),
|
||||||
child: Text(
|
child: Text(
|
||||||
pwd,
|
pwd,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
@ -135,4 +143,52 @@ class _LoginInputState extends State<LoginInput> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget iosView() {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
TextField(
|
||||||
|
//输入框一行
|
||||||
|
maxLines: 1,
|
||||||
|
controller: widget.controller,
|
||||||
|
focusNode: widget.focusNode,
|
||||||
|
onChanged: widget.onchangeAction,
|
||||||
|
onTap: widget.onTapAction,
|
||||||
|
autofocus: false,
|
||||||
|
inputFormatters: widget.inputFormatters,
|
||||||
|
textInputAction: TextInputAction.next,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
//输入里面输入文字内边距设置
|
||||||
|
contentPadding: const EdgeInsets.only(
|
||||||
|
top: 8.0, left: -10.0, right: -10.0, bottom: 8.0),
|
||||||
|
labelText: widget.label,
|
||||||
|
labelStyle:
|
||||||
|
TextStyle(fontSize: 22.sp, color: AppColors.darkGrayTextColor),
|
||||||
|
hintStyle: TextStyle(fontSize: 22.sp),
|
||||||
|
hintText: widget.hintText,
|
||||||
|
//不需要输入框下划线
|
||||||
|
border: InputBorder.none,
|
||||||
|
suffixIcon: (widget.isSuffixIcon ?? false)
|
||||||
|
? IconButton(
|
||||||
|
icon: const Icon(Icons.clear),
|
||||||
|
onPressed: widget.controller!.clear,
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
//左边图标设置
|
||||||
|
icon: widget.isHaveLeftWidget == true
|
||||||
|
? widget.leftWidget
|
||||||
|
: SizedBox(
|
||||||
|
width: 20.w,
|
||||||
|
height: 40.w,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
obscureText: widget.isPwd ?? false,
|
||||||
|
),
|
||||||
|
Container(
|
||||||
|
height: 0.5.h,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user