Skip to content

Commit

Permalink
save changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nilesh sahu authored and nilesh sahu committed May 3, 2024
1 parent 98e186e commit 47e8427
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 43 deletions.
5 changes: 5 additions & 0 deletions example/lib/sources/complete_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,11 @@ class _CompleteFormState extends State<CompleteForm> {
value: 'Swift',
avatar: Icon(Icons.monetization_on_outlined),
),
SelectionCardOption(
value: 'Dart',
avatar: const Icon(Icons.monetization_on_outlined),
infoModalConfig: config,
),
SelectionCardOption(
value: 'Objective-C',
avatar: const Icon(Icons.monetization_on_outlined),
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ packages:
path: ".."
relative: true
source: path
version: "9.2.1"
version: "9.2.3"
flutter_lints:
dependency: "direct dev"
description:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,48 +286,45 @@ class CustomGroupedCheckBox<T> extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
for (SelectionCardOption<T> option in options)
Column(
children: [
Builder(builder: (context) {
final isOptionDisabled = disabled.contains(option.value);
return SelectionCard(
label: option,
selected: value.contains(option.value),
onSelected: (val) {
if (isOptionDisabled) return;
List<T> selectedListItems = List.of(value);
selectedListItems.contains(option.value)
? selectedListItems.remove(option.value)
: selectedListItems.add(option.value);
onChanged(selectedListItems);
},
avatar: option.avatar,
selectedIconColor: defaultCardColor,
unselectedIconColor: selectedCardColor,
selectedCardColor: selectedCardColor,
defaultCardColor: defaultCardColor,
disabledColor: disabledColor,
shadowColor: shadowColor,
selectedShadowColor: selectedShadowColor,
elevation: elevation,
pressElevation: pressElevation,
selectedLabelStyle: selectedLabelStyle,
unselectedLabelStyle: unselectedLabelStyle,
labelPadding: labelPadding,
padding: padding,
selectedShape: selectedShape,
unselectedShape: unselectedShape,
expanded: expanded,
infoModalConfig: option.infoModalConfig,
);
}),
if (options.last.value != option.value) SizedBox(height: spacing),
],
),
],
return Wrap(
spacing: spacing, // Horizontal spacing between the children
runSpacing: spacing, // Vertical spacing between the lines
children: options.map((SelectionCardOption<T> option) {
return Builder(builder: (context) {
final isOptionDisabled = disabled.contains(option.value);
return SelectionCard(
label: option,
selected: value.contains(option.value),
onSelected: (val) {
if (isOptionDisabled) return;
List<T> selectedListItems = List.of(value);
selectedListItems.contains(option.value)
? selectedListItems.remove(option.value)
: selectedListItems.add(option.value);
onChanged(selectedListItems);
},
avatar: option.avatar,
selectedIconColor: defaultCardColor,
unselectedIconColor: selectedCardColor,
selectedCardColor: selectedCardColor,
defaultCardColor: defaultCardColor,
disabledColor: disabledColor,
shadowColor: shadowColor,
selectedShadowColor: selectedShadowColor,
elevation: elevation,
pressElevation: pressElevation,
selectedLabelStyle: selectedLabelStyle,
unselectedLabelStyle: unselectedLabelStyle,
labelPadding: labelPadding,
padding:
padding?.copyWith(left: 15, right: 15, top: 15, bottom: 15),
selectedShape: selectedShape,
unselectedShape: unselectedShape,
expanded: false,
//infoModalConfig: option.infoModalConfig,
);
});
}).toList(),
);
}
}

0 comments on commit 47e8427

Please sign in to comment.