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.
/// 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';
import 'package:flutter_go/components/widget_demo.dart';

View File

@ -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<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,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();
}

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';
import 'package:flutter_go/components/widget_demo.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';

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()],
);
}
}