From 57306599824c1d95967446685a58fdf852e4e637 Mon Sep 17 00:00:00 2001 From: JingChiang Date: Tue, 3 Sep 2024 14:38:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E5=AF=86=E7=A2=BC?= =?UTF-8?q?=E8=BC=B8=E5=85=A5=E5=8C=A1=E9=A1=AF=E7=A4=BA=E5=8E=9F=E6=96=87?= =?UTF-8?q?=E6=8C=89=E9=88=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index 287f71d..2907ff4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -19,6 +19,7 @@ class LoginPage extends StatefulWidget {//ful會改變 class _LoginPageState extends State { final TextEditingController _emailController = TextEditingController(); final TextEditingController _ageController = TextEditingController(); + bool _passwordNotVisible = true; @override void initState() {//初始化 @@ -116,9 +117,21 @@ class _LoginPageState extends State { decoration: InputDecoration( border: OutlineInputBorder(), prefixIcon: Icon(Icons.lock_outlined), + suffixIcon: IconButton( + icon: Icon(_passwordNotVisible + ? Icons.visibility + : Icons.visibility_off), + onPressed: () { + setState( + () { + _passwordNotVisible = !_passwordNotVisible; + }, + ); + }, + ), labelText: '密碼', ), - obscureText: true, + obscureText: _passwordNotVisible, ),//密碼 SizedBox(height: 20), ElevatedButton(