前提
皆様、日頃アドバイスしていただきありがとうございます。
今回はFlutterのラジオボタンを勉強していて、つまづいたので質問させていたきました。
実現したいこと
しかし、ラジオボタンを押しても選択モードになりません。
サイトを参考にしながらソースを書いているのですが、ラジオボタンが押しても変化がありません。
なぜなんでしょうか。
エラー等は出ていません。
該当のソースコード
Dart
1import 'package:flutter/material.dart'; 2 3class Store extends StatefulWidget { 4 const Store({Key? key}); 5 6 State<Store> createState() => _Store(); 7} 8 9class _Store extends State<Store> { 10 String _flag = ''; 11 void _handleRadioButton(String flag) => setState(() { 12 _flag = flag; 13 }); 14 15 16 Widget build(BuildContext context) { 17 return Scaffold( 18 body: Center( 19 child: Column( 20 children: [ 21 Container( 22 child: Column( 23 children: [ 24 Row( 25 children: <Widget>[ 26 Radio( 27 activeColor: Colors.blueAccent, 28 value: '1', 29 groupValue: _flag, 30 onChanged: (value) => _handleRadioButton), 31 ], 32 ) 33 ], 34 ), 35 ) 36 ], 37 ), 38 ), 39 ); 40 } 41} 42
補足情報(FW/ツールのバージョンなど)
[✓] Flutter (Channel stable, 3.3.9, on macOS 13.1 22C65 darwin-arm, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.73.0)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/12/30 07:24