Skip to content

Commit

Permalink
test: update goldens and test boxed variants
Browse files Browse the repository at this point in the history
  • Loading branch information
smallTrogdor committed Jan 11, 2025
1 parent 8e531c3 commit 514f3aa
Show file tree
Hide file tree
Showing 7 changed files with 88 additions and 12 deletions.
Binary file modified test/goldens/radio_test_1_initial.dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/goldens/radio_test_1_initial.light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/goldens/radio_test_2_initial.dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/goldens/radio_test_2_initial.light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/goldens/radio_test_3_initial.dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test/goldens/radio_test_3_initial.light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
100 changes: 88 additions & 12 deletions test/sbb_radio_button_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class RadioTest extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
const SBBListHeader('RadioButton'),
SBBGroup(
padding: const EdgeInsets.all(sbbDefaultSpacing / 2),
Padding(
padding: const EdgeInsets.all(sbbDefaultSpacing * .5),
child: Row(
children: [
SBBRadioButton<int>(
Expand All @@ -58,7 +58,7 @@ class RadioTest extends StatelessWidget {
),
),
const SizedBox(height: sbbDefaultSpacing),
const SBBListHeader('RadioButtonListItem'),
const SBBListHeader('RadioButton Item - List'),
SBBGroup(
child: Column(
children: [
Expand All @@ -72,44 +72,65 @@ class RadioTest extends StatelessWidget {
value: 2,
groupValue: listItemGroupValue,
onChanged: (newValue) {},
label: 'Call to Action',
label: 'Button',
trailingIcon: SBBIcons.circle_information_small_small,
onCallToAction: () {},
),
SBBRadioButtonListItem<int>(
value: 3,
groupValue: listItemGroupValue,
onChanged: (newValue) {},
label: 'Icon',
leadingIcon: SBBIcons.alarm_clock_small,
label: 'Leading and Button',
trailingIcon: SBBIcons.circle_information_small_small,
onCallToAction: () {},
),
SBBRadioButtonListItem<int>(
value: 4,
groupValue: listItemGroupValue,
onChanged: null,
label: 'Leading Icon, Button (Disabled)',
leadingIcon: SBBIcons.alarm_clock_small,
trailingIcon: SBBIcons.circle_information_small_small,
onCallToAction: () {},
),
SBBRadioButtonListItem<int>(
value: 5,
groupValue: listItemGroupValue,
onChanged: (newValue) {},
label: 'Leading Icon',
leadingIcon: SBBIcons.alarm_clock_small,
),
SBBRadioButtonListItem<int>(
value: 6,
groupValue: listItemGroupValue,
onChanged: (newValue) {},
label: 'Icon, Call to Action',
label: 'Leading and Trailing Icon',
leadingIcon: SBBIcons.alarm_clock_small,
trailingIcon: SBBIcons.circle_information_small_small,
),
SBBRadioButtonListItem<int>(
value: 4,
value: 7,
groupValue: listItemGroupValue,
onChanged: null,
label: 'Disabled, Icon, Call to Action',
label: 'Leading and Trailing Icon (Disabled)',
leadingIcon: SBBIcons.alarm_clock_small,
trailingIcon: SBBIcons.circle_information_small_small,
),
SBBRadioButtonListItem<int>.custom(
value: 5,
value: 8,
groupValue: listItemGroupValue,
onChanged: (newValue) {},
label: 'Custom trailing Widget',
trailingWidget: const Padding(
padding: EdgeInsets.only(right: 16),
padding: EdgeInsets.only(
top: sbbDefaultSpacing * .75,
right: sbbDefaultSpacing,
),
child: Text('CHF 0.99'),
),
),
SBBRadioButtonListItem<int>(
value: 6,
value: 9,
groupValue: listItemGroupValue,
onChanged: (newValue) {},
label: 'Multiline Label with\nSecondary Label',
Expand All @@ -120,6 +141,61 @@ class RadioTest extends StatelessWidget {
],
),
),
const SizedBox(height: sbbDefaultSpacing),
const SBBListHeader('RadioButton Item - List'),
Column(
// spacing: sbbDefaultSpacing * 0.5, add once support for Flutter SDK 3.24.5 removed
// and remove SizedBoxes below
children: [
SBBGroup(
child: SBBRadioButtonListItem<int>.boxed(
value: 1,
groupValue: listItemGroupValue,
onChanged: (newValue) {},
label: 'Label',
),
),
SizedBox(height: sbbDefaultSpacing * .5),
SBBGroup(
child: SBBRadioButtonListItem<int>.boxed(
value: 2,
groupValue: listItemGroupValue,
onChanged: (newValue) {},
label: 'Leading and Trailing Icon',
leadingIcon: SBBIcons.alarm_clock_small,
trailingIcon: SBBIcons.dog_small,
),
),
SizedBox(height: sbbDefaultSpacing * .5),
SBBGroup(
child: SBBRadioButtonListItem<int>.boxed(
value: 3,
groupValue: listItemGroupValue,
onChanged: (newValue) {},
label: 'Button',
trailingIcon: SBBIcons.circle_information_small_small,
onCallToAction: () => {},
),
),
SizedBox(height: sbbDefaultSpacing * .5),
SBBGroup(
child: SBBRadioButtonListItem<int>.custom(
value: 4,
groupValue: listItemGroupValue,
onChanged: (newValue) {},
label: 'Custom trailing Widget',
trailingWidget: const Padding(
padding: EdgeInsets.only(
top: sbbDefaultSpacing * .75,
right: sbbDefaultSpacing,
),
child: Text('CHF 0.99'),
),
isLastElement: false,
),
),
],
)
],
);
}

0 comments on commit 514f3aa

Please sign in to comment.