144 lines
4.4 KiB
Dart
144 lines
4.4 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
import '../../../common/func.dart';
|
|
import '../../../dialog/cancel_dialog.dart';
|
|
import '../../../network/NetworkConfig.dart';
|
|
import '../me_model.dart';
|
|
|
|
class AboutPage extends StatefulWidget {
|
|
const AboutPage({super.key});
|
|
|
|
@override
|
|
State<AboutPage> createState() => _AboutPageState();
|
|
}
|
|
|
|
class _AboutPageState extends State<AboutPage> {
|
|
late StreamSubscription subscription;
|
|
final MeModel _viewModel = MeModel();
|
|
|
|
@override
|
|
void initState() {
|
|
// TODO: implement initState
|
|
super.initState();
|
|
subscription = _viewModel.streamController.stream.listen((event) async {
|
|
String code = event['code'];
|
|
if (code.isNotEmpty) {
|
|
switch (code) {
|
|
case "accountLogOff":
|
|
NetworkConfig.token = "";
|
|
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
|
await prefs.setString('token', "");
|
|
Navigator.pushReplacementNamed(context, "/HomePage");
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
// TODO: implement dispose
|
|
super.dispose();
|
|
subscription.cancel();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final size = MediaQuery.of(context).size;
|
|
final t18 = size.width / 20;
|
|
final l11 = size.width / 32.727272727272;
|
|
final s7 = size.width / 51.428571428571;
|
|
final h10 = size.width / 36;
|
|
final w35 = size.width / 10.285714285714;
|
|
final c2 = size.width / 180;
|
|
final s5 = size.width / 72;
|
|
final t6 = size.width / 60;
|
|
|
|
return Scaffold(
|
|
backgroundColor: const Color(0xFF17181A),
|
|
body: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
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: Color(0xFFD6D6D7)),
|
|
),
|
|
Positioned(
|
|
left: l11,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
},
|
|
child: Image(
|
|
width: l11,
|
|
height: l11,
|
|
image: AssetImage('assets/images/btn_fanhui.png'),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
width: w35,
|
|
height: w35,
|
|
margin: EdgeInsets.only(top: t18),
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.all(Radius.circular(c2)),
|
|
child: Image(
|
|
image: AssetImage('assets/images/ic_launcher.png'),
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(top: t6),
|
|
child: Text(
|
|
"当前版本:${NetworkConfig.Version}",
|
|
style: TextStyle(fontSize: s5, color: Color(0xFF868686)),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
Positioned(
|
|
bottom: 30,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
FunctionUtil.popDialog(context, CancelDialog(
|
|
onTap: () {
|
|
// EasyLoading.show(status: "loading...");
|
|
FunctionUtil.loading();
|
|
_viewModel.accountLogOff();
|
|
},
|
|
));
|
|
},
|
|
child: Container(
|
|
width: 102,
|
|
height: 35,
|
|
alignment: Alignment.center,
|
|
decoration: BoxDecoration(
|
|
color: Color(0xFF074CE7),
|
|
borderRadius: BorderRadius.all(Radius.circular(18)),
|
|
),
|
|
child: Text(
|
|
"注销账号",
|
|
style: TextStyle(color: Colors.white),
|
|
)),
|
|
)),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|