Merge pull request #149 from hanxu317317/develop

解决返回首页报错的问题 & 关闭欢迎界面
This commit is contained in:
hanxu317317
2019-02-20 11:02:48 +08:00
committed by GitHub
13 changed files with 129 additions and 120 deletions

View File

@ -145,7 +145,7 @@ class _WidgetDemoState extends State<WidgetDemo> {
new IconButton(
tooltip: 'goBack home',
onPressed: () {
Navigator.popUntil(context, ModalRoute.withName('/home'));
Navigator.popUntil(context, ModalRoute.withName('/'));
},
icon: Icon(Icons.home),
),

View File

@ -21,12 +21,14 @@ class MyApp extends StatelessWidget {
Application.router = router;
}
showWelcomePage() {
bool showWelcome = sp.getBool(SharedPreferencesKeys.showWelcome);
if (showWelcome == null || showWelcome == true) {
return WelcomePage();
} else {
return AppPage();
}
// 暂时关掉欢迎介绍
return AppPage();
// bool showWelcome = sp.getBool(SharedPreferencesKeys.showWelcome);
// if (showWelcome == null || showWelcome == true) {
// return WelcomePage();
// } else {
// return AppPage();
// }
}
@override
Widget build(BuildContext context) {

View File

@ -1,15 +1,17 @@
//
// Created with Android Studio.
// User: 三帆
// Date: 18/02/2019
// Time: 14:19
// email: sanfan.hx@alibaba-inc.com
// tartget: xxx
//
///
/// Created with Android Studio.
/// User: 三帆
/// Date: 18/02/2019
/// Time: 14:19
/// email: sanfan.hx@alibaba-inc.com
/// target: 搜索WidgetDemo中的历史记录model
///
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_go/utils/shared_preferences.dart';
import 'dart:convert';
class SearchHistory {
final String name;
@ -24,7 +26,6 @@ class SearchHistoryList {
static List<SearchHistory> _searchHistoryList = [];
static SearchHistoryList _getInstance(SpUtil sp) {
// print("SearchHistoryList _getInstance ${_searchHistoryList} ${_instance==null}");
if (_instance == null) {
_sp = sp;
String json = sp.get(SharedPreferencesKeys.searchHistory);
@ -49,7 +50,6 @@ class SearchHistoryList {
SearchHistoryList.fromJSON(String jsonData) {
_searchHistoryList = [];
if (jsonData == null) {
return;
}
List jsonList = json.decode(jsonData);
@ -76,7 +76,7 @@ class SearchHistoryList {
print("_searchHistoryList> ${_searchHistoryList.length}");
for (SearchHistory value in _searchHistoryList) {
if (value.name == item.name) {
return ;
return;
}
}
if (_searchHistoryList.length > _count) {

View File

@ -8,15 +8,17 @@
import "package:flutter/material.dart";
import '../../../model/widget.dart';
import 'SliverAppBar/index.dart' as SliverAppBar;
import 'AppBar/index.dart' as AppBar;
import 'BottomAppBar/index.dart' as BottomAppBar;
import 'FlexibleSpaceBar/index.dart' as FlexibleSpaceBar;
import 'ButtonBar/index.dart' as ButtonBar;
import 'FlexibleSpaceBar/index.dart' as FlexibleSpaceBar;
import 'SliverAppBar/index.dart' as SliverAppBar;
import 'SnackBar/index.dart' as SnackBar;
import 'SnackBarAction/index.dart' as SnackBarAction;
import 'TabBar/index.dart' as TabBar;
List<WidgetPoint> widgetPoints = [
WidgetPoint(
name: 'AppBar',

View File

@ -1,83 +1,92 @@
/// Created with Android Studio.
/// User: 三帆
/// Date: 20/12/2018
/// Time: 17:51
/// email: sanfan.hx@alibaba-inc.com
/// target: xxx
/// Created with Android Studio.
/// User: 三帆
/// Date: 20/12/2018
/// Time: 17:51
/// email: sanfan.hx@alibaba-inc.com
/// target: xxx
import 'package:flutter/material.dart';
class SliderDemo extends StatefulWidget {
_Demo createState() => _Demo();
}
class _Demo extends State<SliderDemo> {
double value = 0.0;
Widget build(BuildContext context) {
return Slider(
value: value,//实际进度的位置
inactiveColor: Colors.black12,//进度中不活动部分的颜色
return Slider(
value: value,
//实际进度的位置
inactiveColor: Colors.black12,
//进度中不活动部分的颜色
label: 'value: $value',
min: 0.0,
max: 100.0,
divisions: 1000,
activeColor: Colors.blue,//进度中活动部分的颜色
onChanged: (double){
activeColor: Colors.blue,
//进度中活动部分的颜色
onChanged: (double) {
setState(() {
value = double.roundToDouble();
});
},
);
}
}
class SliderThemeDemo extends StatefulWidget {
_SliderThemeDemo createState() => _SliderThemeDemo();
}
class _SliderThemeDemo extends State<SliderThemeDemo> {
double value = 0.0;
Widget build(BuildContext context) {
return Container(
child: SliderTheme(
return Container(
child: SliderTheme(
data: SliderTheme.of(context).copyWith(
// activeTickMarkColor:Colors.yellowAccent,
activeTrackColor: Colors.yellowAccent,//实际进度的颜色
activeTrackColor: Colors.yellowAccent,
//实际进度的颜色
// inactiveTickMarkColor:Colors.black
thumbColor: Colors.black,//滑块中心的颜色
inactiveTrackColor:Colors.red,//默 认进度条的颜色
valueIndicatorColor: Colors.blue,//提示进度的气派的背景色
valueIndicatorTextStyle: TextStyle(//提示气泡里面文字的样式
thumbColor: Colors.black,
//滑块中心的颜色
inactiveTrackColor: Colors.red,
//默 认进度条的颜色
valueIndicatorColor: Colors.blue,
//提示进度的气派的背景色
valueIndicatorTextStyle: TextStyle(
//提示气泡里面文字的样式
color: Colors.white,
),
inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色
overlayColor: Colors.pink,//滑块边缘颜色
inactiveTickMarkColor: Colors.blue,
//divisions对进度线分割后 断续线中间间隔的颜色
overlayColor: Colors.pink, //滑块边缘颜色
),
child: Container(
child: Container(
width: 340.0,
margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0),
child: Row(
child: Row(
children: <Widget>[
Text('0.0'),
Expanded(
Text('0.0'),
Expanded(
flex: 1,
child: Slider(
child: Slider(
value: value,
label: '$value',
divisions: 10,
onChanged: (double){
onChanged: (double) {
setState(() {
value=double.floorToDouble();//转化成double
value = double.floorToDouble(); //转化成double
});
},
min: 0.0,
max: 100.0,
),
),
Text('100.0'),
Text('100.0'),
],
),
),

View File

@ -1,9 +1,9 @@
/// Created with Android Studio.
/// User: 三帆
/// Date: 20/12/2018
/// Time: 17:43
/// email: sanfan.hx@alibaba-inc.com
/// target: xxx
/// Created with Android Studio.
/// User: 三帆
/// Date: 20/12/2018
/// Time: 17:43
/// email: sanfan.hx@alibaba-inc.com
/// target: xxx
import 'package:flutter/material.dart';

View File

@ -1,13 +1,14 @@
/// Created with Android Studio.
/// User: 三帆
/// Date: 28/12/2018
/// Time: 19:54
/// email: sanfan.hx@alibaba-inc.com
/// target: xxx
/// Created with Android Studio.
/// User: 三帆
/// Date: 28/12/2018
/// Time: 19:54
/// email: sanfan.hx@alibaba-inc.com
/// target: xxx
import 'package:flutter/material.dart';
import 'package:flutter_go/components/widget_demo.dart';
import 'demo.dart';
const contentA = '''
@ -24,22 +25,18 @@ const contentA = '''
''';
class Demo extends StatefulWidget {
static const String routeName = 'elements/Form/Switch/AnimatedSwitcher';
_Demo createState() => _Demo();
}
class _Demo extends State<Demo> {
Widget build(BuildContext context) {
return WidgetDemo(
title: 'SwitchListTile',
codeUrl: 'elements/Form/Switch/AnimatedSwitcher/demo.dart',
contentList: [
contentA,
AnimatedSwitcherDemo()
],
contentList: [contentA, AnimatedSwitcherDemo()],
docUrl: '',
);
}

View File

@ -1,9 +1,9 @@
/// Created with Android Studio.
/// User: 三帆
/// Date: 27/12/2018
/// Time: 17:30
/// email: sanfan.hx@alibaba-inc.com
/// target: xxx
/// Created with Android Studio.
/// User: 三帆
/// Date: 27/12/2018
/// Time: 17:30
/// email: sanfan.hx@alibaba-inc.com
/// target: xxx
import 'package:flutter/material.dart';

View File

@ -1,9 +1,9 @@
/// Created with Android Studio.
/// User: 三帆
/// Date: 20/12/2018
/// Time: 17:43
/// email: sanfan.hx@alibaba-inc.com
/// target: xxx
/// Created with Android Studio.
/// User: 三帆
/// Date: 20/12/2018
/// Time: 17:43
/// email: sanfan.hx@alibaba-inc.com
/// target: xxx
import 'package:flutter/material.dart';

View File

@ -1,9 +1,9 @@
/// Created with Android Studio.
/// User: 三帆
/// Date: 14/01/2019
/// Time: 19:02
/// email: sanfan.hx@alibaba-inc.com
/// target: xxx
/// Created with Android Studio.
/// User: 三帆
/// Date: 14/01/2019
/// Time: 19:02
/// email: sanfan.hx@alibaba-inc.com
/// target: xxx
import 'package:flutter/material.dart';

View File

@ -1,9 +1,9 @@
/// Created with Android Studio.
/// User: 三帆
/// Date: 20/01/2019
/// Time: 22:28
/// email: sanfan.hx@alibaba-inc.com
/// target: CupertinoTabBar
/// Created with Android Studio.
/// User: 三帆
/// Date: 20/01/2019
/// Time: 22:28
/// email: sanfan.hx@alibaba-inc.com
/// target: CupertinoTabBar
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';

View File

@ -3,18 +3,20 @@
/// Date: 20/01/2019
/// Time: 22:28
/// email: sanfan.hx@alibaba-inc.com
/// target: CupertinoTabBar
/// target: CupertionTabBar
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class CupertinoTimerPickerDemo extends StatefulWidget {
_Demo createState() => _Demo();
}
class _Demo extends State<CupertinoTimerPickerDemo> {
int index = 0;
Duration timer = Duration(minutes: 50);
Duration timer = Duration(minutes: 50);
Widget _buildBottomPicker(Widget picker) {
return Container(
@ -37,23 +39,24 @@ class _Demo extends State<CupertinoTimerPickerDemo> {
),
);
}
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
showCupertinoModalPopup<void>(
context: context,
builder: (BuildContext context) {
return _buildBottomPicker(CupertinoTimerPicker(
initialTimerDuration: timer,
minuteInterval: 5,
onTimerDurationChanged: (Duration newTimer) {
setState(() => timer = newTimer);
},
));
},
);
},
child: Text("点我弹出"),
return GestureDetector(
onTap: () {
showCupertinoModalPopup<void>(
context: context,
builder: (BuildContext context) {
return _buildBottomPicker(CupertinoTimerPicker(
initialTimerDuration: timer,
minuteInterval: 5,
onTimerDurationChanged: (Duration newTimer) {
setState(() => timer = newTimer);
},
));
},
);
},
child: Text("点我弹出"),
);
}
}
}

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter_go/components/widget_demo.dart';
import 'demo.dart';
@ -27,7 +26,6 @@ const Text0 = '''
''';
class Demo extends StatefulWidget {
static const String routeName =
'/element/themes/Cupertino/CupertinoTimerPicker';
@ -42,11 +40,9 @@ class _DemoState extends State<Demo> {
return WidgetDemo(
title: 'CupertinoTimerPicker',
codeUrl: 'themes/Cupertino/CupertinoTimerPicker/demo.dart',
docUrl: 'https://docs.flutter.io/flutter/cupertino/CupertinoTimerPicker-class.html',
contentList: [
Text0,
CupertinoTimerPickerDemo()
],
docUrl:
'https://docs.flutter.io/flutter/cupertino/CupertinoTimerPicker-class.html',
contentList: [Text0, CupertinoTimerPickerDemo()],
);
}
}