Flutter/UI/Scaffold
上部バーの右にボタンを設置
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("$widget.title"),
actions: _buildAppBarActionButton()
),
);
}
List<Widget> _buildAppBarActionButton() {
return <Widget>[
MaterialButton(
onPressed: () {
},
child: Text(
"Setting",
style: TextStyle(
fontSize: 14.0,
color: Colors.white
),
),
)
];
}
iconを右上に設定したい場合
flutter/アイコン追加 [ショートカット]
List<Widget> _buildAppBarActionButton() {
return <Widget>[
MaterialButton(
onPressed: () {
},
child: Icon(
Icons.settings,
color: Colors.white,
size: 30.0,
)
)
];
}