今天的控件是button。
-------------------------------------------分隔分隔-------------------------------------
RaisedButton
import 'package:flutter/material.dart';
void main() => runApp(MyButton());
/**
* Key key,
*@required VoidCallback onPressed, //点击回调事件
*ValueChanged<bool> onHighlightChanged,//水波纹高亮变化回调
*ButtonTextTheme textTheme,//按钮样式(文字颜色、按钮大小,内边距,shape)
*Color textColor,//文字颜色
*Color disabledTextColor,//按钮被禁用时文字颜色
*Color color,//按钮颜色
*Color disabledColor,//按钮被禁用时颜色
*Color focusColor,
*Color hoverColor,
*Color highlightColor,//按钮水波纹亮起颜色
*Color splashColor,
*Brightness colorBrightness,
*double elevation,
*double focusElevation,
*double hoverElevation,
*double highlightElevation,
*double disabledElevation,
*EdgeInsetsGeometry padding,
*ShapeBorder shape,
*Clip clipBehavior,
*FocusNode focusNode,
*bool autofocus = false,
*MaterialTapTargetSize materialTapTargetSize,
*Duration animationDuration,
*Widget child,
*/
class MyButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return MaterialApp(
title: "my button",
home: Scaffold(
body: Center(
child: RaisedButton(
onPressed: () {
print("点我干嘛");
},
child: Text("我是按钮,点我吧"),
color: Colors.deepOrange,
highlightColor: Colors.lightBlueAccent,
),
),
),
);
}
}
IconButton
带图标的按钮
import 'package:flutter/material.dart';
void main() => runApp(MyButton());
class MyButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return MaterialApp(
title: "my button",
home: Scaffold(
body: Center(
child: IconButton(
icon: Icon(
Icons.adjust,
),
color: Colors.deepOrange,
onPressed: () {},
iconSize: 30,
)),
),
);
}
}