FondleTalk/lib/tools/me/setting_page.dart
2024-07-27 13:56:33 +08:00

165 lines
5.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:talk/network/NetworkConfig.dart';
import '../home_page.dart';
import 'agreement_page.dart';
class SettingPage extends StatefulWidget {
const SettingPage({super.key});
@override
State<SettingPage> createState() => _SettingApgeState();
}
class _SettingApgeState extends State<SettingPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xFF121213),
appBar: AppBar(
backgroundColor: Color(0xFF121213),
scrolledUnderElevation: 0.0,
title: Text(
'设置',
style: TextStyle(fontSize: 16, color: Colors.white),
),
centerTitle: true,
leading: IconButton(
iconSize: 18,
icon: Icon(Icons.arrow_back_ios_sharp),
color: Colors.white,
onPressed: () {
// 处理返回操作
Navigator.pop(context);
},
),
),
body: Container(
margin: EdgeInsets.symmetric(horizontal: 16),
padding: EdgeInsets.all(21),
decoration: BoxDecoration(color: Color(0xFF202020), borderRadius: BorderRadius.all(Radius.circular(7))),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.pushNamed(context, '/AboutPage');
},
child: SizedBox(
height: 50,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'关于',
style: TextStyle(fontSize: 13, color: Colors.white),
),
Icon(
Icons.keyboard_arrow_right,
color: Color(0xFF6F6F6F),
),
],
),
),
),
Container(
height: 0.33,
color: Color(0xFF3A3A3A),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AgreementPage(
title: "用户协议",
url: "https://shhuanmeng.com/yonghuxieyi.html",
)),
);
},
child: Container(
height: 50,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'用户协议',
style: TextStyle(fontSize: 13, color: Colors.white),
),
Icon(
Icons.keyboard_arrow_right,
color: Color(0xFF6F6F6F),
),
],
),
),
),
Container(
height: 0.33,
color: Color(0xFF3A3A3A),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AgreementPage(
title: "隐私协议",
url: "https://shhuanmeng.com/yinsixieyi.html",
)),
);
},
child: Container(
height: 50,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'隐私协议',
style: TextStyle(fontSize: 13, color: Colors.white),
),
Icon(
Icons.keyboard_arrow_right,
color: Color(0xFF6F6F6F),
),
],
),
),
),
GestureDetector(
onTap: () async {
final SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString('token', "");
NetworkConfig.userId = "";
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (context) => const HomePage()),
(Route<dynamic> route) => false,
);
},
child: Container(
width: 221,
height: 37,
alignment: Alignment.center,
margin: EdgeInsets.only(top: 40),
decoration: BoxDecoration(
color: Color(0xFFFF9000),
borderRadius: BorderRadius.all(Radius.circular(7.0)),
),
child: Text(
'退出登录',
style: TextStyle(fontSize: 13, color: Colors.black),
),
),
)
],
),
),
);
}
}