Skip to content

Commit

Permalink
添加退出登录功能
Browse files Browse the repository at this point in the history
  • Loading branch information
simplezhli committed Jul 23, 2019
1 parent e89179c commit 2a7ac27
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

<img src="preview/logo.jpg"/>

本项目为学习Flutter的练习项目(要为UI练习)。
本项目为学习Flutter的练习项目(主要为UI练习)。

通过设置、修改、组合自带部件以及自定义来实现具体的设计效果,满足日常开发的需求。

本项目设计图见design目录,你可以通过我提供的设计图有目标的去练习。有更好的实现方案欢迎交流
本项目设计图见design目录,你可以通过我提供的设计图有目标的去练习。所有的实现仅是个人的学习理解,如果有更好的实现方案欢迎交流

## 预览

Expand Down
35 changes: 35 additions & 0 deletions lib/setting/exit_dialog.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@

import 'package:flutter/material.dart';
import 'package:flutter_deer/login/login_router.dart';
import 'package:flutter_deer/res/styles.dart';
import 'package:flutter_deer/routers/fluro_navigator.dart';
import 'package:flutter_deer/widgets/base_dialog.dart';

class ExitDialog extends StatefulWidget{

ExitDialog({
Key key,
}) : super(key : key);

@override
_ExitDialog createState() => _ExitDialog();

}

class _ExitDialog extends State<ExitDialog>{

@override
Widget build(BuildContext context) {
return BaseDialog(
title: "提示",
height: 160.0,
child: Padding(
padding: const EdgeInsets.only(left: 16.0, top: 8.0, right: 16.0),
child: Text("您确定要退出登录吗?", style: TextStyles.textDark16),
),
onPressed: (){
NavigatorUtils.push(context, LoginRouter.loginPage, clearStack: true);
},
);
}
}
9 changes: 8 additions & 1 deletion lib/setting/setting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:flutter_deer/util/toast.dart';
import 'package:flutter_deer/widgets/app_bar.dart';
import 'package:flutter_deer/widgets/click_item.dart';

import 'exit_dialog.dart';
import 'setting_router.dart';

class SettingPage extends StatefulWidget {
Expand Down Expand Up @@ -48,7 +49,13 @@ class _SettingPageState extends State<SettingPage> {
),
ClickItem(
title: "退出当前账号",
onTap: (){}
onTap: (){
showDialog(
context: context,
barrierDismissible: false,
builder: (_) => ExitDialog()
);
}
),
],
),
Expand Down

0 comments on commit 2a7ac27

Please sign in to comment.