|
@@ -1,4 +1,9 @@
|
|
|
import 'package:flutter/material.dart';
|
|
|
+import 'package:flutter_tracker/dio/login_dao.dart';
|
|
|
+import 'package:flutter_tracker/model/config.dart';
|
|
|
+import 'package:flutter_tracker/routes/routes.dart';
|
|
|
+import 'package:flutter_tracker/utils/app_util.dart';
|
|
|
+import 'package:shared_preferences/shared_preferences.dart';
|
|
|
|
|
|
class MinePage extends StatefulWidget {
|
|
|
const MinePage({Key key}) : super(key: key);
|
|
@@ -8,23 +13,194 @@ class MinePage extends StatefulWidget {
|
|
|
}
|
|
|
|
|
|
class _MinePageState extends State<MinePage> {
|
|
|
+ Size get _size => MediaQuery.of(context).size;
|
|
|
+
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
return Scaffold(
|
|
|
- body: Column(
|
|
|
- // mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- // crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
- // verticalDirection: VerticalDirection.down,
|
|
|
- children: [
|
|
|
- Image.asset(
|
|
|
- "assets/images/home.jpg",
|
|
|
- height: 50,
|
|
|
- width: 50,
|
|
|
+ backgroundColor: Color(0xE6E4E4),
|
|
|
+ body: SizedBox(
|
|
|
+ width: _size.width,
|
|
|
+ child: SingleChildScrollView(
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ Container(
|
|
|
+ width: _size.width,
|
|
|
+ color: Colors.blue,
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ const SizedBox(
|
|
|
+ height: 50,
|
|
|
+ ),
|
|
|
+ // Container(
|
|
|
+ // height: 100,
|
|
|
+ // width: 100,
|
|
|
+ // decoration: BoxDecoration(
|
|
|
+ // borderRadius: BorderRadius.circular(50)),
|
|
|
+ // child: Image.asset(
|
|
|
+ // "assets/images/head.jpg",
|
|
|
+ // ),
|
|
|
+ // ),
|
|
|
+
|
|
|
+ const Text(
|
|
|
+ "网小儿",
|
|
|
+ style: TextStyle(fontSize: 25),
|
|
|
+ ),
|
|
|
+ const SizedBox(
|
|
|
+ height: 10,
|
|
|
+ ),
|
|
|
+ const Text("2021-11-25 10:10:10"),
|
|
|
+ const SizedBox(
|
|
|
+ height: 10,
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ const SizedBox(
|
|
|
+ height: 10,
|
|
|
+ ),
|
|
|
+ Image.asset(
|
|
|
+ "assets/images/head.jpg",
|
|
|
+ width: 150,
|
|
|
+ height: 150,
|
|
|
+ ),
|
|
|
+ const SizedBox(
|
|
|
+ height: 10,
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ width: _size.width * 0.9,
|
|
|
+ height: _size.width * 0.4,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: Colors.white,
|
|
|
+ borderRadius: BorderRadius.circular(20)),
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Container(
|
|
|
+ child: Text(
|
|
|
+ "更多",
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 20, fontWeight: FontWeight.bold),
|
|
|
+ ),
|
|
|
+ margin: EdgeInsets.only(left: 10, top: 5),
|
|
|
+ ),
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ Expanded(
|
|
|
+ child: InkWell(
|
|
|
+ onTap: () {
|
|
|
+ goSetting();
|
|
|
+ },
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ SizedBox(
|
|
|
+ height: 10,
|
|
|
+ ),
|
|
|
+ Image.asset("assets/images/setting.png"),
|
|
|
+ const SizedBox(
|
|
|
+ height: 10,
|
|
|
+ ),
|
|
|
+ const Text("设置")
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Expanded(
|
|
|
+ child: InkWell(
|
|
|
+ onTap: () {
|
|
|
+ aboutUs();
|
|
|
+ },
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ SizedBox(
|
|
|
+ height: 10,
|
|
|
+ ),
|
|
|
+ Image.asset("assets/images/about.png"),
|
|
|
+ const SizedBox(
|
|
|
+ height: 10,
|
|
|
+ ),
|
|
|
+ const Text("关于我们")
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ SizedBox(
|
|
|
+ height: 50,
|
|
|
+ ),
|
|
|
+ Container(
|
|
|
+ width: 150,
|
|
|
+ child: InkWell(
|
|
|
+ onTap: () {
|
|
|
+ logout();
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ width: double.infinity,
|
|
|
+ height: 50,
|
|
|
+ padding: EdgeInsets.only(right: 20, left: 20),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ gradient: const LinearGradient(colors: [
|
|
|
+ ThemeColor.loignColor,
|
|
|
+ ThemeColor.loignColor
|
|
|
+ ]),
|
|
|
+ borderRadius: BorderRadius.circular(10),
|
|
|
+ boxShadow: const [
|
|
|
+ BoxShadow(
|
|
|
+ offset: Offset(1.0, 5.0),
|
|
|
+ color: ThemeColor.loignColor,
|
|
|
+ blurRadius: 5.0,
|
|
|
+ )
|
|
|
+ ]),
|
|
|
+ child: const Center(
|
|
|
+ child: Text(
|
|
|
+ "退出登录",
|
|
|
+ style: TextStyle(fontSize: 20, color: Colors.white),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
),
|
|
|
- Text("网小儿"),
|
|
|
- Text("2021-11-25 10:10:10"),
|
|
|
- ],
|
|
|
+ ),
|
|
|
),
|
|
|
);
|
|
|
}
|
|
|
+
|
|
|
+ @override
|
|
|
+ void initState() {
|
|
|
+ super.initState();
|
|
|
+ }
|
|
|
+
|
|
|
+ void getUserInfo(String token) {}
|
|
|
+
|
|
|
+ void logout() async {
|
|
|
+ var sharedPreferences = await SharedPreferences.getInstance();
|
|
|
+ String token = sharedPreferences.getString("token");
|
|
|
+ try {
|
|
|
+ bool logoutResult = await LoginDao.logout(token);
|
|
|
+ if (logoutResult) {
|
|
|
+ AppUtil.buildToast("退出成功!");
|
|
|
+ Navigator.of(context).pushNamed(Routes.loginPage);
|
|
|
+ } else {
|
|
|
+ AppUtil.buildToast("退出异常,检测网络");
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ AppUtil.buildToast("退出异常" + e.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void aboutUs() {
|
|
|
+ AppUtil.buildToast("\"关于我们\"推出中..");
|
|
|
+ }
|
|
|
+
|
|
|
+ void goSetting() {
|
|
|
+ AppUtil.buildToast("\"设置\"推出中..");
|
|
|
+ }
|
|
|
}
|