「Flutter/UI」の版間の差分
ナビゲーションに移動
検索に移動
ページの作成:「==body内に複数行textを表示== body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[...」 |
|||
| 38行目: | 38行目: | ||
), | ), | ||
), | ), | ||
==画面右下にボタンを表示== | |||
floatingActionButtonをScaffoldの項目に追加 | |||
return Scaffold( | |||
appBar: AppBar( | |||
title: Text(widget.title), | |||
), | |||
body: Center( | |||
child: Column( | |||
mainAxisAlignment: MainAxisAlignment.center, | |||
children: <Widget>[ | |||
Text( | |||
'hello', | |||
), | |||
], | |||
), | |||
), | |||
floatingActionButton: FloatingActionButton( | |||
onPressed: _incrementCounter, | |||
tooltip: 'Increment', | |||
child: Icon(Icons.add), | |||
), | |||
); | |||
2019年4月28日 (日) 07:40時点における版
body内に複数行textを表示
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'hello',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.display1,
),
RaisedButton(
child: Text('Back to MyPage 1'),
onPressed: () {
Navigator.pop(context);
},
),
],
),
),
body内にボタンを表示
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'hello',
),
RaisedButton(
child: Text('button1'),
onPressed: () {
// ボタン処理
},
),
],
),
),
画面右下にボタンを表示
floatingActionButtonをScaffoldの項目に追加
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'hello',
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
),
);