84 lines
3.2 KiB
Dart
84 lines
3.2 KiB
Dart
import 'package:fengshui_compass/pages/personal_page.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
import '../bottom_navigation_widget.dart';
|
|
import '../utils/navigator_utils.dart';
|
|
import '../utils/token_helper.dart';
|
|
|
|
// 用户未登录页面
|
|
class PersonalLoginPage extends StatefulWidget {
|
|
const PersonalLoginPage({Key key}) : super(key: key);
|
|
|
|
@override
|
|
State<PersonalLoginPage> createState() => _PersonalLoginPageState();
|
|
}
|
|
|
|
class _PersonalLoginPageState extends State<PersonalLoginPage> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
bool isLogin = TokenHelper.getInstance.isLogin;
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text("个人中心"),
|
|
),
|
|
body: Container(
|
|
width: double.infinity,
|
|
child: Column(
|
|
children:[
|
|
Padding(padding: EdgeInsets.only(top: 80)),
|
|
SizedBox(height: 120,child: ClipRRect(borderRadius: BorderRadius.circular(60),child: Image.asset("assets/images/ic_launcher.png"),),),
|
|
Padding(padding: EdgeInsets.only(top: 30)),
|
|
ListTile(
|
|
title: Text("关于我们"),
|
|
trailing: const Icon(Icons.arrow_forward_ios_sharp),
|
|
leading: const Icon(Icons.account_circle),
|
|
onTap: (){},
|
|
),
|
|
ListTile(
|
|
title: Text("退出登陆"),
|
|
trailing: const Icon(Icons.arrow_forward_ios_sharp),
|
|
leading: const Icon(Icons.cancel_rounded),
|
|
onTap: () async {
|
|
bool isExit = await showCupertinoDialog(
|
|
context: context,
|
|
builder: (BuildContext context){
|
|
return CupertinoAlertDialog(
|
|
title: const Text("温馨提示"),
|
|
content: Container(
|
|
padding: EdgeInsets.all(16),
|
|
child: const Text("是否确定退出个人中心?"),
|
|
),
|
|
actions: [
|
|
CupertinoDialogAction(
|
|
child: const Text("取消"),
|
|
onPressed: () {
|
|
Navigator.of(context).pop(false);
|
|
},
|
|
),
|
|
CupertinoDialogAction(
|
|
child: const Text("退出"),
|
|
onPressed: () {
|
|
Navigator.of(context).pop(true);
|
|
},
|
|
),
|
|
],
|
|
);
|
|
});
|
|
|
|
if (isExit) {
|
|
TokenHelper.getInstance.clear();
|
|
Navigator.of(context).push(
|
|
MaterialPageRoute(builder: (context) {
|
|
return BottomNavigationWidget();
|
|
})
|
|
);
|
|
}
|
|
})
|
|
],
|
|
),
|
|
));
|
|
}
|
|
}
|