- Flutterやろうよ!!! 2
354 :デフォルトの名無しさん (ワッチョイ 1701-Y+72)[]:2021/04/18(日) 22:32:00.04 ID:iFUCsnCg0 - >>344
>プロパティ変更もあるけど、痛いのはVisible制御がないってことだよね 試したけど、一応こんな書き方(※)でいける。 bool _busyState = false; void _execFunc() async { setState(() { _busyState = true; } ); // 何か時間のかかる処理 setState(() { _busyState = false; } ); } Widget build(BuildContext context) { // 中略 child: Column( children: <Widget>[ Text(_busyState ? "処理中":"今は何も実行してまへん"), if(_busyState) CircularProgressIndicator(), ElevatedButton( label: const Text('処理実行'), onPressed: _execFunc, ), ], ), // 中略 } ※ CircularProgressIndicator()直前のif()でウイジットの表示/非表示の制御。 ちなみにelse節は書けない(書くとエラー)。 またif() の後に { } も使えない。 Dartの言語仕様が場当たり的で一貫性がない。
| - Flutterやろうよ!!! 2
356 :デフォルトの名無しさん (ワッチョイ 1701-pvza)[]:2021/04/18(日) 22:42:56.26 ID:iFUCsnCg0 - >>355
if(busy==false) Text("暇だよ〜!"), if(busy==true) CircularProgressIndicator(), とか。 あとは、Widget を返すメンバ関数を定義して、関数を渡すか。 とにかく言語仕様に一貫性がなさ過ぎ。
| - Flutterやろうよ!!! 2
357 :デフォルトの名無しさん (ワッチョイ 1701-pvza)[]:2021/04/18(日) 22:49:51.27 ID:iFUCsnCg0 - >>353
それな。 仕様上はデフォルト[8]の余白があるはずだけど、たぶんバグだと思う。 とりあえず、 MaterialStateProperty<EdgeInsetsGeometry> padding = (Platform.isWindows) ? MaterialStateProperty.all(EdgeInsets.all(20)) // テキスト周囲の余白(Windows) : MaterialStateProperty.all(EdgeInsets.only(left:8,right:8)); // テキスト周囲の余白(Windows以外) ElevatedButton( child: Text("HogeHoge"), onPressed: () {}, style: ButtonStyle( padding: padding, ), ), とかやって逃げてる。
| - Flutterやろうよ!!! 2
359 :デフォルトの名無しさん (ワッチョイ 1701-pvza)[]:2021/04/18(日) 23:00:32.60 ID:iFUCsnCg0 - >>358
Widget _returnBody() { if(_mode) return Container(); else return Column( children: <Widget>[ // 中略 ]); } Widget build(BuildContext context) { // 中略 child: _returnBody, // 中略 } でよいのでは?
| - Flutterやろうよ!!! 2
361 :デフォルトの名無しさん (ワッチョイ 1701-pvza)[]:2021/04/18(日) 23:17:44.68 ID:iFUCsnCg0 - > できそうでできないことが多くて結構ストレス溜まる
わかります。 マクロ(定義済みマクロ)がないんで、Flutter SDKやDart SDKの どのバージョンでビルドしたかとか、ソースファイルの日付(タイムスタンプ)を プログラム中で表示(確認)する方法がないかとか悩んでます。 外部プログラムでflutter doctorの出力をパースして、埋込用リソースファイル を逐次書き換えるとかしなきゃならんとか?
|
|