密码显示隐藏

This commit is contained in:
machuanyu 2024-07-17 09:27:17 +08:00
parent 072814972e
commit bb2d3e4740
6 changed files with 63 additions and 38 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 352 B

View File

@ -94,13 +94,12 @@ class _LoginPageState extends State<LoginPage> {
),*/ ),*/
child: Column(children: [ child: Column(children: [
Container( Container(
padding: EdgeInsets.symmetric(horizontal: 20.r), padding: EdgeInsets.symmetric(horizontal: 20.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.transparent, color: Colors.transparent,
border: Border.all(width: 1.w, color: const Color(0xFFFFFFFF)), border: Border.all(width: 1.w, color: const Color(0xFFFFFFFF)),
borderRadius: BorderRadius.all(Radius.circular(17.w)), borderRadius: BorderRadius.all(Radius.circular(17.w)),
), ),
child: Center(
child: TextField( child: TextField(
controller: state.userNameController, controller: state.userNameController,
/* maxLines: 1, /* maxLines: 1,
@ -126,7 +125,12 @@ class _LoginPageState extends State<LoginPage> {
color: Colors.white, color: Colors.white,
), ),
border: InputBorder.none, border: InputBorder.none,
prefix: Padding( isDense: true,
prefixIconConstraints: BoxConstraints(
minHeight:10.w,
minWidth: 10.h,
),
prefixIcon: Padding(
padding: EdgeInsets.only(right: 5.r), padding: EdgeInsets.only(right: 5.r),
child: Image.asset( child: Image.asset(
'assets/images/login_account.png', 'assets/images/login_account.png',
@ -137,13 +141,12 @@ class _LoginPageState extends State<LoginPage> {
), ),
), ),
), ),
),
SizedBox( SizedBox(
height: 15.r, height: 15.r,
), ),
Obx(() { Obx(() {
return Container( return Container(
padding: EdgeInsets.symmetric(horizontal: 20.r), padding: EdgeInsets.symmetric(horizontal: 20.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.transparent, color: Colors.transparent,
border: Border.all(width: 1.w, color: const Color(0xFFFFFFFF)), border: Border.all(width: 1.w, color: const Color(0xFFFFFFFF)),
@ -156,7 +159,7 @@ class _LoginPageState extends State<LoginPage> {
maxLines: 1, maxLines: 1,
obscureText: state.isShowPwd.value, obscureText: state.isShowPwd.value,
// //
textInputAction: TextInputAction.go, // textInputAction: state.isShowPwd.value?TextInputAction.go:TextInputAction.next,
// onSubmitted: (val) => toLogin(), // onSubmitted: (val) => toLogin(),
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
@ -164,7 +167,11 @@ class _LoginPageState extends State<LoginPage> {
), ),
decoration: InputDecoration( decoration: InputDecoration(
hintText: "请输入密码", hintText: "请输入密码",
prefix: Padding( prefixIconConstraints: BoxConstraints(
minHeight:10.w,
minWidth: 10.h,
),
prefixIcon: Padding(
padding: EdgeInsets.only(right: 5.r), padding: EdgeInsets.only(right: 5.r),
child: Image.asset( child: Image.asset(
'assets/images/login_pwd.png', 'assets/images/login_pwd.png',
@ -172,6 +179,23 @@ class _LoginPageState extends State<LoginPage> {
height: 15.r, height: 15.r,
), ),
), ),
suffixIconConstraints: BoxConstraints(
minHeight:10.w,
minWidth: 10.h,
),
suffixIcon: InkWell(
onTap: (){
state.isShowPwd.value = !state.isShowPwd.value;
},
child: Padding(
padding: EdgeInsets.only(right: 5.r),
child: Image.asset(
state.isShowPwd.value ? 'assets/images/eye_default.png':'assets/images/eye_active.png',
width: 15.r,
height: 15.r,
),
),
),
hintStyle: TextStyle( hintStyle: TextStyle(
fontSize: 14.sp, fontSize: 14.sp,
color: Colors.white, color: Colors.white,
@ -203,7 +227,7 @@ class _LoginPageState extends State<LoginPage> {
checkColor: Colors.white, checkColor: Colors.white,
value: state.keepPwd.value, value: state.keepPwd.value,
onChanged: (value) { onChanged: (value) {
Get.focusScope?.nextFocus(); // Get.focusScope?.nextFocus();
FocusScope.of(context).requestFocus( FocusScope.of(context).requestFocus(
state.pwdFocus); state.pwdFocus);
FocusScope.of(context).requestFocus( FocusScope.of(context).requestFocus(

View File

@ -26,7 +26,8 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
FlutterWindow window(project); FlutterWindow window(project);
Win32Window::Point origin(10, 10); Win32Window::Point origin(10, 10);
Win32Window::Size size(1280, 720); // Win32Window::Size size(1280, 720);
Win32Window::Size size(700, 900);
if (!window.Create(L"making_school_asignment_app", origin, size)) { if (!window.Create(L"making_school_asignment_app", origin, size)) {
return EXIT_FAILURE; return EXIT_FAILURE;
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB