145 lines
4.5 KiB
Dart
145 lines
4.5 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 h50 = size.width / 7.2;
|
|
final s16 = size.width / 22.5;
|
|
final l14 = size.width / 25.71428571428571;
|
|
final w19 = size.width / 18.94736842105263;
|
|
final h26 = size.width / 13.84615384615385;
|
|
final w57 = size.width / 6.315789473684211;
|
|
final t18 = size.width / 20;
|
|
final t13 = size.width / 27.692307692307;
|
|
final s11 = size.width / 32.727272727272;
|
|
|
|
return Scaffold(
|
|
backgroundColor: const Color(0xFF17181A),
|
|
body: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
Column(
|
|
children: [
|
|
Container(
|
|
width: size.width,
|
|
height: h50,
|
|
margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
|
|
child: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
Text(
|
|
"关于我们",
|
|
style: TextStyle(fontSize: s16, color: Color(0xFFD6D6D7)),
|
|
),
|
|
Positioned(
|
|
left: l14,
|
|
child: GestureDetector(
|
|
onTap: () {
|
|
Navigator.pop(context);
|
|
},
|
|
child: Image(
|
|
width: w19,
|
|
height: h26,
|
|
image: AssetImage('assets/images/btn_fanhui.png'),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Container(
|
|
width: w57,
|
|
height: w57,
|
|
margin: EdgeInsets.only(top: t18),
|
|
child: ClipRRect(
|
|
borderRadius: BorderRadius.all(Radius.circular(s11)),
|
|
child: Image(
|
|
image: AssetImage('assets/images/ic_launcher.png'),
|
|
),
|
|
),
|
|
),
|
|
Container(
|
|
margin: EdgeInsets.only(top: t18),
|
|
child: Text(
|
|
"当前版本:${NetworkConfig.Version}",
|
|
style: TextStyle(fontSize: t13, 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),
|
|
)),
|
|
)),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|