Skip to content

Commit ee5f54b

Browse files
committed
drawer ui
1 parent 1f63ee2 commit ee5f54b

File tree

7 files changed

+146
-85
lines changed

7 files changed

+146
-85
lines changed

RECORD.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,6 @@ Dialog中,没使用Scaffold ,导致文本有黄色溢出线提示,可以
4343

4444
### 热更新
4545

46-
hotload很有优势。
46+
hotload很有优势。
47+
48+
热更新的新包如果包含了原生代码,需要停止后重新运行哦。

lib/common/utils/CommonUtils.dart

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import 'package:gsy_github_app_flutter/widget/GSYFlexButton.dart';
1111
import 'package:gsy_github_app_flutter/widget/IssueEditDIalog.dart';
1212
import 'package:flutter_spinkit/flutter_spinkit.dart';
1313
import 'package:url_launcher/url_launcher.dart';
14+
import 'package:flutter_statusbar/flutter_statusbar.dart';
1415

1516
/**
1617
* 通用逻辑
@@ -28,6 +29,12 @@ class CommonUtils {
2829

2930
static final double DAYS_LIMIT = 30 * HOURS_LIMIT;
3031

32+
static double sStaticBarHeight = 0.0;
33+
34+
static void initStatusBarHeight() async {
35+
sStaticBarHeight = await FlutterStatusbar.height;
36+
}
37+
3138
static String getDateStr(DateTime date) {
3239
if (date == null || date.toString() == null) {
3340
return "";

lib/page/UserProfilePage.dart

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import 'package:flutter/material.dart';
2+
3+
/**
4+
* Created by guoshuyu
5+
* Date: 2018-08-08
6+
*/
7+
8+
class UserProfile extends StatefulWidget {
9+
@override
10+
_UserProfileState createState() => _UserProfileState();
11+
}
12+
13+
class _UserProfileState extends State<UserProfile> {
14+
15+
_renderList() {
16+
return [
17+
18+
];
19+
}
20+
21+
@override
22+
Widget build(BuildContext context) {
23+
return new Container(
24+
color: Colors.white,
25+
child: new SingleChildScrollView(
26+
child: new Column(
27+
children: _renderList(),
28+
),
29+
),
30+
);
31+
}
32+
}

lib/page/WelcomePage.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
44
import 'package:flutter_redux/flutter_redux.dart';
55
import 'package:gsy_github_app_flutter/common/dao/UserDao.dart';
66
import 'package:gsy_github_app_flutter/common/redux/GSYState.dart';
7+
import 'package:gsy_github_app_flutter/common/utils/CommonUtils.dart';
78
import 'package:gsy_github_app_flutter/common/utils/NavigatorUtils.dart';
89
import 'package:redux/redux.dart';
910

