Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
38393291
Unverified
Commit
38393291
authored
Mar 11, 2021
by
Abhishek Ghaskata
Committed by
GitHub
Mar 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding checkbox demo (#75899)
parent
216f9b59
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
checkbox.dart
packages/flutter/lib/src/material/checkbox.dart
+36
-0
No files found.
packages/flutter/lib/src/material/checkbox.dart
View file @
38393291
...
...
@@ -29,6 +29,42 @@ import 'toggleable.dart';
///
/// Requires one of its ancestors to be a [Material] widget.
///
/// {@tool dartpad --template=stateful_widget_scaffold_center}
///
/// This example shows how you can override the default theme of
/// of a [Checkbox] with a [MaterialStateProperty].
/// In this example, the checkbox's color will be `Colors.blue` when the [Checkbox]
/// is being pressed, hovered, or focused. Otherwise, the checkbox's color will
/// be `Colors.red`.
///
/// ```dart
/// bool isChecked = false;
/// Widget build(BuildContext context) {
/// Color getColor(Set<MaterialState> states) {
/// const Set<MaterialState> interactiveStates = <MaterialState>{
/// MaterialState.pressed,
/// MaterialState.hovered,
/// MaterialState.focused,
/// };
/// if (states.any(interactiveStates.contains)) {
/// return Colors.blue;
/// }
/// return Colors.red;
/// }
/// return Checkbox(
/// checkColor: Colors.white,
/// fillColor: MaterialStateProperty.resolveWith(getColor),
/// value: isChecked,
/// onChanged: (val) {
/// setState(() {
/// isChecked = !isChecked;
/// });
/// },
/// );
/// }
/// ```
/// {@end-tool}
///
/// See also:
///
/// * [CheckboxListTile], which combines this widget with a [ListTile] so that
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment