-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Improve CupertinoCheckbox's fidelity and customizability
#148804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
victorsanni
wants to merge
163
commits into
flutter:master
from
victorsanni:improve-cupertino-checkbox-fidelity
Closed
Changes from all commits
Commits
Show all changes
163 commits
Select commit
Hold shift + click to select a range
6b7326e
Improve `CupertinoCheckbox`'s fidelity and customizability
victorsanni 93bb81d
Minor docs and formatting changes
victorsanni 0ba4831
Make side non-nullable
victorsanni 5b924ff
Make dropshadow optional
victorsanni 3d0a806
Minor fixes
victorsanni 6860f32
Configure shadow color
victorsanni ce6d639
Apply Justin's suggested changes
victorsanni 18d3128
Add version number to documentation
victorsanni e50c4d2
Update packages/flutter/lib/src/cupertino/checkbox.dart
victorsanni b099dd0
Add test for mouse cursor in different widget states
victorsanni 8c17b90
Merge branch 'master' into improve-cupertino-checkbox-fidelity
victorsanni 665e378
Make darkening checkbox a separate test
victorsanni 1fce8fe
Add shadowColor property to Checkbox.adaptive
victorsanni 7e1f6d0
Add shadowColor to CheckboxListTile.adaptive
victorsanni 32ffd60
Create shadowColor doc macro
victorsanni aadf1e2
Merge branch 'master' into improve-cupertino-checkbox-fidelity
victorsanni 7c059d2
Replace with CupertinoColors.transparent
victorsanni 28185f4
Dropshadow fidelity updates
victorsanni 207d9f0
More fidelity updates in disabled state
victorsanni c04baeb
Deprecate inactiveColor
victorsanni 69ed3bb
Remove shadowColor parameter
victorsanni 9f8da4f
Undo deprecation of inactiveColor
victorsanni 26aeb42
Remove macOS specific effects
victorsanni 829fa46
Add link to macOS design template source file
victorsanni d6b56c0
Make checkbox.adaptive use theme properties
victorsanni 0992387
Merge branch 'master' into improve-cupertino-checkbox-fidelity
victorsanni d37bfea
Further fidelity updates
victorsanni d7bf003
Minor formatting changes from review
victorsanni e438c6a
Revert checkbox width change
victorsanni 68e6f72
Make colors resolve in light vs. dark modes
victorsanni 700c405
Add tests for dark mode and fix formatting
victorsanni 881b5dd
Roll Flutter Engine from 1d5e3cc55a75 to a9194f0f01f4 (7 revisions) (…
engine-flutter-autoroll dbd3442
feat: Add autofocus for `MenuItemButton` (#139396)
Fernthedev 1454550
Improve the behavior of scrollbar drag-scrolls triggered by the track…
HansMuller 7c3166b
Copy any previous `IconThemeData` instead of overwriting it in Cupert…
ricardoboss b7eee49
Fixes `flutter build ipa` failure: Command line name "app-store" is d…
LouiseHsu eafd47c
add onFocus to text fields (#150648)
yjbanov f02cdc2
Bump dartdoc to 8.0.9+1 (#150935)
goderbauer 39d4074
[a11y] Reland [#149375 ] Update semantics in dropdown.dart (#150578)
hannah-hyj ea713d1
Roll Flutter Engine from a9194f0f01f4 to b42c80460538 (10 revisions) …
engine-flutter-autoroll 34b04b5
Have flutter.js load local canvaskit instead of the CDN when appropri…
eyebrowsoffire 8ad5e87
[tool] make the `systemTempDirectory` getter on `ErrorHandlingFileSys…
andrewkolos 614c3d4
Roll Flutter Engine from b42c80460538 to d1506c12808e (3 revisions) (…
engine-flutter-autoroll d4615e8
local lint copy gradle task config (#150957)
reidbaker 57a9aa5
Manual engine roll to ddd4814 (#150952)
gmackall 5e6be1e
Roll Flutter Engine from ddd4814b9d40 to 94591ffb20df (5 revisions) (…
engine-flutter-autoroll e3a6076
Roll Flutter Engine from 94591ffb20df to a78f5ce743ce (1 revision) (#…
engine-flutter-autoroll a76ac04
[flutter_tools] Include more details in structured errors sent to a D…
DanTup a3fced9
Roll Packages from 03f5f6d5660c to 412ec4615aa4 (12 revisions) (#150985)
engine-flutter-autoroll 428ae6b
Use caret syntax with flutter create command (#150920)
alestiago 3ced095
Add support for type-safe plugin apply (#150958)
DRSchlaubi 77069f0
Draggable feedback positioning (#149040)
timcreatedit 2c36e55
Roll Flutter Engine from a78f5ce743ce to 2f7e9ab27493 (11 revisions) …
engine-flutter-autoroll 5e24dae
[tool] when writing to openssl as a part of macOS/iOS code-signing, f…
andrewkolos df3d114
Bump github/codeql-action from 3.25.10 to 3.25.11 (#151012)
dependabot[bot] 97b5803
Roll Flutter Engine from 2f7e9ab27493 to f828363d03ff (3 revisions) (…
engine-flutter-autoroll f1c1e41
Roll pub packages (#150827)
flutter-pub-roller-bot 6d8f973
Roll pub packages (#151022)
flutter-pub-roller-bot 4a06620
Add test for segmented_button.0.dart (#150676)
ValentinVignal ab62e78
Roll Flutter Engine from f828363d03ff to ad1343cfb99e (3 revisions) (…
engine-flutter-autoroll 6d5cf68
Reduce the depth used in a test that applies finders to deep widget t…
jason-simmons cbf43d4
Roll Flutter Engine from ad1343cfb99e to 0d93da7e2fe1 (9 revisions) (…
engine-flutter-autoroll 0ad8974
Roll Flutter Engine from 0d93da7e2fe1 to b57a044ed10f (1 revision) (#…
engine-flutter-autoroll 25996ea
Fix teardown of a FocusScopeNode in material/app_test (#151115)
jason-simmons 22dfd74
Roll pub packages (#151028)
flutter-pub-roller-bot 0b3585a
Fix missing `[` in docs (#151091)
Pante 0fa1309
Bump dartdoc to 8.0.10 (#151107)
goderbauer 77b6d8d
More docimports for animation library (#151011)
goderbauer 4d5b31e
Read AndroidManifest.xml and emit manifest-aar-impeller-(enabled|disa…
jtmcdole 6d92f1b
Roll Flutter Engine from b57a044ed10f to 3456fee1a6b9 (5 revisions) (…
engine-flutter-autoroll a0096da
Upgrade template Gradle, App AGP, Module AGP, and Kotlin versions, an…
gmackall 612a566
Reverts "Upgrade template Gradle, App AGP, Module AGP, and Kotlin ver…
auto-submit[bot] bb7d217
Implementing a few switch statements (#150946)
nate-thegrate 2577862
[tool] remove some temporary printTrace calls (#151074)
andrewkolos 1bd1d0a
Roll Flutter Engine from 3456fee1a6b9 to fc5bc14e6091 (8 revisions) (…
engine-flutter-autoroll bbeb423
Fix: `CupertinoActionSheet` should take up max height when actions se…
dkwingsmt 2a135a3
Roll Flutter Engine from fc5bc14e6091 to d3c5bd66a78f (1 revision) (#…
engine-flutter-autoroll 34d7bb5
Roll Flutter Engine from d3c5bd66a78f to 40c087b31515 (1 revision) (#…
engine-flutter-autoroll 4388774
Refactor BuildInfo to always require packageConfigPath (#150559)
sigurdm 1c89660
Roll Flutter Engine from 40c087b31515 to 433d360eee11 (7 revisions) (…
engine-flutter-autoroll 34c590f
[flutter_driver] add allocator mtl to memory event allowlist. (#151153)
40a1ed6
docimports for semantics (#151132)
goderbauer 6728fd5
Docimports for foundation (#151119)
goderbauer 1e270f2
docimports for gestures (#151123)
goderbauer 9fb199c
docimports for cupertino (#151149)
goderbauer 6735dd6
docimports for services (#151134)
goderbauer 2f8dc7a
docimports for physics (#151125)
goderbauer 918142e
`dismissible.dart` code cleanup (#150276)
nate-thegrate 2c89d55
docimports for scheduler (#151126)
goderbauer 2939d52
docimports for painting (#151143)
goderbauer ec06408
Roll Packages from 412ec4615aa4 to d2705fb82b26 (13 revisions) (#151169)
engine-flutter-autoroll d325ec9
ScrollEndNotification example: auto-scroll based on RenderSliver cons…
HansMuller 557064e
Use `ErrorHandlingFileSystem.deleteIfExists` when deleting .plugin_sy…
andrewkolos 4b81860
Roll Flutter Engine from 433d360eee11 to 44278941443e (4 revisions) (…
engine-flutter-autoroll 4dbb539
[tool] Fix `stdin.flush` calls on processes started by `FakeProcessMa…
andrewkolos a8fde1d
Fix typo (#151192)
QuncCccccc d3ad708
Roll pub packages (#151129)
flutter-pub-roller-bot 3bd0951
[flutter_tools] Update the mapping for the Dart SDK internal URI (#15…
DanTup a08339c
Interactable ScrollView content when settling a scroll activity (#145…
Michal-MK 87a647b
docImports for flutter_test (#151189)
goderbauer 5c1fb9c
Fix result propagation in RenderSliverEdgeInsetsPadding.hitTestChildr…
knopp 43c795b
Fix scheduler event loop being stuck due to task with Priority.idle (…
lauweijie fb251f0
Roll Flutter Engine from 44278941443e to c5c0c54d6d1d (9 revisions) (…
engine-flutter-autoroll dcfa170
Roll Flutter Engine from c5c0c54d6d1d to a02e3f673da3 (1 revision) (#…
engine-flutter-autoroll 776bcdc
Roll Flutter Engine from a02e3f673da3 to 8274f54f11be (4 revisions) (…
engine-flutter-autoroll bf289e1
Handle a SocketException thrown when sending the browser close comman…
jason-simmons 9b73dfa
Force regeneration of platform-specific manifests before running perf…
jason-simmons 2f97665
Roll Flutter Engine from 8274f54f11be to a3e61c0fd1c2 (2 revisions) (…
engine-flutter-autoroll 6749b69
Roll Flutter Engine from a3e61c0fd1c2 to 4190543cb093 (1 revision) (#…
engine-flutter-autoroll 59f9d61
Fix project name fallback (#150614)
navaronbracke 97e8e59
Add example of goldenFileComparator usage in widget tests (#150422)
alestiago b6618c8
chore: fix typos and link broken (#150402)
xiaoxianBoy 80a4cd4
content dimensions are not established get controller value error (#1…
hello-coder-xu a97a33c
Fix link in tree hygene doc (#151235)
derdilla d3f324e
Fix references in examples (#151204)
goderbauer 45feff3
Feat: Add withOpacity to gradient (#150670)
rkishan516 9d797ce
Remove warning when KGP version not detected (#151254)
gmackall 71d19a4
SliverFloatingHeader (#151145)
HansMuller e0b19b7
Update deprecation policy (#151257)
Piinks bc1b8da
PinnedHeaderSliver example based on the iOS Settings AppBar (#151205)
HansMuller 475368e
Add a message about spam/brigading (#150583)
nate-thegrate ae4dd01
Prepares semantics_update_test for upcoming link URL change (#151261)
harryterkelsen 6583eb9
Cupertino transparent navigation bars (#149102)
veloce b0474fd
Fix invalid URL suggestion for gradle incompatability (#150999)
Dispersia f7833cc
Roll pub packages (#151203)
flutter-pub-roller-bot 058884e
Roll Flutter Engine from 4190543cb093 to 8e2d05fa95d7 (13 revisions) …
engine-flutter-autoroll 1725cbb
Roll Flutter Engine from 8e2d05fa95d7 to 2b6bb516e7e6 (2 revisions) (…
engine-flutter-autoroll 401b2c8
Roll Flutter Engine from 2b6bb516e7e6 to 79a91e38c587 (2 revisions) (…
engine-flutter-autoroll d74df37
Roll Packages from d2705fb82b26 to 754de1918a33 (3 revisions) (#151315)
engine-flutter-autoroll 61246f0
Roll Flutter Engine from 79a91e38c587 to 3c6a373bda3e (2 revisions) (…
engine-flutter-autoroll fcce6ec
Roll Flutter Engine from 3c6a373bda3e to 1f0f950ea02a (1 revision) (#…
engine-flutter-autoroll 530fae2
Roll Flutter Engine from 1f0f950ea02a to ba9c7b6336ef (1 revision) (#…
engine-flutter-autoroll 8454bae
Roll Flutter Engine from ba9c7b6336ef to 74d40c160e48 (1 revision) (#…
engine-flutter-autoroll 722cc01
Roll Flutter Engine from 74d40c160e48 to 4ee09d3b7f3b (1 revision) (#…
engine-flutter-autoroll 369ec43
Roll Packages from 754de1918a33 to 97bad7ecf569 (1 revision) (#151350)
engine-flutter-autoroll bd06dc8
de-duplicate code in analyze.dart (#151279)
christopherfujino 613d278
Add tests for color_filtered.0.dart example. (#151064)
ksokolovskyi 0c950b0
Roll Flutter Engine from 4ee09d3b7f3b to e6b09697df1a (2 revisions) (…
engine-flutter-autoroll c90992d
Bump actions/upload-artifact from 4.3.3 to 4.3.4 (#151354)
dependabot[bot] d10219a
Roll Flutter Engine from e6b09697df1a to d1ebc5fde630 (1 revision) (#…
engine-flutter-autoroll 6398eb9
Roll Flutter Engine from d1ebc5fde630 to 3600ec613a00 (1 revision) (#…
engine-flutter-autoroll dd55706
Roll Flutter Engine from 3600ec613a00 to 5ca3b856ee5a (1 revision) (#…
engine-flutter-autoroll e75b75f
Roll Flutter Engine from 5ca3b856ee5a to ca79a56a66d7 (1 revision) (#…
engine-flutter-autoroll 96a0811
Add tests for action_listener.0.dart (#150606)
ValentinVignal 4596391
Roll Flutter Engine from ca79a56a66d7 to 69075e7e87d4 (1 revision) (#…
engine-flutter-autoroll e1f6995
Add tests for material_state_border_side.0_test.dart (#151089)
ValentinVignal 01cb450
[Reland] - Enable `explicitChildNodes` for the `AlertDialog` content …
TahaTesser 77faf6d
Update doc-import to primary configured import, _goldens_io.dart (#15…
srawlins 6531c19
Roll Packages from 97bad7ecf569 to 14341d1800f4 (5 revisions) (#151417)
engine-flutter-autoroll 5952add
Add cedric vanden bosch to authors (#151313)
cedvdb ca085fd
Factor out deprecated names in example code (#151374)
nate-thegrate a66414c
Added SliverFloatingHeader.snapMode (#151289)
HansMuller 8ef0a05
Re-enable `SemanticsAction.focus` matchers (#150990)
gspencergoog 5908dc4
[ios]A typical news app benchmark with bottom ad banner (#150991)
hellohuanlin e8c60b4
`MaterialState` → `WidgetState` in documentation (#151376)
nate-thegrate 4bc24dc
Update `DataTable` documentation (#151356)
nate-thegrate afe3f74
Make darkening checkbox a separate test
victorsanni de9b561
Revert changes to Checkbox.adaptive
victorsanni 8a2257a
Revert "Roll Flutter Engine from 1d5e3cc55a75 to a9194f0f01f4 (7 revi…
victorsanni e11e08e
Merge branch 'master' into improve-cupertino-checkbox-fidelity
victorsanni e986f1d
(take 2) Revert checkbox.adaptive
victorsanni 63da870
Revert checkbox.adaptive tests
victorsanni 3a2b26d
Add `hasFocusAction: true` for semantics
victorsanni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
66 changes: 66 additions & 0 deletions
66
examples/api/lib/cupertino/checkbox/cupertino_checkbox.0.dart
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| // Copyright 2014 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'package:flutter/cupertino.dart'; | ||
|
|
||
| /// Flutter code sample for [CupertinoCheckbox]. | ||
|
|
||
| void main() => runApp(const CupertinoCheckboxApp()); | ||
|
|
||
| class CupertinoCheckboxApp extends StatelessWidget { | ||
| const CupertinoCheckboxApp({super.key}); | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return const CupertinoApp( | ||
| theme: CupertinoThemeData(brightness: Brightness.light), | ||
| home: CupertinoPageScaffold( | ||
| navigationBar: CupertinoNavigationBar( | ||
| middle: Text('CupertinoCheckbox Example'), | ||
| ), | ||
| child: SafeArea( | ||
| child: CupertinoCheckboxExample(), | ||
| ), | ||
| ), | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| class CupertinoCheckboxExample extends StatefulWidget { | ||
| const CupertinoCheckboxExample({super.key}); | ||
|
|
||
| @override | ||
| State<CupertinoCheckboxExample> createState() => _CupertinoCheckboxExampleState(); | ||
| } | ||
|
|
||
| class _CupertinoCheckboxExampleState extends State<CupertinoCheckboxExample> { | ||
| bool? isChecked = true; | ||
|
|
||
| @override | ||
| Widget build(BuildContext context) { | ||
| return CupertinoCheckbox( | ||
| checkColor: CupertinoColors.white, | ||
| tristate: true, | ||
| fillColor: WidgetStateProperty.resolveWith(_getColor), | ||
| value: isChecked, | ||
| onChanged: (bool? value) { | ||
| setState(() { | ||
| isChecked = value; | ||
| }); | ||
| }, | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| Color _getColor(Set<WidgetState> states) { | ||
| const Set<WidgetState> interactiveStates = <WidgetState>{ | ||
| WidgetState.pressed, | ||
| WidgetState.hovered, | ||
| WidgetState.focused, | ||
| }; | ||
| if (states.any(interactiveStates.contains)) { | ||
| return CupertinoColors.activeGreen; | ||
| } | ||
| return CupertinoColors.systemRed; | ||
| } |
69 changes: 69 additions & 0 deletions
69
examples/api/test/cupertino/checkbox/cupertino_checkbox.0_test.dart
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| // Copyright 2014 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| import 'package:flutter/cupertino.dart'; | ||
| import 'package:flutter_api_samples/cupertino/checkbox/cupertino_checkbox.0.dart' as example; | ||
| import 'package:flutter_test/flutter_test.dart'; | ||
|
|
||
| void main() { | ||
| testWidgets('Checkbox can be checked', (WidgetTester tester) async { | ||
| await tester.pumpWidget( | ||
| const example.CupertinoCheckboxApp(), | ||
| ); | ||
|
|
||
| CupertinoCheckbox checkbox = tester.widget(find.byType(CupertinoCheckbox)); | ||
|
|
||
| // Verify the initial state of the checkbox. | ||
| expect(checkbox.value, isTrue); | ||
| expect(checkbox.tristate, isTrue); | ||
|
|
||
| // Tap the checkbox and verify the state change. | ||
| await tester.tap(find.byType(CupertinoCheckbox)); | ||
| await tester.pump(); | ||
| checkbox = tester.widget(find.byType(CupertinoCheckbox)); | ||
|
|
||
| expect(checkbox.value, isNull); | ||
|
|
||
| // Tap the checkbox and verify the state change. | ||
| await tester.tap(find.byType(CupertinoCheckbox)); | ||
| await tester.pump(); | ||
| checkbox = tester.widget(find.byType(CupertinoCheckbox)); | ||
|
|
||
| expect(checkbox.value, isFalse); | ||
|
|
||
| await tester.tap(find.byType(CupertinoCheckbox)); | ||
| await tester.pump(); | ||
| checkbox = tester.widget(find.byType(CupertinoCheckbox)); | ||
|
|
||
| expect(checkbox.value, isTrue); | ||
| }); | ||
|
|
||
| testWidgets('Checkbox color can be changed', (WidgetTester tester) async { | ||
| await tester.pumpWidget( | ||
| const example.CupertinoCheckboxApp(), | ||
| ); | ||
| final CupertinoCheckbox checkbox = tester.widget(find.byType(CupertinoCheckbox)); | ||
|
|
||
| expect( | ||
| checkbox.checkColor, | ||
| CupertinoColors.white, | ||
| ); | ||
| expect( | ||
| checkbox.fillColor!.resolve(<WidgetState>{}), | ||
| CupertinoColors.systemRed, | ||
| ); | ||
| expect( | ||
| checkbox.fillColor!.resolve(<WidgetState>{WidgetState.pressed}), | ||
| CupertinoColors.activeGreen, | ||
| ); | ||
| expect( | ||
| checkbox.fillColor!.resolve(<WidgetState>{WidgetState.hovered}), | ||
| CupertinoColors.activeGreen, | ||
| ); | ||
| expect( | ||
| checkbox.fillColor!.resolve(<WidgetState>{WidgetState.focused}), | ||
| CupertinoColors.activeGreen, | ||
| ); | ||
| }); | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.