@@ -18,6 +19,7 @@ class WelcomePage extends StatelessWidget {
1819
@override
1920
Widget build(BuildContext context) {
2021
Store<GSYState> store = StoreProvider.of(context);
22+
CommonUtils.initStatusBarHeight();
2123
new Future.delayed(const Duration(seconds: 2), () {
2224
UserDao.initUserInfo(store).then((res) {
2325
if (res != null && res.result) {

lib/widget/HomeDrawer.dart

Lines changed: 94 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -39,92 +39,102 @@ class HomeDrawer extends StatelessWidget {
3939
User user = store.state.userInfo;
4040
return new Drawer(
4141
//侧边栏按钮Drawer
42-
child: new ListView(
43-
children: <Widget>[
44-
new UserAccountsDrawerHeader(
45-
//Material内置控件
46-
accountName: new Text(
47-
user.login ?? "---",
48-
style: GSYConstant.largeTextWhite,
49-
),
50-
accountEmail: new Text(
51-
user.email ?? user.name ?? "---",
52-
style: GSYConstant.subNormalText,
53-
),
54-
//用户名
55-
//用户邮箱
56-
currentAccountPicture: new GestureDetector(
57-
//用户头像
58-
onTap: () {},
59-
child: new CircleAvatar(
60-
//圆形图标控件
61-
backgroundImage: new NetworkImage(user.avatar_url ?? GSYICons.DEFAULT_REMOTE_PIC),
62-
),
63-
),
64-
decoration: new BoxDecoration(
65-
//用一个BoxDecoration装饰器提供背景图片
66-
color: Color(GSYColors.primaryValue),
42+
child: new Container(
43+
color: Color(GSYColors.primaryValue),
44+
child: new SingleChildScrollView(
45+
child: new Container(
46+
height: MediaQuery.of(context).size.height,
47+
color: Color(GSYColors.white),
48+
child: new Column(
49+
children: <Widget>[
50+
new UserAccountsDrawerHeader(
51+
//Material内置控件
52+
accountName: new Text(
53+
user.login ?? "---",
54+
style: GSYConstant.largeTextWhite,
55+
),
56+
accountEmail: new Text(
57+
user.email ?? user.name ?? "---",
58+
style: GSYConstant.subNormalText,
59+
),
60+
//用户名
61+
//用户邮箱
62+
currentAccountPicture: new GestureDetector(
63+
//用户头像
64+
onTap: () {},
65+
child: new CircleAvatar(
66+
//圆形图标控件
67+
backgroundImage: new NetworkImage(user.avatar_url ?? GSYICons.DEFAULT_REMOTE_PIC),
68+
),
69+
),
70+
decoration: new BoxDecoration(
71+
//用一个BoxDecoration装饰器提供背景图片
72+
color: Color(GSYColors.primaryValue),
73+
),
74+
),
75+
new ListTile(
76+
title: new Text(
77+
GSYStrings.home_reply,
78+
style: GSYConstant.normalText,
79+
),
80+
onTap: () {
81+
String content = "";
82+
CommonUtils.showEditDialog(context, GSYStrings.home_reply, (title) {}, (res) {
83+
content = res;
84+
}, () {
85+
if (content == null || content.length == 0) {
86+
return;
87+
}
88+
CommonUtils.showLoadingDialog(context);
89+
IssueDao
90+
.createIssueDao("CarGuo", "GSYGithubAppFlutter", {"title": GSYStrings.home_reply, "body": content}).then((result) {
91+
Navigator.pop(context);
92+
Navigator.pop(context);
93+
});
94+
}, titleController: new TextEditingController(), valueController: new TextEditingController(), needTitle: false);
95+
}),
96+
new ListTile(
97+
title: new Text(
98+
GSYStrings.home_history,
99+
style: GSYConstant.normalText,
100+
),
101+
onTap: () {
102+
NavigatorUtils.gotoCommonList(context, GSYStrings.home_history, "repository", "history", userName: "", reposName: "");
103+
}),
104+
new ListTile(
105+
title: new Text(
106+
GSYStrings.home_check_update,
107+
style: GSYConstant.normalText,
108+
),
109+
onTap: () {
110+
ReposDao.getNewsVersion(context, true);
111+
}),
112+
new ListTile(
113+
title: new Text(
114+
GSYStrings.home_about,
115+
style: GSYConstant.normalText,
116+
),
117+
onTap: () {
118+
GetVersion.projectVersion.then((value) {
119+
showAboutDialog(context, value);
120+
});
121+
}),
122+
new ListTile(
123+
title: new GSYFlexButton(
124+
text: GSYStrings.Login_out,
125+
color: Colors.redAccent,
126+
textColor: Color(GSYColors.textWhite),
127+
onPress: () {
128+
UserDao.clearAll(store);
129+
EventDao.clearEvent(store);
130+
NavigatorUtils.goLogin(context);
131+
},
132+
),
133+
onTap: () {}),
134+
],
67135
),
68136
),
69-
new ListTile(
70-
title: new Text(
71-
GSYStrings.home_reply,
72-
style: GSYConstant.normalText,
73-
),
74-
onTap: () {
75-
String content = "";
76-
CommonUtils.showEditDialog(context, GSYStrings.home_reply, (title) {}, (res) {
77-
content = res;
78-
}, () {
79-
if (content == null || content.length == 0) {
80-
return;
81-
}
82-
CommonUtils.showLoadingDialog(context);
83-
IssueDao.createIssueDao("CarGuo", "GSYGithubAppFlutter", {"title": GSYStrings.home_reply, "body": content}).then((result) {
84-
Navigator.pop(context);
85-
Navigator.pop(context);
86-
});
87-
}, titleController: new TextEditingController(), valueController: new TextEditingController(), needTitle: false);
88-
}),
89-
new ListTile(
90-
title: new Text(
91-
GSYStrings.home_history,
92-
style: GSYConstant.normalText,
93-
),
94-
onTap: () {
95-
NavigatorUtils.gotoCommonList(context, GSYStrings.home_history, "repository", "history", userName: "", reposName: "");
96-
}),
97-
new ListTile(
98-
title: new Text(
99-
GSYStrings.home_check_update,
100-
style: GSYConstant.normalText,
101-
),
102-
onTap: () {
103-
ReposDao.getNewsVersion(context, true);
104-
}),
105-
new ListTile(
106-
title: new Text(
107-
GSYStrings.home_about,
108-
style: GSYConstant.normalText,
109-
),
110-
onTap: () {
111-
GetVersion.projectVersion.then((value) {
112-
showAboutDialog(context, value);
113-
});
114-
}),
115-
new ListTile(
116-
title: new GSYFlexButton(
117-
text: GSYStrings.Login_out,
118-
color: Colors.redAccent,
119-
textColor: Color(GSYColors.textWhite),
120-
onPress: () {
121-
UserDao.clearAll(store);
122-
EventDao.clearEvent(store);
123-
NavigatorUtils.goLogin(context);
124-
},
125-
),
126-
onTap: () {}),
127-
],
137+
),
128138
),
129139
);
130140
},

pubspec.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,13 @@ packages:
188188
url: "https://pub.flutter-io.cn"
189189
source: hosted
190190
version: "2.0.1"
191+
flutter_statusbar:
192+
dependency: "direct main"
193+
description:
194+
name: flutter_statusbar
195+
url: "https://pub.flutter-io.cn"
196+
source: hosted
197+
version: "0.0.1"
191198
flutter_webview_plugin:
192199
dependency: "direct main"
193200
description:

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ dependencies:
2323
flutter_webview_plugin: ^0.1.6
2424
sqflite: ^0.11.0+5
2525
pub_semver: ^1.4.2
26+
flutter_statusbar: ^0.0.1
2627

2728
dev_dependencies:
2829
build_runner: ^0.7.6

0 commit comments

Comments
 (0)