Skip to content

Commit 5d765a1

Browse files
committed
Enhance RadioGroup widget with textStyle property support
- Added 'textStyle' property to RadioGroup for customizable text styling. - Updated RadioGroupController to include textStyle management. - Modified RadioGroupState to apply the specified textStyle or fallback to default theme styling.
1 parent 779f85e commit 5d765a1

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

modules/ensemble/lib/widget/radio/radio_group.dart

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ import 'package:ensemble/widget/helpers/input_wrapper.dart';
1111
import 'package:ensemble/widget/radio/custom_radio_tile.dart';
1212
import 'package:flutter/material.dart';
1313
import 'package:ensemble/util/utils.dart';
14-
import 'package:ensemble/widget/helpers/widgets.dart';
1514
import 'package:ensemble/widget/helpers/form_helper.dart';
1615
import 'package:ensemble/framework/action.dart';
1716
import 'package:ensemble_ts_interpreter/invokables/invokable.dart';
18-
import 'package:logger/logger.dart';
1917

2018
class RadioGroup extends StatefulWidget
2119
with
@@ -64,6 +62,7 @@ class RadioGroup extends StatefulWidget
6462
'itemGap': (value) =>
6563
_controller.itemGap = Utils.optionalInt(value, min: 0),
6664
'size': (value) => _controller.size = Utils.optionalInt(value, min: 0),
65+
'textStyle': (style) => _controller.textStyle = Utils.getTextStyle(style),
6766
'activeColor': (color) => _controller.activeColor = Utils.getColor(color),
6867
'inactiveColor': (color) =>
6968
_controller.inactiveColor = Utils.getColor(color),
@@ -103,6 +102,8 @@ class RadioGroupController extends FormFieldController {
103102
Color? activeColor;
104103
Color? inactiveColor;
105104

105+
TextStyle? textStyle;
106+
106107
int? size;
107108

108109
EnsembleAction? onChange;
@@ -236,7 +237,12 @@ class RadioGroupState extends FormFieldWidgetState<RadioGroup>
236237
var enabled = isEnabled();
237238
List<Widget> children = [];
238239

239-
TextStyle? baseLabelStyle = Theme.of(context).textTheme.titleMedium;
240+
TextStyle? baseLabelStyle =
241+
widget._controller.textStyle ?? Theme.of(context).textTheme.titleMedium;
242+
if (!enabled && baseLabelStyle != null) {
243+
baseLabelStyle =
244+
baseLabelStyle.copyWith(color: Theme.of(context).disabledColor);
245+
}
240246

241247
// add the children
242248
if (widget._controller.items != null) {

0 commit comments

Comments
 (0)