261 lines
10 KiB
Dart
261 lines
10 KiB
Dart
import 'package:cargame/dialog/login_out_dialog.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import '../../../common/func.dart';
|
|
import '../../../network/NetworkConfig.dart';
|
|
import 'agreement_page.dart';
|
|
|
|
class SettingPage extends StatefulWidget {
|
|
const SettingPage({super.key});
|
|
|
|
@override
|
|
State<SettingPage> createState() => _SettingPageState();
|
|
}
|
|
|
|
class _SettingPageState extends State<SettingPage> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final size = MediaQuery.of(context).size;
|
|
final h21 = size.width / 17.142857142857;
|
|
final l11 = size.width / 32.727272727272;
|
|
final s7 = size.width / 51.428571428571;
|
|
final h10 = size.width / 36;
|
|
final s6 = size.width / 60;
|
|
final c3 = size.width / 120;
|
|
|
|
return Scaffold(
|
|
backgroundColor: const Color(0xFF17181A),
|
|
body: Column(
|
|
children: [
|
|
Container(
|
|
width: size.width,
|
|
height: l11,
|
|
margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top + h10),
|
|
child: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
Text(
|
|
"设置",
|
|
style: TextStyle(fontSize: s7, color: const Color(0xFFD6D6D7)),
|
|
),
|
|
Positioned(
|
|
left: l11,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
},
|
|
child: Image(
|
|
width: l11,
|
|
height: l11,
|
|
image: const AssetImage('assets/images/btn_fanhui.png'),
|
|
),
|
|
),
|
|
)
|
|
],
|
|
),
|
|
),
|
|
Expanded(
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
///用户协议
|
|
GestureDetector(
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => AgreementPage(
|
|
title: "用户协议",
|
|
url: "${NetworkConfig.configBean?.userAgreement}",
|
|
)),
|
|
);
|
|
},
|
|
child: Container(
|
|
height: h21,
|
|
margin: EdgeInsets.only(top: h10, left: l11, right: l11),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF202530),
|
|
borderRadius: BorderRadius.all(Radius.circular(c3)),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(left: l11),
|
|
child: Text(
|
|
"用户协议",
|
|
style: TextStyle(fontSize: s6, color: Color(0xFFD6D6D7)),
|
|
),
|
|
),
|
|
Expanded(child: Container()),
|
|
Container(
|
|
margin: EdgeInsets.only(right: l11),
|
|
child: Image(
|
|
height: s6,
|
|
image: AssetImage('assets/images/ic_arrow.png'),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
|
|
///隐私政策
|
|
GestureDetector(
|
|
onTap: () {
|
|
Navigator.push(
|
|
context,
|
|
MaterialPageRoute(
|
|
builder: (context) => AgreementPage(
|
|
title: "隐私政策",
|
|
url: "${NetworkConfig.configBean?.privacyAgreement}",
|
|
)),
|
|
);
|
|
},
|
|
child: Container(
|
|
height: h21,
|
|
margin: EdgeInsets.only(top: h10, left: l11, right: l11),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF202530),
|
|
borderRadius: BorderRadius.all(Radius.circular(c3)),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(left: l11),
|
|
child: Text(
|
|
"隐私政策",
|
|
style: TextStyle(fontSize: s6, color: Color(0xFFD6D6D7)),
|
|
),
|
|
),
|
|
Expanded(child: Container()),
|
|
Container(
|
|
margin: EdgeInsets.only(right: l11),
|
|
child: Image(
|
|
height: s6,
|
|
image: AssetImage('assets/images/ic_arrow.png'),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
|
|
///实名认证
|
|
GestureDetector(
|
|
onTap: () {
|
|
Navigator.pushNamed(context, "/RealNamePage");
|
|
},
|
|
child: Container(
|
|
height: h21,
|
|
margin: EdgeInsets.only(top: h10, left: l11, right: l11),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF202530),
|
|
borderRadius: BorderRadius.all(Radius.circular(c3)),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(left: l11),
|
|
child: Text(
|
|
"实名认证",
|
|
style: TextStyle(fontSize: s6, color: Color(0xFFD6D6D7)),
|
|
),
|
|
),
|
|
Expanded(child: Container()),
|
|
Container(
|
|
margin: EdgeInsets.only(right: l11),
|
|
child: Image(
|
|
height: s6,
|
|
image: AssetImage('assets/images/ic_arrow.png'),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
|
|
///退出登录
|
|
GestureDetector(
|
|
onTap: () async {
|
|
FunctionUtil.popDialog(context, LoginOutDialog(
|
|
onTap: () async {
|
|
NetworkConfig.token = "";
|
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
await prefs.setString('token', "");
|
|
Navigator.pushReplacementNamed(context, "/HomePage");
|
|
},
|
|
));
|
|
},
|
|
child: Container(
|
|
height: h21,
|
|
margin: EdgeInsets.only(top: h10, left: l11, right: l11),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF202530),
|
|
borderRadius: BorderRadius.all(Radius.circular(c3)),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(left: l11),
|
|
child: Text(
|
|
"退出登录",
|
|
style: TextStyle(fontSize: s6, color: Color(0xFFD6D6D7)),
|
|
),
|
|
),
|
|
Expanded(child: Container()),
|
|
Container(
|
|
margin: EdgeInsets.only(right: l11),
|
|
child: Image(
|
|
height: s6,
|
|
image: AssetImage('assets/images/ic_arrow.png'),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
|
|
///关于
|
|
GestureDetector(
|
|
onTap: () {
|
|
Navigator.pushNamed(context, "/AboutPage");
|
|
},
|
|
child: Container(
|
|
height: h21,
|
|
margin: EdgeInsets.only(top: h10, left: l11, right: l11),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF202530),
|
|
borderRadius: BorderRadius.all(Radius.circular(c3)),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.only(left: l11),
|
|
child: Text(
|
|
"关于",
|
|
style: TextStyle(fontSize: s6, color: Color(0xFFD6D6D7)),
|
|
),
|
|
),
|
|
Expanded(child: Container()),
|
|
Container(
|
|
margin: EdgeInsets.only(right: l11),
|
|
child: Image(
|
|
height: s6,
|
|
image: AssetImage('assets/images/ic_arrow.png'),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|