-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
c: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
Use case
When a checkbox is unchecked, the background color/fill color is transparent.
It would be nice to have a way to have a parameter to change it and be able to set it in the theme.
Right now, I have to use a ColoredBox around the Checkbox in addition to a SizedBox to remove the padding of the Checkbox.
See this Stack Overflow question
I would like to set the background color of a Checkbox, like this image (unchecked check box)
Here is my code to achieve this at the moment:
class Home extends StatefulWidget {
const Home({super.key});
@override
State<Home> createState() => _HomeState();
}
class _HomeState extends State<Home> {
var _value = false;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: SizedBox(
height: 16,
width: 16,
child: ColoredBox(
color: Colors.green,
child: Checkbox(
value: _value,
onChanged: (value) {
setState(() {
_value = value!;
});
},
),
),
),
),
);
}
}Proposal
Add a parameter backgroundColor to Checkbox and a property backgroundColor to the CheckboxThemeData.
YarosMallorca
Metadata
Metadata
Assignees
Labels
c: new featureNothing broken; request for a new capabilityNothing broken; request for a new capabilityc: proposalA detailed proposal for a change to FlutterA detailed proposal for a change to Flutterf: material designflutter/packages/flutter/material repository.flutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
