Created
September 5, 2020 12:49
-
-
Save BKinya/0f2795806e9712a196253023f5df9f97 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class LabelledCheckBox extends StatelessWidget { | |
final bool value; | |
final String label; | |
final Function onChanged; | |
LabelledCheckBox( | |
{@required this.value, @required this.label, @required this.onChanged}); | |
@override | |
Widget build(BuildContext context) { | |
return InkWell( | |
onTap: () { | |
onChanged(!value); | |
}, | |
child: Row( | |
children: [ | |
Checkbox( | |
value: value, | |
onChanged: (bool newValue) { | |
onChanged(newValue); | |
}, | |
), | |
Text(label) | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment