Skip to content

Commit 500833b

Browse files
vin-fandemanddanvickWilliamCunhaCardosoawhitford
authored
Fix for label overflows in Radio Groups (#431)
* #317 fix for initializing signature * resolve review comments * fix final review comments * v3.11.3 docs * add txtstyle params and re-implmenet numberFormat (#343) * add txtstyle params and re-implmenet numberFormat * rename fieldTextStyle and add it as a fallback * Fix bug in ChoiceChip & FilterChip where using FieldOption label instead of child breaks app. Closes #348 * Added labelPadding and labelStyle to ChoiceChip field * Added const keyword to constructor. * Added an extra deprecated annotation so that users are alerted to the deprecation of label. (I noticed that my code was not alerting with the deprecation only on the field declaration.) * Dependency upgrades. * chages to fix teh overflow with labels Co-authored-by: Danvick Miller <[email protected]> Co-authored-by: William Cunha Cardoso <[email protected]> Co-authored-by: Anthony Whitford <[email protected]>
1 parent 81476a0 commit 500833b

File tree

3 files changed

+24
-14
lines changed

3 files changed

+24
-14
lines changed

example/lib/main.dart

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -368,12 +368,20 @@ class MyHomePageState extends State<MyHomePage> {
368368
),
369369
SizedBox(height: 15),
370370
FormBuilderRadioGroup(
371+
orientation: GroupedRadioOrientation.wrap,
371372
decoration:
372373
InputDecoration(labelText: 'My chosen language'),
373374
attribute: 'best_language',
374375
onChanged: _onChanged,
375376
validators: [FormBuilderValidators.required()],
376-
options: ['Dart', 'Kotlin', 'Java', 'Swift', 'Objective-C']
377+
options: [
378+
'Dart',
379+
'Kotlin',
380+
'Java',
381+
'Swift',
382+
'Objective-C',
383+
'A Very long text that would overflow to the next line and crash'
384+
]
377385
.map((lang) => FormBuilderFieldOption(
378386
value: lang,
379387
child: Text('$lang'),
@@ -562,7 +570,7 @@ class MyHomePageState extends State<MyHomePage> {
562570
],
563571
),
564572
),
565-
Row(
573+
ButtonBar(
566574
children: <Widget>[
567575
Expanded(
568576
child: MaterialButton(
@@ -583,17 +591,16 @@ class MyHomePageState extends State<MyHomePage> {
583591
),
584592
SizedBox(width: 20),
585593
Expanded(
586-
child: MaterialButton(
587-
color: Theme.of(context).accentColor,
588-
child: Text(
589-
'Reset',
590-
style: TextStyle(color: Colors.white),
591-
),
592-
onPressed: () {
593-
_fbKey.currentState.reset();
594-
},
594+
child: MaterialButton(
595+
color: Theme.of(context).accentColor,
596+
child: Text(
597+
'Reset',
598+
style: TextStyle(color: Colors.white),
595599
),
596-
),
600+
onPressed: () {
601+
_fbKey.currentState.reset();
602+
},
603+
)),
597604
],
598605
),
599606
],

flutter_form_builder

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 01edb2be3db854209046d1fa3ca5e70351e879e5

lib/src/widgets/grouped_radio.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,12 @@ class _GroupedRadioState<T> extends State<GroupedRadio<T>> {
291291
children: <Widget>[
292292
if (widget.controlAffinity == ControlAffinity.leading) ...[
293293
control,
294-
label
294+
Flexible(child: label),
295295
],
296296
if (widget.controlAffinity == ControlAffinity.trailing) ...[
297-
label,
297+
Flexible(
298+
child: label,
299+
),
298300
control
299301
],
300302
if (widget.separator != null &&

0 commit comments

Comments
 (0)