mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-06-01 14:58:50 +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,
|
||||
|
Reference in New Issue
Block a user