返回鍵

This commit is contained in:
kuei
2024-09-26 21:36:40 +08:00
parent ed40d6633d
commit 087242dcea

View File

@@ -322,40 +322,30 @@ class _BasicInfoPageState extends State<BasicInfoPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
/*appBar: AppBar(
title: Text('基本資料'),
backgroundColor: Color(0xFFE0D0A9),
),*/
body: Column(
children: [
Container(
height: 100,
color: Color(0xFFF5E3C3),
width: double.infinity,
padding: EdgeInsets.all(10.0),
/* child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, // 將返回鍵與標題分開
children: [
IconButton(
icon: Icon(Icons.arrow_back, color: Colors.black, size: 24),
onPressed: () {
Navigator.pop(context, true); // 返回上一頁
},
),
Text(
'基本資料',
style: TextStyle(fontSize: 24, height: 5),
),
],
),
),*/
child: Center(
child: Text(
'基本資料',
style: TextStyle(fontSize: 24, height: 5),
),
),
),
padding: EdgeInsets.only(left: 0.0, top: 50.0), // 調整左右和底部的間距
child:
ListTile(
contentPadding: EdgeInsets.zero, // 移除 ListTile 內的預設 padding
leading: IconButton(
icon: Icon(Icons.arrow_back_outlined, size: 28),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PersonalInfo(email: widget.email), // 修正語法錯誤
),
);
},
),title: Text('基本資料', style: TextStyle(fontSize: 28)),
onTap: () {
},
),),
Expanded(
child: ListView(
padding: EdgeInsets.all(16),
@@ -494,60 +484,86 @@ class _AccountPageState extends State<AccountPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('帳號設定'),
backgroundColor: Color(0xFFE0D0A9),
),
body: ListView(
padding: EdgeInsets.all(16),
children: [ListTile(
title: Text('電子信箱'),
subtitle: _isEditing
? TextField(
controller: _emailController,
)
: Text(_emailController.text),
),
Divider(),
ListTile(
title: Text('密碼'),
subtitle: _isEditing
? TextField(
controller: _passwordController,
obscureText: _passwordNotVisible,
decoration: InputDecoration(
suffixIcon: IconButton(
icon: Icon(_passwordNotVisible ? Icons.visibility : Icons.visibility_off),
onPressed: () {
setState(() {
_passwordNotVisible = !_passwordNotVisible;
});
},
),
body: Column(
children: [
Container(
height: 100,
color: Color(0xFFF5E3C3),
width: double.infinity,
padding: EdgeInsets.only(left: 0.0, top: 50.0), // 調整左右和底部的間距
child:
ListTile(
contentPadding: EdgeInsets.zero, // 移除 ListTile 內的預設 padding
leading: IconButton(
icon: Icon(Icons.arrow_back_outlined, size: 28),
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PersonalInfo(email: widget.email), // 修正語法錯誤
),
);
},
),
)
: Text(_passwordController.text),
),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
if (_isEditing) {
_saveChanges();
}
else {
_toggleEdit();
}
},
child: Text(_isEditing ? '儲存變更' : '修改資料'),
style: TextButton.styleFrom(
backgroundColor: Color(0xFFF5E3C3),
textStyle: TextStyle(fontSize: 18),
shadowColor: Colors.transparent,
title: Text('帳號設定', style: TextStyle(fontSize: 28)),
onTap: () {
},
),
),
),
],
Expanded(
child: ListView(
padding: EdgeInsets.all(16),
children: [
ListTile(
title: Text('電子信箱'),
subtitle: _isEditing
? TextField(
controller: _emailController,
)
: Text(_emailController.text),
),
Divider(),
ListTile(
title: Text('密碼'),
subtitle: _isEditing
? TextField(
controller: _passwordController,
obscureText: _passwordNotVisible,
decoration: InputDecoration(
suffixIcon: IconButton(
icon: Icon(_passwordNotVisible ? Icons.visibility : Icons.visibility_off),
onPressed: () {
setState(() {
_passwordNotVisible = !_passwordNotVisible;
});
},
),
),
)
: Text(_passwordController.text),
),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
if (_isEditing) {
_saveChanges();
}
else {
_toggleEdit();
}
},
child: Text(_isEditing ? '儲存變更' : '修改資料'),
style: TextButton.styleFrom(
backgroundColor: Color(0xFFF5E3C3),
textStyle: TextStyle(fontSize: 18),
shadowColor: Colors.transparent,
),
),
],
),
),
],
),
);
}
}
}