Skip to content

Commit 9237ef5

Browse files
committed
fix:modified the style of toast && remote files
1 parent 008ba56 commit 9237ef5

File tree

9 files changed

+96
-280
lines changed

9 files changed

+96
-280
lines changed

lib/components/comp_list.dart

Lines changed: 0 additions & 99 deletions
This file was deleted.

lib/components/disclaimer_msg.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@
55
* Time: 下午9:19
66
* email: zhu.yan@alibaba-inc.com
77
*/
8+
89
import 'package:flutter/material.dart';
910
import 'package:shared_preferences/shared_preferences.dart';
10-
11-
//import 'package:flutter_rookie_book/model/collection_general.dart';
12-
//import 'package:flutter_rookie_book/model/collection_general.dart';
11+
import 'dart:async';
1312

1413
const disclaimerText1 =
1514
'\r\r\r\r\r\r本APP属于个人的非赢利性开源项目,以供开源社区使用,凡本APP转载的所有的文章 、图片、音频、视频文件等资料的版权归版权所有人所有,本APP采用的非本站原创文章及图片等内容无法一一和版权者联系,如果本网所选内容的文章作者及编辑认为其作品不宜上网供大家浏览,或不应无偿使用请及时用电子邮件或电话通知我们,以迅速采取适当措施,避免给双方造成不必要的经济损失。';

lib/components/list_refresh.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* tartget: FlatButton 的示例
88
*/
99
import 'package:flutter/material.dart';
10+
import 'dart:async';
1011

1112
class ListRefresh extends StatefulWidget {
1213
final renderItem;

lib/components/widget_demo.dart

Lines changed: 66 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import '../routers/routers.dart';
99
import '../components/markdown.dart';
1010
import '../model/collection.dart';
1111
import '../widgets/index.dart';
12-
import 'package:fluttertoast/fluttertoast.dart';
1312
import '../event/event_bus.dart';
1413
import '../event/event_model.dart';
1514
import 'dart:core';
@@ -27,8 +26,7 @@ class WidgetDemo extends StatefulWidget {
2726
@required this.contentList,
2827
@required this.codeUrl,
2928
@required this.docUrl,
30-
this.bottomNaviBar
31-
})
29+
this.bottomNaviBar})
3230
: super(key: key);
3331

3432
_WidgetDemoState createState() => _WidgetDemoState();
@@ -40,17 +38,7 @@ class _WidgetDemoState extends State<WidgetDemo> {
4038
var _collectionIcons;
4139
List widgetDemosList = new WidgetDemoList().getDemos();
4240
String _router = '';
43-
44-
void showInSnackBar(String value) {
45-
Fluttertoast.showToast(
46-
msg: value,
47-
toastLength: Toast.LENGTH_SHORT,
48-
gravity: ToastGravity.CENTER,
49-
timeInSecForIos: 1,
50-
backgroundColor: Colors.grey,
51-
textColor: Colors.white);
52-
}
53-
41+
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
5442

5543
List<Widget> _buildContent() {
5644
List<Widget> _list = [
@@ -99,8 +87,8 @@ class _WidgetDemoState extends State<WidgetDemo> {
9987
setState(() {
10088
_hasCollected = false;
10189
});
102-
showInSnackBar('已取消收藏');
103-
90+
_scaffoldKey.currentState
91+
.showSnackBar(SnackBar(content: Text('已取消收藏')));
10492
if (ApplicationEvent.event != null) {
10593
ApplicationEvent.event
10694
.fire(CollectionEvent(widget.title, _router, true));
@@ -124,19 +112,21 @@ class _WidgetDemoState extends State<WidgetDemo> {
124112
.fire(CollectionEvent(widget.title, _router, false));
125113
}
126114

127-
showInSnackBar('收藏成功');
115+
_scaffoldKey.currentState
116+
.showSnackBar(SnackBar(content: Text('收藏成功')));
128117
}
129118
});
130119
}
131120
}
132121

