@@ -69,49 +69,51 @@ class _TalkCreateRoomDialogState extends State<TalkCreateRoomDialog> {
6969
7070 @override
7171 Widget build (BuildContext context) {
72- final body = Column (
73- crossAxisAlignment: CrossAxisAlignment .end,
74- mainAxisSize: MainAxisSize .min,
75- children: [
76- for (final type in [
77- spreed.RoomType .oneToOne,
78- spreed.RoomType .group,
79- spreed.RoomType .public,
80- ])
81- RadioListTile .adaptive (
82- title: Text (TalkLocalizations .of (context).roomType (type.name)),
83- secondary: Icon (
84- // coverage:ignore-start
85- switch (type) {
86- // coverage:ignore-end
87- spreed.RoomType .oneToOne => AdaptiveIcons .person,
88- spreed.RoomType .group => AdaptiveIcons .group,
89- spreed.RoomType .public => AdaptiveIcons .link,
90- _ => throw UnimplementedError ('$type is not a valid type' ), // coverage:ignore-line
91- },
92- ),
93- value: type,
94- groupValue: selectedType,
95- onChanged: changeType,
96- ),
97- const Divider (),
98- switch (selectedType) {
99- spreed.RoomType .oneToOne || spreed.RoomType .group => buildAutocomplete (),
100- spreed.RoomType .public => TextFormField (
101- controller: controller,
102- focusNode: focusNode,
103- validator: (input) => validateNotEmpty (context, input),
104- decoration: InputDecoration (
105- hintText: TalkLocalizations .of (context).roomCreateRoomName,
72+ final body = RadioGroup <spreed.RoomType >(
73+ groupValue: selectedType,
74+ onChanged: changeType,
75+ child: Column (
76+ crossAxisAlignment: CrossAxisAlignment .end,
77+ mainAxisSize: MainAxisSize .min,
78+ children: [
79+ for (final type in [
80+ spreed.RoomType .oneToOne,
81+ spreed.RoomType .group,
82+ spreed.RoomType .public,
83+ ])
84+ RadioListTile .adaptive (
85+ title: Text (TalkLocalizations .of (context).roomType (type.name)),
86+ secondary: Icon (
87+ // coverage:ignore-start
88+ switch (type) {
89+ // coverage:ignore-end
90+ spreed.RoomType .oneToOne => AdaptiveIcons .person,
91+ spreed.RoomType .group => AdaptiveIcons .group,
92+ spreed.RoomType .public => AdaptiveIcons .link,
93+ _ => throw UnimplementedError ('$type is not a valid type' ), // coverage:ignore-line
94+ },
10695 ),
107- onFieldSubmitted: (_) {
108- submit ();
109- },
96+ value: type,
11097 ),
111- null => const SizedBox (),
112- _ => throw StateError ('$selectedType is not a valid type' ), // coverage:ignore-line
113- },
114- ],
98+ const Divider (),
99+ switch (selectedType) {
100+ spreed.RoomType .oneToOne || spreed.RoomType .group => buildAutocomplete (),
101+ spreed.RoomType .public => TextFormField (
102+ controller: controller,
103+ focusNode: focusNode,
104+ validator: (input) => validateNotEmpty (context, input),
105+ decoration: InputDecoration (
106+ hintText: TalkLocalizations .of (context).roomCreateRoomName,
107+ ),
108+ onFieldSubmitted: (_) {
109+ submit ();
110+ },
111+ ),
112+ null => const SizedBox (),
113+ _ => throw StateError ('$selectedType is not a valid type' ), // coverage:ignore-line
114+ },
115+ ],
116+ ),
115117 );
116118
117119 return NeonDialog (
0 commit comments