Michael Goderbauer
5491c8c146
Auto-format Framework ( #160545 )
...
This auto-formats all *.dart files in the repository outside of the
`engine` subdirectory and enforces that these files stay formatted with
a presubmit check.
**Reviewers:** Please carefully review all the commits except for the
one titled "formatted". The "formatted" commit was auto-generated by
running `dev/tools/format.sh -a -f`. The other commits were hand-crafted
to prepare the repo for the formatting change. I recommend reviewing the
commits one-by-one via the "Commits" tab and avoiding Github's "Files
changed" tab as it will likely slow down your browser because of the
size of this PR.
---------
Co-authored-by: Kate Lovett <katelovett@google.com>
Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
2024-12-19 20:06:21 +00:00
Bruno Leroux
c5132b52c2
Reland Fix Date picker overlay colors aren't applied on selected state ( #159839 )
...
Reland https://github.com/flutter/flutter/pull/159203 without change.
The initial PR was reverted in
https://github.com/flutter/flutter/pull/159583 .
Fixes [Date picker overlay colors aren't applied on
MaterialState.selected
state](https://github.com/flutter/flutter/issues/130586 ).
2024-12-05 16:44:06 +00:00
Bruno Leroux
7453ffd22d
Revert "Fix Date picker overlay colors aren't applied on selected sta… ( #159583 )
...
Reverts https://github.com/flutter/flutter/pull/159203 because it
depends on https://github.com/flutter/flutter/pull/159072 which was
flagged as a perf regression in
https://github.com/flutter/flutter/issues/159337 .
Reverting both PRs to see if the perf regression was really related to
this change or was impacted by another change. See
https://github.com/flutter/flutter/issues/159337#issuecomment-2504418480
for context.
2024-11-28 13:08:55 +00:00
Bruno Leroux
8509d78734
Fix Date picker overlay colors aren't applied on selected state ( #159203 )
...
## Description
This PR fixes the DatePicker overlay colors for the selected days.
Before this PR, overlays were obscured by the selected day backgound.
This fix simply replaces a DecoratedBox with an Ink to make the overlays
visible.
Combined with https://github.com/flutter/flutter/pull/159072 which fixes
InkWell overlay color resolution related to the selected state, this PR
fixes [Date picker overlay colors aren't applied on
MaterialState.selected
state](https://github.com/flutter/flutter/issues/130586 ).
Before, no overlay visible for the selected day when hovered, focused,
or pressed:
https://github.com/user-attachments/assets/944d5035-68b2-40da-b606-3e8795229767
After, overlay is visible for the selected day when hovered, focused, or
pressed (color change is slight as defined with M3 defaults):
https://github.com/user-attachments/assets/2627955b-f45a-465f-8eb0-21955ccd8c3e
## Related Issue
Fixes [Date picker overlay colors aren't applied on
MaterialState.selected
state](https://github.com/flutter/flutter/issues/130586 ).
## Tests
Adds 12 tests.
Updates several existing tests (those tests were looking for a
`DecoratedBox`, make them look for an `Ink`).
2024-11-25 13:09:32 +00:00
Jiten Patel
3e9901dac9
Fix: showDatePicker should have a simple example in the docs ( #156196 )
...
This PR introduces a basic example of how to use the `showDatePicker` function. The purpose of this PR is to simplify the onboarding process for new Flutter developers by providing a straightforward demonstration of handling the asynchronous Future returned by the showDatePicker. This will help users unfamiliar with the intricacies of asynchronous operations in Flutter.
Fixes #156157
2024-10-22 17:04:23 +00:00
Taha Tesser
ba719bc588
Fix CalendarDatePicker
day selection shape and overlay ( #144317 )
...
fixes [`DatePickerDialog` date entry hover background and ink splash have different radius](https://github.com/flutter/flutter/issues/141350 )
fixes [Ability to customize DatePicker day selection background and overlay shape](https://github.com/flutter/flutter/issues/144220 )
### Code sample
<details>
<summary>expand to view the code sample</summary>
```dart
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Center(
child: Builder(builder: (context) {
return FilledButton(
onPressed: () {
showDatePicker(
context: context,
initialDate: DateTime.now(),
firstDate: DateTime.utc(2010),
lastDate: DateTime.utc(2030),
);
},
child: const Text('Show Date picker'),
);
}),
),
),
);
}
}
```
</details>
### Material DatePicker states specs

### Day selection overlay
| Before | After |
| --------------- | --------------- |
| <img src="https://github.com/flutter/flutter/assets/48603081/b529d38d-0232-494b-8bf2-55d28420a245 " /> | <img src="https://github.com/flutter/flutter/assets/48603081/c4799559-a7ef-45fd-aed9-aeb386370580 " /> |
### Hover, pressed, highlight preview
| Before | After |
| --------------- | --------------- |
| <video src="https://github.com/flutter/flutter/assets/48603081/8edde82a-7f39-4482-afab-183e1bce5991 " /> | <video src="https://github.com/flutter/flutter/assets/48603081/04e1502e-67a4-4b33-973d-463067d70151 " /> |
### Using `DatePickerThemeData.dayShape` to customize day selection background and overlay shape
| Before | After |
| --------------- | --------------- |
| <img src="https://github.com/flutter/flutter/assets/48603081/a0c85f58-a69b-4e14-a45d-41e580ceedce " /> | <img src="https://github.com/flutter/flutter/assets/48603081/db67cee1-d28d-4168-98b8-fd7a9cb70cda " /> |
### Example preview

2024-03-01 12:44:29 +00:00
Taha Tesser
87679ff1c3
Update date picker examples, remove unused variables and add missing tests ( #121528 )
...
Update date picker examples, remove unused variables and add missing tests
2023-02-28 08:31:51 +00:00