mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-05-31 22:18:48 +08:00
fix:code
This commit is contained in:
@ -17,15 +17,15 @@ var selectItemValue;
|
||||
|
||||
class DropdownButtonDefault extends StatelessWidget {
|
||||
List<DropdownMenuItem> generateItemList() {
|
||||
final List<DropdownMenuItem> items = new List();
|
||||
final DropdownMenuItem item1 = new DropdownMenuItem(
|
||||
value: '张三', child: new Text('张三'));
|
||||
final DropdownMenuItem item2 = new DropdownMenuItem(
|
||||
value: '李四', child: new Text('李四'));
|
||||
final DropdownMenuItem item3 = new DropdownMenuItem(
|
||||
value: '王二', child: new Text('王二'));
|
||||
final DropdownMenuItem item4 = new DropdownMenuItem(
|
||||
value: '麻子', child: new Text('麻子'));
|
||||
final List<DropdownMenuItem> items = List();
|
||||
final DropdownMenuItem item1 = DropdownMenuItem(
|
||||
value: '张三', child: Text('张三'));
|
||||
final DropdownMenuItem item2 = DropdownMenuItem(
|
||||
value: '李四', child: Text('李四'));
|
||||
final DropdownMenuItem item3 = DropdownMenuItem(
|
||||
value: '王二', child: Text('王二'));
|
||||
final DropdownMenuItem item4 = DropdownMenuItem(
|
||||
value: '麻子', child: Text('麻子'));
|
||||
items.add(item1);
|
||||
items.add(item2);
|
||||
items.add(item3);
|
||||
@ -36,7 +36,7 @@ class DropdownButtonDefault extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DropdownButton(
|
||||
hint: new Text('下拉菜单选择一个人名'),
|
||||
hint: Text('下拉菜单选择一个人名'),
|
||||
//设置这个value之后,选中对应位置的item,
|
||||
//再次呼出下拉菜单,会自动定位item位置在当前按钮显示的位置处
|
||||
value: selectItValue,
|
||||
@ -51,54 +51,54 @@ class DropdownButtonDefault extends StatelessWidget {
|
||||
}
|
||||
|
||||
List<DropdownMenuItem> getListData(){
|
||||
List<DropdownMenuItem> items=new List();
|
||||
DropdownMenuItem dropdownMenuItem1=new DropdownMenuItem(
|
||||
child:new Text('1'),
|
||||
List<DropdownMenuItem> items= List();
|
||||
DropdownMenuItem dropdownMenuItem1= DropdownMenuItem(
|
||||
child: Text('1'),
|
||||
value: '1',
|
||||
);
|
||||
items.add(dropdownMenuItem1);
|
||||
DropdownMenuItem dropdownMenuItem2=new DropdownMenuItem(
|
||||
child:new Text('2'),
|
||||
DropdownMenuItem dropdownMenuItem2= DropdownMenuItem(
|
||||
child: Text('2'),
|
||||
value: '2',
|
||||
);
|
||||
items.add(dropdownMenuItem2);
|
||||
DropdownMenuItem dropdownMenuItem3=new DropdownMenuItem(
|
||||
child:new Text('3'),
|
||||
DropdownMenuItem dropdownMenuItem3= DropdownMenuItem(
|
||||
child: Text('3'),
|
||||
value: '3',
|
||||
);
|
||||
items.add(dropdownMenuItem3);
|
||||
DropdownMenuItem dropdownMenuItem4=new DropdownMenuItem(
|
||||
child:new Text('4'),
|
||||
DropdownMenuItem dropdownMenuItem4= DropdownMenuItem(
|
||||
child: Text('4'),
|
||||
value: '4',
|
||||
);
|
||||
items.add(dropdownMenuItem4);
|
||||
DropdownMenuItem dropdownMenuItem5=new DropdownMenuItem(
|
||||
child:new Text('5'),
|
||||
DropdownMenuItem dropdownMenuItem5= DropdownMenuItem(
|
||||
child: Text('5'),
|
||||
value: '5',
|
||||
);
|
||||
items.add(dropdownMenuItem5);
|
||||
DropdownMenuItem dropdownMenuItem6=new DropdownMenuItem(
|
||||
child:new Text('6'),
|
||||
DropdownMenuItem dropdownMenuItem6= DropdownMenuItem(
|
||||
child: Text('6'),
|
||||
value: '6',
|
||||
);
|
||||
items.add(dropdownMenuItem6);
|
||||
DropdownMenuItem dropdownMenuItem7=new DropdownMenuItem(
|
||||
child:new Text('7'),
|
||||
DropdownMenuItem dropdownMenuItem7= DropdownMenuItem(
|
||||
child: Text('7'),
|
||||
value: '7',
|
||||
);
|
||||
items.add(dropdownMenuItem7);
|
||||
DropdownMenuItem dropdownMenuItem8=new DropdownMenuItem(
|
||||
child:new Text('8'),
|
||||
DropdownMenuItem dropdownMenuItem8= DropdownMenuItem(
|
||||
child: Text('8'),
|
||||
value: '8',
|
||||
);
|
||||
items.add(dropdownMenuItem8);
|
||||
DropdownMenuItem dropdownMenuItem9=new DropdownMenuItem(
|
||||
child:new Text('9'),
|
||||
DropdownMenuItem dropdownMenuItem9= DropdownMenuItem(
|
||||
child: Text('9'),
|
||||
value: '9',
|
||||
);
|
||||
items.add(dropdownMenuItem9);
|
||||
DropdownMenuItem dropdownMenuItem10=new DropdownMenuItem(
|
||||
child:new Text('10'),
|
||||
DropdownMenuItem dropdownMenuItem10= DropdownMenuItem(
|
||||
child: Text('10'),
|
||||
value: '10',
|
||||
);
|
||||
items.add(dropdownMenuItem10);
|
||||
|
@ -62,7 +62,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allDropdownButtons(BuildContext context,_DemoState that){
|
||||
return Container(
|
||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
child: Column(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -87,14 +87,14 @@ Widget allDropdownButtons(BuildContext context,_DemoState that){
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt){
|
||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return new Align(
|
||||
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 20.0),
|
||||
MarkdownBody(data: txt)
|
||||
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||
])
|
||||
);
|
||||
}
|
||||
|
@ -101,9 +101,9 @@ class FlatButtonCustom extends StatelessWidget {
|
||||
splashColor: Colors.deepPurple,
|
||||
// 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias
|
||||
clipBehavior: Clip.antiAlias,
|
||||
padding: new EdgeInsets.only(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
||||
shape: (shape is ShapeBorder) ? shape : new Border.all(
|
||||
shape: (shape is ShapeBorder) ? shape : Border.all(
|
||||
// 设置边框样式
|
||||
color: Colors.grey,
|
||||
width: 2.0,
|
||||
|
@ -64,7 +64,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allFlatButtons(BuildContext context){
|
||||
return Container(
|
||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
child: Column(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -109,7 +109,7 @@ Widget allFlatButtons(BuildContext context){
|
||||
flatButton.FlatButtonCustom('危险按钮',Colors.pink),
|
||||
SizedBox(height: 10.0),
|
||||
flatButton.FlatButtonCustom('点击我试试!', Colors.red,
|
||||
new Border.all(color: Colors.brown, width: 5.0, style: BorderStyle.solid),
|
||||
Border.all(color: Colors.brown, width: 5.0, style: BorderStyle.solid),
|
||||
() => _showMessage('点击了 FLAT BUTTON ', context)),
|
||||
SizedBox(height: 20.0)
|
||||
])
|
||||
@ -126,16 +126,16 @@ void _showMessage(String name, BuildContext context) {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: new Text('提示'),
|
||||
content: new Text(name),
|
||||
title: Text('提示'),
|
||||
content: Text(name),
|
||||
actions: <Widget>[
|
||||
new FlatButton(
|
||||
FlatButton(
|
||||
// alert 的取消按钮
|
||||
onPressed: () {
|
||||
// 取消的事件
|
||||
Navigator.of(context).pop(true);
|
||||
},
|
||||
child: new Text('取消'))
|
||||
child: Text('取消'))
|
||||
]);
|
||||
}
|
||||
);
|
||||
@ -145,14 +145,14 @@ void _showMessage(String name, BuildContext context) {
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt){
|
||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return new Align(
|
||||
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 20.0),
|
||||
MarkdownBody(data: txt)
|
||||
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||
])
|
||||
);
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ class FloatingActionButtonCustom extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final _onPressed = onPressed;
|
||||
return new FloatingActionButton(
|
||||
return FloatingActionButton(
|
||||
// 子视图,一般为Icon,不推荐使用文字
|
||||
child: const Icon(Icons.refresh),
|
||||
// FAB的文字解释,FAB被长按时显示,也是无障碍功能
|
||||
@ -109,8 +109,8 @@ class FloatingActionButtonCustom2 extends StatelessWidget {
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: Colors.amber,
|
||||
//如果不手动设置icon和text颜色,则默认使用foregroundColor颜色
|
||||
icon: new Icon(Icons.flag,color: Colors.red),
|
||||
label: new Text('FloatingActionButton.extended', maxLines: 1),
|
||||
icon: Icon(Icons.flag,color: Colors.red),
|
||||
label: Text('FloatingActionButton.extended', maxLines: 1),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class _DemoState extends State<Demo> {
|
||||
Widget allFloatingActionButtons(BuildContext context,_DemoState that){
|
||||
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
||||
return Container(
|
||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
child: Column(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -109,16 +109,16 @@ Widget allFloatingActionButtons(BuildContext context,_DemoState that){
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return AlertDialog(
|
||||
// title: new Text('提示'),
|
||||
// content: new Text(name),
|
||||
// title: Text('提示'),
|
||||
// content: Text(name),
|
||||
// actions: <Widget>[
|
||||
// new FlatButton(
|
||||
// FlatButton(
|
||||
// // alert 的取消按钮
|
||||
// onPressed: () {
|
||||
// // 取消的事件
|
||||
// Navigator.of(context).pop(true);
|
||||
// },
|
||||
// child: new Text('取消'))
|
||||
// child: Text('取消'))
|
||||
// ]);
|
||||
// }
|
||||
// );
|
||||
@ -128,14 +128,14 @@ Widget allFloatingActionButtons(BuildContext context,_DemoState that){
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt){
|
||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return new Align(
|
||||
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 20.0),
|
||||
MarkdownBody(data: txt)
|
||||
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||
])
|
||||
);
|
||||
}
|
||||
@ -159,7 +159,7 @@ ShapeBorder drawShape(String type){
|
||||
break;
|
||||
case 'radius':
|
||||
return RoundedRectangleBorder(
|
||||
side:new BorderSide( // 保留原来的边框样式
|
||||
side: BorderSide( // 保留原来的边框样式
|
||||
width: borderWidth,
|
||||
color: _color,
|
||||
style: BorderStyle.solid,
|
||||
|
@ -75,7 +75,7 @@ class IconButtonCustom extends StatelessWidget {
|
||||
iconSize:(Random.secure().nextInt(20)+20).toDouble(), // 随机大小
|
||||
// 按钮内部,墨汁飞溅的颜色,点击按钮时的渐变背景色,当你不设置高亮背景时才会看的更清楚
|
||||
splashColor: _randomColor(),
|
||||
padding: new EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
||||
padding: EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
||||
// 描述按下按钮时将发生的操作的文本
|
||||
tooltip:'这是${ type.codePoint }信息',
|
||||
// IconButton 的点击事件
|
||||
|
@ -66,7 +66,7 @@ class _DemoState extends State<Demo> {
|
||||
Widget allIconButtons(BuildContext context,_DemoState that){
|
||||
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
||||
return Container(
|
||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
child: Column(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -106,14 +106,14 @@ Widget allIconButtons(BuildContext context,_DemoState that){
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt){
|
||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return new Align(
|
||||
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 20.0),
|
||||
MarkdownBody(data: txt)
|
||||
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||
])
|
||||
);
|
||||
}
|
||||
@ -137,7 +137,7 @@ ShapeBorder drawShape(String type){
|
||||
break;
|
||||
case 'radius':
|
||||
return RoundedRectangleBorder(
|
||||
side:new BorderSide( // 保留原来的边框样式
|
||||
side: BorderSide( // 保留原来的边框样式
|
||||
width: borderWidth,
|
||||
color: _color,
|
||||
style: BorderStyle.solid,
|
||||
|
@ -79,7 +79,7 @@ class OutlineButtonCustom extends StatelessWidget {
|
||||
// 文本内容
|
||||
child: Text(txt, semanticsLabel: 'FLAT BUTTON 2'),
|
||||
// 边框的颜色,颜色也可以走主题色 Theme.of(context).primaryColor
|
||||
borderSide:new BorderSide(color: _randomColor(),width:Random.secure().nextInt(10).toDouble()),
|
||||
borderSide: BorderSide(color: _randomColor(),width:Random.secure().nextInt(10).toDouble()),
|
||||
// 按钮颜色
|
||||
color: _randomColor(),
|
||||
// 按钮失效时边框颜色
|
||||
@ -100,7 +100,7 @@ class OutlineButtonCustom extends StatelessWidget {
|
||||
splashColor: _randomColor(),
|
||||
// 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias
|
||||
clipBehavior: Clip.antiAlias,
|
||||
padding: new EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
||||
padding: EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
||||
//高亮时候的阴影
|
||||
highlightElevation: 10.0,
|
||||
shape: shape, // 在Outline 里只能设置圆角,边框用borderSide
|
||||
|
@ -75,7 +75,7 @@ class _DemoState extends State<Demo> {
|
||||
Widget allOutlineButtons(BuildContext context,_DemoState that){
|
||||
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
||||
return Container(
|
||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
child: Column(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -136,16 +136,16 @@ Widget allOutlineButtons(BuildContext context,_DemoState that){
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return AlertDialog(
|
||||
// title: new Text('提示'),
|
||||
// content: new Text(name),
|
||||
// title: Text('提示'),
|
||||
// content: Text(name),
|
||||
// actions: <Widget>[
|
||||
// new FlatButton(
|
||||
// FlatButton(
|
||||
// // alert 的取消按钮
|
||||
// onPressed: () {
|
||||
// // 取消的事件
|
||||
// Navigator.of(context).pop(true);
|
||||
// },
|
||||
// child: new Text('取消'))
|
||||
// child: Text('取消'))
|
||||
// ]);
|
||||
// }
|
||||
// );
|
||||
@ -155,14 +155,14 @@ Widget allOutlineButtons(BuildContext context,_DemoState that){
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt){
|
||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return new Align(
|
||||
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 20.0),
|
||||
MarkdownBody(data: txt)
|
||||
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||
])
|
||||
);
|
||||
}
|
||||
@ -186,7 +186,7 @@ ShapeBorder drawShape(String type){
|
||||
break;
|
||||
case 'radius':
|
||||
return RoundedRectangleBorder(
|
||||
side:new BorderSide( // 保留原来的边框样式
|
||||
side: BorderSide( // 保留原来的边框样式
|
||||
width: borderWidth,
|
||||
color: _color,
|
||||
style: BorderStyle.solid,
|
||||
|
@ -71,8 +71,8 @@ class PopupMenuButtonDefault extends StatelessWidget {
|
||||
child: Text('点我试试'),
|
||||
onSelected: (String value) {},
|
||||
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
||||
new PopupMenuItem(value: "选项一的内容", child: new Text("选项一")),
|
||||
new PopupMenuItem(value: "选项二的内容", child: new Text("选项二"))
|
||||
PopupMenuItem(value: "选项一的内容", child: Text("选项一")),
|
||||
PopupMenuItem(value: "选项二的内容", child: Text("选项二"))
|
||||
]);
|
||||
}
|
||||
|
||||
@ -82,8 +82,8 @@ class PopupMenuButtonDefault extends StatelessWidget {
|
||||
icon: Icon(Icons.menu),
|
||||
onSelected: (String value) {},
|
||||
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
||||
new PopupMenuItem(value: "选项一的内容", child: new Text("选项一")),
|
||||
new PopupMenuItem(value: "选项二的内容", child: new Text("选项二"))
|
||||
PopupMenuItem(value: "选项一的内容", child: Text("选项一")),
|
||||
PopupMenuItem(value: "选项二的内容", child: Text("选项二"))
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -116,10 +116,10 @@ class PopupMenuButtonCustom extends StatelessWidget {
|
||||
initialValue:selectStr,
|
||||
// 按下按钮时调用以创建要在菜单中显示的项目。
|
||||
itemBuilder: (BuildContext context) => <PopupMenuItem<String>>[
|
||||
new PopupMenuItem(value: "选项一的内容", child: new Text("选项一")),
|
||||
new PopupMenuItem(value: "选项二的内容", child: new Text("选项二")),
|
||||
new PopupMenuItem(value: "选项三的内容", child: new Text("选项三")),
|
||||
new PopupMenuItem(value: "选项四的内容", child: new Text("选项四"))
|
||||
PopupMenuItem(value: "选项一的内容", child: Text("选项一")),
|
||||
PopupMenuItem(value: "选项二的内容", child: Text("选项二")),
|
||||
PopupMenuItem(value: "选项三的内容", child: Text("选项三")),
|
||||
PopupMenuItem(value: "选项四的内容", child: Text("选项四"))
|
||||
],
|
||||
// 应用于弹出菜单按钮的偏移量(x,y)。
|
||||
offset:Offset(0.0,50.0),
|
||||
@ -134,7 +134,7 @@ class PopupMenuButtonCustom extends StatelessWidget {
|
||||
});
|
||||
},
|
||||
// 默认情况下匹配IconButton的8 dps填充。在某些情况下,特别是在此按钮作为列表项的尾随元素出现的情况下,能够将填充设置为零是有用的。
|
||||
padding:new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0.0, right: 0.0),
|
||||
padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0.0, right: 0.0),
|
||||
//描述按下按钮时将发生的操作的文本。
|
||||
tooltip:'这是信息'
|
||||
);
|
||||
|
@ -64,7 +64,7 @@ class _DemoState extends State<Demo> {
|
||||
|
||||
Widget allPopupMenuButton(Demo widget,State parent){
|
||||
return Container(
|
||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
child: Column(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
|
@ -105,10 +105,10 @@ class RaisedButtonCustom extends StatelessWidget {
|
||||
// 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias
|
||||
clipBehavior: Clip.antiAlias,
|
||||
padding:
|
||||
new EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
||||
EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
||||
shape: (shape is ShapeBorder)
|
||||
? shape
|
||||
: new Border.all(
|
||||
: Border.all(
|
||||
// 设置边框样式
|
||||
color: Colors.grey,
|
||||
width: 2.0,
|
||||
|
@ -74,7 +74,7 @@ class _DemoState extends State<Demo> {
|
||||
Widget allRaisedButtons(BuildContext context,_DemoState that){
|
||||
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
||||
return Container(
|
||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
child: Column(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -135,16 +135,16 @@ Widget allRaisedButtons(BuildContext context,_DemoState that){
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return AlertDialog(
|
||||
// title: new Text('提示'),
|
||||
// content: new Text(name),
|
||||
// title: Text('提示'),
|
||||
// content: Text(name),
|
||||
// actions: <Widget>[
|
||||
// new FlatButton(
|
||||
// FlatButton(
|
||||
// // alert 的取消按钮
|
||||
// onPressed: () {
|
||||
// // 取消的事件
|
||||
// Navigator.of(context).pop(true);
|
||||
// },
|
||||
// child: new Text('取消'))
|
||||
// child: Text('取消'))
|
||||
// ]);
|
||||
// }
|
||||
// );
|
||||
@ -154,14 +154,14 @@ Widget allRaisedButtons(BuildContext context,_DemoState that){
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt){
|
||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return new Align(
|
||||
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 20.0),
|
||||
MarkdownBody(data: txt)
|
||||
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||
])
|
||||
);
|
||||
}
|
||||
@ -185,7 +185,7 @@ ShapeBorder drawShape(String type){
|
||||
break;
|
||||
case 'radius':
|
||||
return RoundedRectangleBorder(
|
||||
side:new BorderSide( // 保留原来的边框样式
|
||||
side: BorderSide( // 保留原来的边框样式
|
||||
width: borderWidth,
|
||||
color: _color,
|
||||
style: BorderStyle.solid,
|
||||
|
@ -62,7 +62,7 @@ class RawMaterialButtonCustom extends StatelessWidget {
|
||||
splashColor: _randomColor(),
|
||||
// 抗锯齿能力,抗锯齿等级依次递增,none(默认),hardEdge,antiAliasWithSaveLayer,antiAlias
|
||||
clipBehavior: Clip.antiAlias,
|
||||
padding: new EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
||||
padding: EdgeInsets.only(bottom: 5.0, top: 5.0, left: 30.0, right: 30.0),
|
||||
//高亮时候的阴影
|
||||
highlightElevation: 10.0,
|
||||
// 按钮材质的形状
|
||||
|
@ -64,7 +64,7 @@ class _DemoState extends State<Demo> {
|
||||
Widget allRawMaterialButtons(BuildContext context,_DemoState that){
|
||||
final ShapeBorder buttonShape = drawShape(that.buttonShapeType);
|
||||
return Container(
|
||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
child: Column(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -108,16 +108,16 @@ Widget allRawMaterialButtons(BuildContext context,_DemoState that){
|
||||
// context: context,
|
||||
// builder: (BuildContext context) {
|
||||
// return AlertDialog(
|
||||
// title: new Text('提示'),
|
||||
// content: new Text(name),
|
||||
// title: Text('提示'),
|
||||
// content: Text(name),
|
||||
// actions: <Widget>[
|
||||
// new FlatButton(
|
||||
// FlatButton(
|
||||
// // alert 的取消按钮
|
||||
// onPressed: () {
|
||||
// // 取消的事件
|
||||
// Navigator.of(context).pop(true);
|
||||
// },
|
||||
// child: new Text('取消'))
|
||||
// child: Text('取消'))
|
||||
// ]);
|
||||
// }
|
||||
// );
|
||||
@ -127,14 +127,14 @@ Widget allRawMaterialButtons(BuildContext context,_DemoState that){
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt){
|
||||
//style: new TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return new Align(
|
||||
//style: TextStyle(fontSize: 15.5, height: 1.2),textAlign:TextAlign.left
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 20.0),
|
||||
MarkdownBody(data: txt)
|
||||
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||
])
|
||||
);
|
||||
}
|
||||
@ -158,7 +158,7 @@ ShapeBorder drawShape(String type){
|
||||
break;
|
||||
case 'radius':
|
||||
return RoundedRectangleBorder(
|
||||
side:new BorderSide( // 保留原来的边框样式
|
||||
side: BorderSide( // 保留原来的边框样式
|
||||
width: borderWidth,
|
||||
color: _color,
|
||||
style: BorderStyle.solid,
|
||||
|
@ -59,7 +59,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allCheckboxs(BuildContext context,_DemoState that){
|
||||
return Container(
|
||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
child: Column(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children: <Widget>[
|
||||
@ -97,13 +97,13 @@ Widget allCheckboxs(BuildContext context,_DemoState that){
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt){
|
||||
return new Align(
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(height: 20.0),
|
||||
MarkdownBody(data: txt)
|
||||
//new Text(txt, style: new TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||
// Text(txt, style: TextStyle(fontSize: 15.5,height: 1.2,color:Colors.blue),textAlign:TextAlign.left)
|
||||
])
|
||||
);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class _CheckboxListTileStateDefault extends State {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
new Center(
|
||||
Center(
|
||||
child: CheckboxListTile(
|
||||
value: _value,
|
||||
selected:true,// 默认文字是否高亮
|
||||
@ -48,10 +48,10 @@ class _CheckboxListTileStateDefault extends State {
|
||||
activeColor: Colors.red, // 选中此复选框时要使用的颜色
|
||||
),
|
||||
),
|
||||
new Center(
|
||||
child: new CheckboxListTile(
|
||||
Center(
|
||||
child: CheckboxListTile(
|
||||
value: isChecks[0],
|
||||
title: new Text('选项1'),
|
||||
title: Text('选项1'),
|
||||
activeColor: _value ? Colors.red : Colors.green,
|
||||
controlAffinity: ListTileControlAffinity.platform,
|
||||
onChanged: (bool){
|
||||
@ -60,10 +60,10 @@ class _CheckboxListTileStateDefault extends State {
|
||||
});
|
||||
}),
|
||||
),
|
||||
new Center(
|
||||
child: new CheckboxListTile(
|
||||
Center(
|
||||
child: CheckboxListTile(
|
||||
value: isChecks[1],
|
||||
title: new Text('选项2'),
|
||||
title: Text('选项2'),
|
||||
activeColor: _value ? Colors.red : Colors.green,
|
||||
controlAffinity: ListTileControlAffinity.platform,
|
||||
onChanged: (bool){
|
||||
@ -72,10 +72,10 @@ class _CheckboxListTileStateDefault extends State {
|
||||
});
|
||||
}),
|
||||
),
|
||||
new Center(
|
||||
child: new CheckboxListTile(
|
||||
Center(
|
||||
child: CheckboxListTile(
|
||||
value: isChecks[2],
|
||||
title: new Text('选项3'),
|
||||
title: Text('选项3'),
|
||||
activeColor: _value ? Colors.red : Colors.green,
|
||||
controlAffinity: ListTileControlAffinity.platform,
|
||||
onChanged: (bool){
|
||||
@ -84,10 +84,10 @@ class _CheckboxListTileStateDefault extends State {
|
||||
});
|
||||
}),
|
||||
),
|
||||
new Center(
|
||||
child: new CheckboxListTile(
|
||||
Center(
|
||||
child: CheckboxListTile(
|
||||
value: isChecks[3],
|
||||
title: new Text('选项4'),
|
||||
title: Text('选项4'),
|
||||
activeColor: _value ? Colors.red : Colors.green,
|
||||
controlAffinity: ListTileControlAffinity.platform,
|
||||
onChanged: (bool){
|
||||
|
@ -61,7 +61,7 @@ class _DemoState extends State<Demo> {
|
||||
*/
|
||||
Widget allCheckboxs(BuildContext context, _DemoState that) {
|
||||
return Container(
|
||||
//padding: new EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
//padding: EdgeInsets.only(bottom: 20.0, top: 20.0, left: 0, right: 0),
|
||||
child: Column(
|
||||
//mainAxisSize: MainAxisSize.max,
|
||||
children:[
|
||||
@ -79,7 +79,7 @@ Widget allCheckboxs(BuildContext context, _DemoState that) {
|
||||
* 带align的text
|
||||
* */
|
||||
Widget textAlignBar(String txt) {
|
||||
return new Align(
|
||||
return Align(
|
||||
alignment: FractionalOffset.centerLeft,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
||||
class DefaultTextField extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Container(
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(30.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start, //文本是起始端对齐
|
||||
@ -29,7 +29,7 @@ class CustomTextField extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Container(
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(30.0),
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.number,
|
||||
|
@ -22,27 +22,27 @@ class _Demo extends State<RadioADemo> {
|
||||
}
|
||||
Widget build(BuildContext context) {
|
||||
return (
|
||||
new Container(
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: new Column(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
new Radio(
|
||||
Radio(
|
||||
value: 1,
|
||||
groupValue: groupValue,//当value和groupValue一致的时候则选中
|
||||
onChanged: (T){
|
||||
onChange(T);
|
||||
}
|
||||
),
|
||||
new Radio(
|
||||
Radio(
|
||||
value: 2,
|
||||
groupValue: groupValue,
|
||||
onChanged: (T){
|
||||
onChange(T);
|
||||
}
|
||||
),
|
||||
new Radio(
|
||||
Radio(
|
||||
value: 3,
|
||||
groupValue: groupValue,
|
||||
onChanged: (T){
|
||||
|
@ -25,7 +25,7 @@ const content2 = """
|
||||
# 基本用法
|
||||
|
||||
```
|
||||
new Radio(
|
||||
Radio(
|
||||
value: value,
|
||||
groupValue: groupValue, //当value和groupValue一致的时候则选中
|
||||
onChanged: (T){
|
||||
@ -45,7 +45,7 @@ class _DemoState extends State<Demo> {
|
||||
return WidgetDemo(
|
||||
contentList: [
|
||||
content1,
|
||||
new RadioADemo(),
|
||||
RadioADemo(),
|
||||
content2
|
||||
],
|
||||
title: 'Radio',
|
||||
|
@ -24,7 +24,7 @@ class _Demo extends State<DemoA> {
|
||||
}
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return new Column(
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
RadioListTile<String>(
|
||||
title: const Text('A'),
|
||||
|
@ -45,7 +45,7 @@ class _DemoState extends State<Demo> {
|
||||
return WidgetDemo(
|
||||
contentList: [
|
||||
content1,
|
||||
new DemoA(),
|
||||
DemoA(),
|
||||
content2
|
||||
],
|
||||
title: 'RadioListTile',
|
||||
|
@ -16,7 +16,7 @@ class SliderDemo extends StatefulWidget {
|
||||
class _Demo extends State<SliderDemo> {
|
||||
double value = 0.0;
|
||||
Widget build(BuildContext context) {
|
||||
return new Slider(
|
||||
return Slider(
|
||||
value: value,//实际进度的位置
|
||||
inactiveColor: Colors.black12,//进度中不活动部分的颜色
|
||||
label: 'value: $value',
|
||||
@ -43,8 +43,8 @@ class SliderThemeDemo extends StatefulWidget {
|
||||
class _SliderThemeDemo extends State<SliderThemeDemo> {
|
||||
double value = 0.0;
|
||||
Widget build(BuildContext context) {
|
||||
return new Container(
|
||||
child: new SliderTheme(
|
||||
return Container(
|
||||
child: SliderTheme(
|
||||
data: SliderTheme.of(context).copyWith(
|
||||
// activeTickMarkColor:Colors.yellowAccent,
|
||||
activeTrackColor: Colors.yellowAccent,//实际进度的颜色
|
||||
@ -52,21 +52,21 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
|
||||
thumbColor: Colors.black,//滑块中心的颜色
|
||||
inactiveTrackColor:Colors.red,//默 认进度条的颜色
|
||||
valueIndicatorColor: Colors.blue,//提示进度的气派的背景色
|
||||
valueIndicatorTextStyle: new TextStyle(//提示气泡里面文字的样式
|
||||
valueIndicatorTextStyle: TextStyle(//提示气泡里面文字的样式
|
||||
color: Colors.white,
|
||||
),
|
||||
inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色
|
||||
overlayColor: Colors.pink,//滑块边缘颜色
|
||||
),
|
||||
child: new Container(
|
||||
child: Container(
|
||||
width: 340.0,
|
||||
margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0),
|
||||
child: new Row(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new Text('0.0'),
|
||||
new Expanded(
|
||||
Text('0.0'),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: new Slider(
|
||||
child: Slider(
|
||||
value: value,
|
||||
label: '$value',
|
||||
divisions: 10,
|
||||
@ -79,7 +79,7 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
|
||||
max: 100.0,
|
||||
),
|
||||
),
|
||||
new Text('100.0'),
|
||||
Text('100.0'),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -49,19 +49,19 @@ const contentB = '''
|
||||
如果当前Slider样式 无法满足需求, 可以通过 ** SliderTheme ** 定制复杂样式
|
||||
|
||||
```
|
||||
new SliderTheme(
|
||||
SliderTheme(
|
||||
data: SliderTheme.of(context).copyWith(
|
||||
activeTrackColor: Colors.yellowAccent,//实际进度的颜色
|
||||
inactiveTickMarkColor:Colors.black
|
||||
thumbColor: Colors.black,//滑块中心的颜色
|
||||
inactiveTrackColor:Colors.red,//默 认进度条的颜色
|
||||
valueIndicatorColor: Colors.blue,//提示进度的气派的背景色
|
||||
valueIndicatorTextStyle: new TextStyle(//提示气泡里面文字的样式
|
||||
valueIndicatorTextStyle: TextStyle(//提示气泡里面文字的样式
|
||||
color: Colors.white,
|
||||
),
|
||||
inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色
|
||||
overlayColor: Colors.pink,//滑块边缘颜色
|
||||
child: new Slider()
|
||||
child: Slider()
|
||||
)
|
||||
|
||||
```
|
||||
|
@ -17,8 +17,8 @@ class SliderThemeDemo extends StatefulWidget {
|
||||
class _SliderThemeDemo extends State<SliderThemeDemo> {
|
||||
double value = 0.0;
|
||||
Widget build(BuildContext context) {
|
||||
return new Container(
|
||||
child: new SliderTheme(
|
||||
return Container(
|
||||
child: SliderTheme(
|
||||
data: SliderTheme.of(context).copyWith(
|
||||
// activeTickMarkColor:Colors.yellowAccent,
|
||||
activeTrackColor: Colors.yellowAccent,//实际进度的颜色
|
||||
@ -26,21 +26,21 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
|
||||
thumbColor: Colors.black,//滑块中心的颜色
|
||||
inactiveTrackColor:Colors.red,//默 认进度条的颜色
|
||||
valueIndicatorColor: Colors.blue,//提示进度的气派的背景色
|
||||
valueIndicatorTextStyle: new TextStyle(//提示气泡里面文字的样式
|
||||
valueIndicatorTextStyle: TextStyle(//提示气泡里面文字的样式
|
||||
color: Colors.white,
|
||||
),
|
||||
inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色
|
||||
overlayColor: Colors.pink,//滑块边缘颜色
|
||||
),
|
||||
child: new Container(
|
||||
child: Container(
|
||||
width: 340.0,
|
||||
margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0),
|
||||
child: new Row(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new Text('0.0'),
|
||||
new Expanded(
|
||||
Text('0.0'),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: new Slider(
|
||||
child: Slider(
|
||||
value: value,
|
||||
label: '$value',
|
||||
divisions: 10,
|
||||
@ -53,7 +53,7 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
|
||||
max: 100.0,
|
||||
),
|
||||
),
|
||||
new Text('100.0'),
|
||||
Text('100.0'),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -24,7 +24,7 @@ const contentA = '''
|
||||
基本属性参考以下代码:
|
||||
|
||||
```
|
||||
new SliderTheme(
|
||||
SliderTheme(
|
||||
data: SliderThemeData({
|
||||
@required Color activeTrackColor,
|
||||
@required Color inactiveTrackColor,
|
||||
@ -67,7 +67,7 @@ class _Demo extends State<Demo> {
|
||||
codeUrl: 'elements/Form/Slider/SliderTheme/demo.dart',
|
||||
contentList: [
|
||||
contentA,
|
||||
new SliderThemeDemo(),
|
||||
SliderThemeDemo(),
|
||||
],
|
||||
docUrl: 'https://docs.flutter.io/flutter/material/SliderTheme-class.html',
|
||||
);
|
||||
|
@ -17,8 +17,8 @@ class SliderThemeDemo extends StatefulWidget {
|
||||
class _SliderThemeDemo extends State<SliderThemeDemo> {
|
||||
double value = 0.0;
|
||||
Widget build(BuildContext context) {
|
||||
return new Container(
|
||||
child: new SliderTheme(
|
||||
return Container(
|
||||
child: SliderTheme(
|
||||
data: SliderTheme.of(context).copyWith(
|
||||
// activeTickMarkColor:Colors.yellowAccent,
|
||||
activeTrackColor: Colors.yellowAccent,//实际进度的颜色
|
||||
@ -26,21 +26,21 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
|
||||
thumbColor: Colors.black,//滑块中心的颜色
|
||||
inactiveTrackColor:Colors.red,//默 认进度条的颜色
|
||||
valueIndicatorColor: Colors.blue,//提示进度的气派的背景色
|
||||
valueIndicatorTextStyle: new TextStyle(//提示气泡里面文字的样式
|
||||
valueIndicatorTextStyle: TextStyle(//提示气泡里面文字的样式
|
||||
color: Colors.white,
|
||||
),
|
||||
inactiveTickMarkColor:Colors.blue,//divisions对进度线分割后 断续线中间间隔的颜色
|
||||
overlayColor: Colors.pink,//滑块边缘颜色
|
||||
),
|
||||
child: new Container(
|
||||
child: Container(
|
||||
width: 340.0,
|
||||
margin: EdgeInsets.fromLTRB(0.0, 50.0, 0.0, 0.0),
|
||||
child: new Row(
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
new Text('0.0'),
|
||||
new Expanded(
|
||||
Text('0.0'),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: new Slider(
|
||||
child: Slider(
|
||||
value: value,
|
||||
label: '$value',
|
||||
divisions: 10,
|
||||
@ -53,7 +53,7 @@ class _SliderThemeDemo extends State<SliderThemeDemo> {
|
||||
max: 100.0,
|
||||
),
|
||||
),
|
||||
new Text('100.0'),
|
||||
Text('100.0'),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -63,7 +63,7 @@ class _Demo extends State<Demo> {
|
||||
codeUrl: 'elements/Form/Slider/SliderThemeData/demo.dart',
|
||||
contentList: [
|
||||
contentA,
|
||||
new SliderThemeDemo()
|
||||
SliderThemeDemo()
|
||||
],
|
||||
docUrl: 'https://docs.flutter.io/flutter/material/SliderThemeData-class.html',
|
||||
);
|
||||
|
@ -39,7 +39,7 @@ class _Demo extends State<Demo> {
|
||||
codeUrl: 'elements/Form/Switch/AnimatedSwitcher/demo.dart',
|
||||
contentList: [
|
||||
contentA,
|
||||
new AnimatedSwitcherDemo()
|
||||
AnimatedSwitcherDemo()
|
||||
],
|
||||
docUrl: '',
|
||||
);
|
||||
|
@ -18,7 +18,7 @@ class SwitchDemo extends StatefulWidget {
|
||||
class _Demo extends State<SwitchDemo> {
|
||||
bool check = false;
|
||||
Widget build(BuildContext context) {
|
||||
return new Switch(
|
||||
return Switch(
|
||||
value: this.check,
|
||||
onChanged: (bool val) {
|
||||
this.setState(() {
|
||||
@ -36,7 +36,7 @@ class SwitchHighDemo extends StatefulWidget {
|
||||
class _SwitchHighDemo extends State<SwitchHighDemo> {
|
||||
bool check = false;
|
||||
Widget build(BuildContext context) {
|
||||
return new Switch.adaptive(
|
||||
return Switch.adaptive(
|
||||
value: this.check,
|
||||
activeColor: Colors.blue, // 激活时原点颜色
|
||||
onChanged: (bool val) {
|
||||
@ -56,7 +56,7 @@ class SwitchTypesDemo extends StatefulWidget {
|
||||
class _SwitchTypesDemo extends State<SwitchTypesDemo> {
|
||||
bool check = false;
|
||||
Widget build(BuildContext context) {
|
||||
return new Switch(
|
||||
return Switch(
|
||||
value: this.check,
|
||||
activeTrackColor:Colors.green,
|
||||
inactiveThumbColor: Colors.black,
|
||||
|
@ -19,7 +19,7 @@ const contentA = '''
|
||||
### **基本用法**
|
||||
|
||||
```
|
||||
new Switch(
|
||||
Switch(
|
||||
value: isChecked,
|
||||
activeColor: Colors.blue, // 激活时原点颜色
|
||||
onChanged: (bool val) {
|
||||
|
@ -18,7 +18,7 @@ class SwitchListTileDemo extends StatefulWidget {
|
||||
class _Demo extends State<SwitchListTileDemo> {
|
||||
bool _lights = false;
|
||||
Widget build(BuildContext context) {
|
||||
return new SwitchListTile(
|
||||
return SwitchListTile(
|
||||
title: const Text('Lights'),
|
||||
value: _lights,
|
||||
onChanged: (bool value) { setState(() { _lights = value; }); },
|
||||
|
@ -67,7 +67,7 @@ class _Demo extends State<Demo> {
|
||||
title: 'Rich Text',
|
||||
docUrl: 'https://docs.flutter.io/flutter/widgets/RichText-class.html',
|
||||
codeUrl: '',
|
||||
contentList: [new Column(
|
||||
contentList: [ Column(
|
||||
children: <Widget>[
|
||||
MarkdownBody(data: markDesc['intro']),
|
||||
RichTextDemo(),
|
||||
|
@ -79,7 +79,7 @@ class _Demo extends State<Demo> {
|
||||
title: "Text",
|
||||
docUrl: 'flutter/widgets/Text-class.html',
|
||||
codeUrl: 'elements/Form/Text/Text/index.dart',
|
||||
contentList: [new Column(
|
||||
contentList: [ Column(
|
||||
children: <Widget>[
|
||||
MarkdownBody(markDesc['intro']),
|
||||
Text(
|
||||
|
Reference in New Issue
Block a user