Skip to content

Commit

Permalink
fix: Checkbox now take own space (#37)
Browse files Browse the repository at this point in the history
* fix: Checkbox now take own space
  • Loading branch information
ClementGld authored Oct 5, 2021
1 parent 31a6f42 commit ad04f57
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
43 changes: 27 additions & 16 deletions examples/flutter_playground/lib/pages/checkbox_example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,33 @@ class _CheckboxExampleState extends State<CheckboxExample> {

@override
Widget build(BuildContext context) {
return Center(
child: LenraFlex(
direction: Axis.horizontal,
children: [
LenraCheckbox(label: "Basic", value: false, onPressed: () {}),
LenraCheckbox(label: "Disabled", disabled: true, value: true, onPressed: () {}),
LenraCheckbox(
label: "Interactive",
value: value,
onPressed: () {
setState(() {
value = !value;
});
}),
],
),
return LenraFlex(
mainAxisAlignment: MainAxisAlignment.center,
fillParent: true,
children: [
LenraFlex(
direction: Axis.vertical,
fillParent: true,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
LenraCheckbox(label: "Basic", value: false, onPressed: () {}),
LenraCheckbox(
label: "Disabled",
disabled: true,
value: true,
onPressed: () {}),
LenraCheckbox(
label: "Interactive",
value: value,
onPressed: () {
setState(() {
value = !value;
});
}),
],
),
],
);
}
}
3 changes: 2 additions & 1 deletion lib/component/lenra_checkbox.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:lenra_components/layout/lenra_flex.dart';
import 'package:lenra_components/theme/lenra_checkbox_theme_data.dart';
import 'package:lenra_components/theme/lenra_theme.dart';

Expand Down Expand Up @@ -34,7 +35,7 @@ class LenraCheckbox extends StatelessWidget {
return checkbox;
}

return Row(
return LenraFlex(
children: [
checkbox,
Text(
Expand Down

0 comments on commit ad04f57

Please sign in to comment.