こいつを使うと「じーざす」らしい、、 てか、そもそもの「TextEditController 」がなぜ必要なのかも理解が出来ていなかった けれど何となくわかってきたonPress等のイベントで値を参照したい時に使うものっぽい
こんなものをいちいち定義しなければいけのかな、、
Flutter StateNotifierProvider と 比較した Riverpod 雑多スクラップ
[Flutter] Textfieldウィジェット - 今回のブログポストではFlutterでユーザの入力をもらえるTextfieldウィジェットを使う方法について説明します。
formを使わない時の話? 過渡期なので、これといって纏まったものが無い気がする
値を参照したいのなら、クラスインスタンスで宣言したモデル( freezed)を参照すれば良いのでは?と思ったが、 こいつはプロバイダ経由しないで更新できるのか?
▼元ネタ TextFormFieldで普通の入力フォームを作る – Flutter – ごろつきめも https://blog.shg25.com/?p=283
child: Form( //フォームを定義 key: this._formKey, child: ListView( children: [ TextFormField( //フィールド decoration: InputDecoration(labelText: '氏名', border: OutlineInputBorder()), validator: _requiredValidator(context), maxLength: 12, //maxLengthを設定すると文字数が右下に表示される maxLengthEnforced: true, //設定した文字数を超えて入力することが不可となる focusNode: _nameFocusNode, onSaved: (String value) => this._data.name = value, //処理全体が保存されるタイミングで呼び出される autofocus: true, // focus可能 textInputAction: TextInputAction.next, // キーボードの決定ボタンを「次へ」へ変更 onFieldSubmitted: (_) => FocusScope.of(context).requestFocus(_descriptionFocusNode), ), SizedBox(height: 16.0), TextFormField( decoration: InputDecoration( labelText: '自己紹介', border: OutlineInputBorder()), validator: _requiredValidator(context), maxLength: 60, maxLengthEnforced: true, focusNode: _descriptionFocusNode, onSaved: (String value) => this._data.description = value, // 複数行対応 keyboardType: TextInputType.multiline, maxLines: null, ), SizedBox(height: 32.0), RaisedButton(child: Text('Submit'), onPressed: this._submit) ], ), )),
Hooks_Riverpod+StateNotifier+Drift(旧Moor)+freezedで簡単なTodoアプリを作ってみよう! https://zenn.dev/antman/books/7767fc7ada0338