Skip to content

Commit 1ffe0b3

Browse files
committed
feat: 评论 第三方库tab
1 parent 29d4a5f commit 1ffe0b3

File tree

5 files changed

+71
-2
lines changed

5 files changed

+71
-2
lines changed

lib/page/comment/index.dart

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:efox_flutter/lang/index.dart' show AppLocalizations;
3+
4+
class Index extends StatefulWidget {
5+
@override
6+
_IndexState createState() => _IndexState();
7+
}
8+
9+
class _IndexState extends State<Index> {
10+
@override
11+
Widget build(BuildContext context) {
12+
return Scaffold(
13+
appBar: AppBar(
14+
elevation: 0,
15+
centerTitle: true,
16+
title: Text(
17+
AppLocalizations.$t('title_comment')
18+
),
19+
),
20+
body: Center(
21+
child: Text('评论'),
22+
),
23+
);
24+
}
25+
}

lib/page/home.dart

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import 'package:efox_flutter/config/theme.dart' show AppTheme;
55
import 'component/tabs.dart' as TabIndex;
66
import 'mine/index.dart' as MyIndex;
77
import 'app_login/index.dart' as LoginIndex;
8+
import 'comment/index.dart' as CommentIndex;
9+
import 'library/index.dart' as LibraryIndex;
810

911
import 'package:efox_flutter/store/index.dart' show Store, UserModel;
1012

@@ -34,10 +36,17 @@ class _IndexState extends State<Index> {
3436
shape: CircularNotchedRectangle(),
3537
clipBehavior: Clip.antiAlias,
3638
child: BottomNavigationBar(
39+
type: BottomNavigationBarType.fixed,
3740
items: <BottomNavigationBarItem>[
3841
BottomNavigationBarItem(
3942
title: Text(AppLocalizations.$t('title_component')),
4043
icon: Icon(Icons.dashboard)),
44+
BottomNavigationBarItem(
45+
title: Text(AppLocalizations.$t('title_comment')),
46+
icon: Icon(Icons.comment)),
47+
BottomNavigationBarItem(
48+
title: Text(AppLocalizations.$t('title_library')),
49+
icon: Icon(Icons.library_add)),
4150
BottomNavigationBarItem(
4251
title: Text(AppLocalizations.$t('title_my')),
4352
icon: Icon(Icons.person_outline)),
@@ -127,7 +136,7 @@ class _IndexState extends State<Index> {
127136
);
128137
}
129138

130-
Widget _floatingActionButton() {
139+
Widget _floatingActionButton(context) {
131140
return Store.connect<UserModel>(
132141
builder: (context, child, model) {
133142
return FloatingActionButton(
@@ -146,6 +155,10 @@ class _IndexState extends State<Index> {
146155
}
147156
)
148157
);
158+
} else {
159+
Scaffold.of(context).showSnackBar(SnackBar(
160+
content: Text('已star'),
161+
));
149162
}
150163
}
151164
},
@@ -175,7 +188,7 @@ class _IndexState extends State<Index> {
175188
drawer: renderDrawer(),
176189
bottomNavigationBar: _bottomNavigationBar(),
177190
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
178-
floatingActionButton: _floatingActionButton(),
191+
floatingActionButton: _floatingActionButton(context),
179192
body: PageView(
180193
controller: _pageController,
181194
physics: NeverScrollableScrollPhysics(),
@@ -186,6 +199,8 @@ class _IndexState extends State<Index> {
186199
},
187200
children: <Widget>[
188201
TabIndex.Index(),
202+
CommentIndex.Index(),
203+
LibraryIndex.Index(),
189204
MyIndex.Index(),
190205
],
191206
),

lib/page/library/index.dart

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:efox_flutter/lang/index.dart' show AppLocalizations;
3+
4+
class Index extends StatefulWidget {
5+
@override
6+
_IndexState createState() => _IndexState();
7+
}
8+
9+
class _IndexState extends State<Index> {
10+
@override
11+
Widget build(BuildContext context) {
12+
return Scaffold(
13+
appBar: AppBar(
14+
elevation: 0,
15+
centerTitle: true,
16+
title: Text(
17+
AppLocalizations.$t('title_library')
18+
),
19+
),
20+
body: Center(
21+
child: Text('第三方库'),
22+
),
23+
);
24+
}
25+
}

locale/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"title_component": "Components",
33
"title_my": "My",
4+
"title_comment": "comment",
5+
"title_library": "library",
46
"common": {
57
"login": "Sign In",
68
"logout": "Logout"

locale/zh.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"title_component": "组件",
33
"title_my": "我的",
4+
"title_comment": "评论",
5+
"title_library": "第三方库",
46
"common": {
57
"login": "登录",
68
"logout": "退出"

0 commit comments

Comments
 (0)