Flutter 中的按钮--FlatButton

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import 'package:flutter/material.dart';

class InitFlatButton extends StatefulWidget {
final _buttonTitle;
final _buttonRoute;

InitFlatButton(this._buttonTitle, this._buttonRoute);

@override
_InitFlatButtonState createState() => _InitFlatButtonState();
}

class _InitFlatButtonState extends State<InitFlatButton> {
@override
Widget build(BuildContext context) {
return FlatButton(
onPressed: () {
Navigator.pushNamed(context, widget._buttonRoute);
},
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
child: Flex(
direction: Axis.horizontal,
children: <Widget>[
Expanded(
flex: 1,
child: Text(
widget._buttonTitle,
style: TextStyle(color: Colors.white),
),
),
Icon(Icons.keyboard_arrow_right, color: Colors.white),
],
),
);
}
}