133-
void _selectValue(value){
134-
if(value == 'doc'){
122+
void _selectValue(value) {
123+
if (value == 'doc') {
135124
// _launchURL(widget.docUrl);
136-
Application.router.navigateTo(context, '${Routes.webViewPage}?title=${Uri.encodeComponent(widget.title)} Doc&&url=${Uri.encodeComponent(widget.docUrl)}');
137-
}else if(value =='code'){
138-
Application.router.navigateTo(context, '${Routes.codeView}?filePath=${Uri.encodeComponent(widget.codeUrl)}');
139-
125+
Application.router.navigateTo(context,
126+
'${Routes.webViewPage}?title=${Uri.encodeComponent(widget.title)} Doc&&url=${Uri.encodeComponent(widget.docUrl)}');
127+
} else if (value == 'code') {
128+
Application.router.navigateTo(context,
129+
'${Routes.codeView}?filePath=${Uri.encodeComponent(widget.codeUrl)}');
140130
}
141131
}
142132

@@ -148,57 +138,63 @@ class _WidgetDemoState extends State<WidgetDemo> {
148138
_collectionIcons = Icons.favorite_border;
149139
}
150140
return Scaffold(
151-
appBar: AppBar(
152-
title: Text(widget.title),
153-
actions: <Widget>[
154-
new IconButton(
155-
tooltip: 'goBack home',
156-
onPressed: () {
157-
Navigator.popUntil(context, ModalRoute.withName('/home'));
158-
},
159-
icon: Icon(Icons.home),
160-
),
161-
new IconButton(
162-
tooltip: 'collection',
163-
onPressed: _getCollection,
164-
icon: Icon(_collectionIcons),
165-
),
166-
PopupMenuButton<String>(
167-
onSelected: _selectValue,
168-
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
169-
const PopupMenuItem<String>(
170-
value: 'doc',
171-
child: ListTile(
172-
leading: Icon(Icons.library_books,size: 22.0,),
173-
title: Text('查看文档'),
141+
key: _scaffoldKey,
142+
appBar: AppBar(
143+
title: Text(widget.title),
144+
actions: <Widget>[
145+
new IconButton(
146+
tooltip: 'goBack home',
147+
onPressed: () {
148+
Navigator.popUntil(context, ModalRoute.withName('/home'));
149+
},
150+
icon: Icon(Icons.home),
151+
),
152+
new IconButton(
153+
tooltip: 'collection',
154+
onPressed: _getCollection,
155+
icon: Icon(_collectionIcons),
156+
),
157+
PopupMenuButton<String>(
158+
onSelected: _selectValue,
159+
itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
160+
const PopupMenuItem<String>(
161+
value: 'doc',
162+
child: ListTile(
163+
leading: Icon(
164+
Icons.library_books,
165+
size: 22.0,
166+
),
167+
title: Text('查看文档'),
168+
),
174169
),
175-
),
176-
const PopupMenuDivider(),
177-
const PopupMenuItem<String>(
178-
value: 'code',
179-
child: ListTile(
180-
leading: Icon(Icons.code,size: 22.0,),
181-
title: Text('查看Demo'),
170+
const PopupMenuDivider(),
171+
const PopupMenuItem<String>(
172+
value: 'code',
173+
child: ListTile(
174+
leading: Icon(
175+
Icons.code,
176+
size: 22.0,
177+
),
178+
title: Text('查看Demo'),
179+
),
182180
),
183-
),
184-
],
185-
),
186-
],
187-
),
188-
body: Container(
189-
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0),
190-
child: ListView(
191-
shrinkWrap: true,
192-
padding: const EdgeInsets.all(0.0),
193-
children: <Widget>[
194-
Column(
195-
children: _buildContent(),
181+
],
196182
),
197183
],
198184
),
199-
),
200-
bottomNavigationBar: (widget.bottomNaviBar is Widget) ? widget
201-
.bottomNaviBar : null
202-
);
185+
body: Container(
186+
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 15.0),
187+
child: ListView(
188+
shrinkWrap: true,
189+
padding: const EdgeInsets.all(0.0),
190+
children: <Widget>[
191+
Column(
192+
children: _buildContent(),
193+
),
194+
],
195+
),
196+
),
197+
bottomNavigationBar:
198+
(widget.bottomNaviBar is Widget) ? widget.bottomNaviBar : null);
203199
}
204200
}

lib/generated/i18n.dart

Lines changed: 0 additions & 78 deletions
This file was deleted.

lib/views/fourth_page/page_reveal.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class CircleRevealClipper extends CustomClipper<Rect>{
4646

4747
@override
4848
bool shouldReclip(CustomClipper<Rect> oldClipper) {
49-
// TODO: implement shouldReclip
5049
return true;
5150
}
5251

0 commit comments

Comments
 (0)