diff --git a/lib/widgets/dialog_widgets/dialog_toggle_switch.dart b/lib/widgets/dialog_widgets/dialog_toggle_switch.dart index b6735078..911871ab 100644 --- a/lib/widgets/dialog_widgets/dialog_toggle_switch.dart +++ b/lib/widgets/dialog_widgets/dialog_toggle_switch.dart @@ -4,12 +4,10 @@ class DialogToggleSwitch extends StatefulWidget { final Function(bool value) onToggle; final bool initialValue; final String? label; - final double maxWidth; const DialogToggleSwitch({ super.key, this.initialValue = false, - this.maxWidth = 75, this.label, required this.onToggle, }); @@ -31,19 +29,19 @@ class _DialogToggleSwitchState extends State { @override Widget build(BuildContext context) { return Container( - padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0), + padding: const EdgeInsets.symmetric(horizontal: 6.0, vertical: 4.0), decoration: BoxDecoration( borderRadius: BorderRadius.circular(5.0), border: Border.all(color: Theme.of(context).colorScheme.outline), ), child: Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.spaceBetween, + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Container( - constraints: BoxConstraints(maxWidth: widget.maxWidth), + Flexible( child: Text(widget.label ?? '', textAlign: TextAlign.center), ), + const SizedBox(width: 5), Switch( onChanged: (value) { widget.onToggle.call(value); diff --git a/lib/widgets/nt4_widgets/multi-topic/field_widget.dart b/lib/widgets/nt4_widgets/multi-topic/field_widget.dart index d4edfd94..3841b23d 100644 --- a/lib/widgets/nt4_widgets/multi-topic/field_widget.dart +++ b/lib/widgets/nt4_widgets/multi-topic/field_widget.dart @@ -130,42 +130,52 @@ class FieldWidget extends StatelessWidget with NT4Widget { initialValue: field!.game, ), const SizedBox(height: 5), - DialogTextInput( - onSubmit: (value) { - double? newWidth = double.tryParse(value); + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisSize: MainAxisSize.max, + children: [ + Flexible( + child: DialogTextInput( + onSubmit: (value) { + double? newWidth = double.tryParse(value); - if (newWidth == null) { - return; - } - robotWidthMeters = newWidth; - refresh(); - }, - formatter: FilteringTextInputFormatter.allow(RegExp(r"[0-9.]")), - label: 'Robot Width (meters)', - initialText: robotWidthMeters.toString(), - ), - const SizedBox(height: 5), - DialogTextInput( - onSubmit: (value) { - double? newLength = double.tryParse(value); + if (newWidth == null) { + return; + } + robotWidthMeters = newWidth; + refresh(); + }, + formatter: FilteringTextInputFormatter.allow(RegExp(r"[0-9.]")), + label: 'Robot Width (meters)', + initialText: robotWidthMeters.toString(), + ), + ), + const SizedBox(width: 5), + Flexible( + child: DialogTextInput( + onSubmit: (value) { + double? newLength = double.tryParse(value); - if (newLength == null) { - return; - } - robotLengthMeters = newLength; - refresh(); - }, - formatter: FilteringTextInputFormatter.allow(RegExp(r"[0-9.]")), - label: 'Robot Length (meters)', - initialText: robotLengthMeters.toString(), + if (newLength == null) { + return; + } + robotLengthMeters = newLength; + refresh(); + }, + formatter: FilteringTextInputFormatter.allow(RegExp(r"[0-9.]")), + label: 'Robot Length (meters)', + initialText: robotLengthMeters.toString(), + ), + ), + ], ), const SizedBox(height: 5), Row( mainAxisAlignment: MainAxisAlignment.spaceAround, + mainAxisSize: MainAxisSize.max, children: [ Flexible( child: DialogToggleSwitch( - maxWidth: 95, label: 'Show Non-Robot Objects', initialValue: showOtherObjects, onToggle: (value) {