diff --git a/lib/widgets/elements/Form/Slider/Slider/demo.dart b/lib/widgets/elements/Form/Slider/Slider/demo.dart index 973a2e15..d2719b40 100644 --- a/lib/widgets/elements/Form/Slider/Slider/demo.dart +++ b/lib/widgets/elements/Form/Slider/Slider/demo.dart @@ -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 { 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 { 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: [ - 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'), ], ), ), diff --git a/lib/widgets/elements/Form/Slider/Slider/index.dart b/lib/widgets/elements/Form/Slider/Slider/index.dart index ab08c6f3..b85c8d4d 100644 --- a/lib/widgets/elements/Form/Slider/Slider/index.dart +++ b/lib/widgets/elements/Form/Slider/Slider/index.dart @@ -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'; import 'package:flutter_go/components/widget_demo.dart'; diff --git a/lib/widgets/elements/Form/Switch/AnimatedSwitcher/index.dart b/lib/widgets/elements/Form/Switch/AnimatedSwitcher/index.dart index 305ba1b6..2a5af985 100644 --- a/lib/widgets/elements/Form/Switch/AnimatedSwitcher/index.dart +++ b/lib/widgets/elements/Form/Switch/AnimatedSwitcher/index.dart @@ -1,12 +1,13 @@ - /// 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 = ''' @@ -23,22 +24,18 @@ const contentA = ''' '''; - class Demo extends StatefulWidget { static const String routeName = 'elements/Form/Switch/AnimatedSwitcher'; + _Demo createState() => _Demo(); } class _Demo extends State { - Widget build(BuildContext context) { return WidgetDemo( title: 'SwitchListTile', codeUrl: 'elements/Form/Switch/AnimatedSwitcher/demo.dart', - contentList: [ - contentA, - AnimatedSwitcherDemo() - ], + contentList: [contentA, AnimatedSwitcherDemo()], docUrl: '', ); } diff --git a/lib/widgets/elements/Form/Switch/Switch/demo.dart b/lib/widgets/elements/Form/Switch/Switch/demo.dart index 24a2c15a..d5de396b 100644 --- a/lib/widgets/elements/Form/Switch/Switch/demo.dart +++ b/lib/widgets/elements/Form/Switch/Switch/demo.dart @@ -1,14 +1,12 @@ - /// 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'; - - class SwitchDemo extends StatefulWidget { _Demo createState() => _Demo(); } diff --git a/lib/widgets/elements/Form/Switch/Switch/index.dart b/lib/widgets/elements/Form/Switch/Switch/index.dart index 02d386f8..17966e66 100644 --- a/lib/widgets/elements/Form/Switch/Switch/index.dart +++ b/lib/widgets/elements/Form/Switch/Switch/index.dart @@ -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'; import 'package:flutter_go/components/widget_demo.dart'; diff --git a/lib/widgets/elements/Form/Text/RichText/demo.dart b/lib/widgets/elements/Form/Text/RichText/demo.dart index 0a10eada..c4f12666 100644 --- a/lib/widgets/elements/Form/Text/RichText/demo.dart +++ b/lib/widgets/elements/Form/Text/RichText/demo.dart @@ -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'; diff --git a/lib/widgets/elements/Form/Text/Text/demo.dart b/lib/widgets/elements/Form/Text/Text/demo.dart index fc565600..623a9088 100644 --- a/lib/widgets/elements/Form/Text/Text/demo.dart +++ b/lib/widgets/elements/Form/Text/Text/demo.dart @@ -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'; diff --git a/lib/widgets/themes/Cupertino/CupertinoTimerPicker/demo.dart b/lib/widgets/themes/Cupertino/CupertinoTimerPicker/demo.dart index e913b3d7..45b24c68 100644 --- a/lib/widgets/themes/Cupertino/CupertinoTimerPicker/demo.dart +++ b/lib/widgets/themes/Cupertino/CupertinoTimerPicker/demo.dart @@ -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 { 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 { ), ); } + Widget build(BuildContext context) { - return GestureDetector( - onTap: () { - showCupertinoModalPopup( - context: context, - builder: (BuildContext context) { - return _buildBottomPicker(CupertinoTimerPicker( - initialTimerDuration: timer, - minuteInterval: 5, - onTimerDurationChanged: (Duration newTimer) { - setState(() => timer = newTimer); - }, - )); - }, - ); - }, - child: Text("点我弹出"), + return GestureDetector( + onTap: () { + showCupertinoModalPopup( + context: context, + builder: (BuildContext context) { + return _buildBottomPicker(CupertinoTimerPicker( + initialTimerDuration: timer, + minuteInterval: 5, + onTimerDurationChanged: (Duration newTimer) { + setState(() => timer = newTimer); + }, + )); + }, + ); + }, + child: Text("点我弹出"), ); } -} \ No newline at end of file +} diff --git a/lib/widgets/themes/Cupertino/CupertinoTimerPicker/index.dart b/lib/widgets/themes/Cupertino/CupertinoTimerPicker/index.dart index 125f4e16..1ca5a07a 100644 --- a/lib/widgets/themes/Cupertino/CupertinoTimerPicker/index.dart +++ b/lib/widgets/themes/Cupertino/CupertinoTimerPicker/index.dart @@ -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 { 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()], ); } }