Skip to content

Instantly share code, notes, and snippets.

@Kvisaz
Forked from marcusedu/app_checkbox.dart
Created August 7, 2020 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kvisaz/76c51963fa41746847c3a20baa11ddd6 to your computer and use it in GitHub Desktop.
Save Kvisaz/76c51963fa41746847c3a20baa11ddd6 to your computer and use it in GitHub Desktop.
Flutter Checkbox com label
import 'package:flutter/material.dart';
class AppCheckbox extends StatelessWidget {
final String label;
final bool value;
final ValueChanged<bool> onChanged;
final TextStyle labelStyle;
const AppCheckbox(
{Key key, this.label, this.value, this.onChanged, this.labelStyle})
: super(key: key);
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
onChanged(!value);
},
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Checkbox(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
value: value,
onChanged: onChanged,
activeColor: Theme.of(context).primaryColor),
Text(label, style: labelStyle),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment