update: 规范

This commit is contained in:
sanfan.hx
2019-02-19 17:24:16 +08:00
parent 45b408aa83
commit 161c40ea3c
9 changed files with 104 additions and 101 deletions

View File

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

View File

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

View File

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

View File

@ -1,14 +1,12 @@
/// Created with Android Studio. /// Created with Android Studio.
/// User: 三帆 /// User: 三帆
/// Date: 27/12/2018 /// Date: 27/12/2018
/// Time: 17:30 /// Time: 17:30
/// email: sanfan.hx@alibaba-inc.com /// email: sanfan.hx@alibaba-inc.com
/// target: xxx /// target: xxx
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class SwitchDemo extends StatefulWidget { class SwitchDemo extends StatefulWidget {
_Demo createState() => _Demo(); _Demo createState() => _Demo();
} }

View File

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

View File

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

View File

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

View File

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

View File

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