From 4f07572b93e894ac2294fbcb8eedecf6e53e7725 Mon Sep 17 00:00:00 2001 From: Matthias Ngeo Date: Sat, 5 Oct 2024 20:50:56 +0800 Subject: [PATCH] Fix PR issues --- forui/example/lib/sandbox.dart | 2 +- .../widgets/select_group/select_group.dart | 8 +++--- .../select_group/select_group_item.dart | 7 ++++- forui/test/src/test_scaffold.dart | 26 +++++++++---------- .../select_group_golden_test.dart | 10 +++---- samples/lib/widgets/select_group.dart | 6 ++--- 6 files changed, 32 insertions(+), 27 deletions(-) diff --git a/forui/example/lib/sandbox.dart b/forui/example/lib/sandbox.dart index dc86876a1..d7f996633 100644 --- a/forui/example/lib/sandbox.dart +++ b/forui/example/lib/sandbox.dart @@ -63,7 +63,7 @@ class _SandboxState extends State { label: const Text('Select Group'), description: const Text('Select Group Description'), controller: FMultiSelectGroupController(min: 1, max: 2, values: {1}), - children: [ + items: [ FSelectGroupItem.checkbox(value: 1, label: const Text('Checkbox 1'), semanticLabel: 'Checkbox 1'), FSelectGroupItem.checkbox(value: 2, label: const Text('Checkbox 2'), semanticLabel: 'Checkbox 2'), FSelectGroupItem.checkbox(value: 3, label: const Text('Checkbox 3'), semanticLabel: 'Checkbox 3'), diff --git a/forui/lib/src/widgets/select_group/select_group.dart b/forui/lib/src/widgets/select_group/select_group.dart index 5de7439e2..964866027 100644 --- a/forui/lib/src/widgets/select_group/select_group.dart +++ b/forui/lib/src/widgets/select_group/select_group.dart @@ -38,12 +38,12 @@ class FSelectGroup extends FormField> { final Widget Function(BuildContext, String) errorBuilder; /// The children. - final List> children; + final List> items; /// Creates a [FSelectGroup]. FSelectGroup({ required this.controller, - required this.children, + required this.items, this.style, this.label, this.description, @@ -75,7 +75,7 @@ class FSelectGroup extends FormField> { error: error, child: Column( children: [ - for (final child in children) + for (final child in items) FSelectGroupItemData( controller: controller, style: groupStyle, @@ -99,7 +99,7 @@ class FSelectGroup extends FormField> { ..add(DiagnosticsProperty('controller', controller)) ..add(ObjectFlagProperty.has('errorBuilder', errorBuilder)) ..add(DiagnosticsProperty('testing', (1, 2, 3))) - ..add(IterableProperty('items', children)); + ..add(IterableProperty('items', items)); } } diff --git a/forui/lib/src/widgets/select_group/select_group_item.dart b/forui/lib/src/widgets/select_group/select_group_item.dart index b0af2c9fe..36c59d4f1 100644 --- a/forui/lib/src/widgets/select_group/select_group_item.dart +++ b/forui/lib/src/widgets/select_group/select_group_item.dart @@ -108,7 +108,12 @@ class _Builder extends FSelectGroupItem { final ValueWidgetBuilder> builder; final Widget? child; - const _Builder({required this.builder, required super.value, this.child, super.key}) : super._(); + const _Builder({ + required this.builder, + required super.value, + this.child, + super.key, + }) : super._(); @override Widget build(BuildContext context) { diff --git a/forui/test/src/test_scaffold.dart b/forui/test/src/test_scaffold.dart index a0cdad19a..358829333 100644 --- a/forui/test/src/test_scaffold.dart +++ b/forui/test/src/test_scaffold.dart @@ -8,19 +8,19 @@ class TestScaffold extends StatelessWidget { colorScheme: const FColorScheme( brightness: Brightness.light, disabledColorLightness: 0.1, - background: Colors.lightBlue, - foreground: Colors.lightBlue, - primary: Colors.lightBlue, - primaryForeground: Colors.lightBlue, - secondary: Colors.lightBlue, - secondaryForeground: Colors.lightBlue, - muted: Colors.lightBlue, - mutedForeground: Colors.lightBlue, - destructive: Colors.lightBlue, - destructiveForeground: Colors.lightBlue, - error: Colors.lightBlue, - errorForeground: Colors.lightBlue, - border: Colors.lightBlue, + background: Color(0xFF03A9F4), + foreground: Color(0xFF03A9F4), + primary: Color(0xFF03A9F4), + primaryForeground: Color(0xFF03A9F4), + secondary: Color(0xFF03A9F4), + secondaryForeground: Color(0xFF03A9F4), + muted: Color(0xFF03A9F4), + mutedForeground: Color(0xFF03A9F4), + destructive: Color(0xFF03A9F4), + destructiveForeground: Color(0xFF03A9F4), + error: Color(0xFF03A9F4), + errorForeground: Color(0xFF03A9F4), + border: Color(0xFF03A9F4), ), ); diff --git a/forui/test/src/widgets/select_group/select_group_golden_test.dart b/forui/test/src/widgets/select_group/select_group_golden_test.dart index a4a605062..236615547 100644 --- a/forui/test/src/widgets/select_group/select_group_golden_test.dart +++ b/forui/test/src/widgets/select_group/select_group_golden_test.dart @@ -23,7 +23,7 @@ void main() { label: const Text('Select Group'), description: const Text('Select Group Description'), controller: FMultiSelectGroupController(values: {1}), - children: [ + items: [ FSelectGroupItem.checkbox( value: 1, label: const Text('Checkbox 1'), @@ -60,7 +60,7 @@ void main() { label: const Text('Select Group'), description: const Text('Select Group Description'), controller: FMultiSelectGroupController(values: {1}), - children: [ + items: [ FSelectGroupItem.checkbox( value: 1, label: const Text('Checkbox 1'), @@ -102,7 +102,7 @@ void main() { description: const Text('Select Group Description'), forceErrorText: 'Some error message.', controller: FMultiSelectGroupController(values: {1}), - children: [ + items: [ FSelectGroupItem.checkbox( value: 1, label: const Text('Checkbox 1'), @@ -147,7 +147,7 @@ void main() { label: const Text('Select Group'), description: const Text('Select Group Description'), controller: FRadioSelectGroupController(value: 1), - children: [ + items: [ FSelectGroupItem.radio( value: 1, label: const Text('Radio 1'), @@ -189,7 +189,7 @@ void main() { description: const Text('Select Group Description'), forceErrorText: 'Some error message.', controller: FRadioSelectGroupController(value: 1), - children: [ + items: [ FSelectGroupItem.radio( value: 1, label: const Text('Radio 1'), diff --git a/samples/lib/widgets/select_group.dart b/samples/lib/widgets/select_group.dart index fe22e03e8..1d14d1e52 100644 --- a/samples/lib/widgets/select_group.dart +++ b/samples/lib/widgets/select_group.dart @@ -21,7 +21,7 @@ class SelectGroupPage extends SampleScaffold { controller: FMultiSelectGroupController(values: {Sidebar.recents}), label: const Text('Sidebar'), description: const Text('These will be shown in the sidebar.'), - children: [ + items: [ FSelectGroupItem.checkbox( value: Sidebar.recents, label: const Text('Recents'), @@ -78,7 +78,7 @@ class CheckboxFormState extends State { label: const Text('Favorite Languages'), description: const Text('Your favorite language.'), validator: (values) => values?.isEmpty ?? true ? 'Please select at least one language.' : null, - children: [ + items: [ FSelectGroupItem.checkbox( value: Language.dart, label: const Text('Dart'), @@ -152,7 +152,7 @@ class RadioFormState extends State { label: const Text('Notifications'), description: const Text('Select the notifications.'), validator: (values) => values?.isEmpty ?? true ? 'Please select a value.' : null, - children: [ + items: [ FSelectGroupItem.radio( value: Notification.all, label: const Text('All new messages'),