Kate Lovett
9d96df2364
Modernize framework lints ( #179089 )
...
WIP
Commits separated as follows:
- Update lints in analysis_options files
- Run `dart fix --apply`
- Clean up leftover analysis issues
- Run `dart format .` in the right places.
Local analysis and testing passes. Checking CI now.
Part of https://github.com/flutter/flutter/issues/178827
- Adoption of flutter_lints in examples/api coming in a separate change
(cc @loic-sharma)
## Pre-launch Checklist
- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code ).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-11-26 01:10:39 +00:00
Camille Simon
7fd228f31d
[Material] Change default mouse cursor of buttons to basic arrow instead of click (except on web) ( #171796 )
...
Changes default mouse cursor of Material buttons to basic arrow instead
of click as per updated Android guidance.
For each Material button, I did the following:
1. Changed the default mouse cursor to the basic arrow.
2. Added a way to configure the mouse cursor of the button if a method
did not exist before.
3. Added a test to ensure that the default mouse cursor is now the basic
arrow (or modified an existing one if applicable).
4. Added a test to ensure that the customization of button mouse cursors
still works (if currently untested).
The list of Material buttons I modified (supposed to be all of them):
- RawMaterialButton
- DropdownButton
- FloatingActionButton
- ToggleButtons
- ElevatedButton
- IconButton
- FilledButton
- OutlinedButton
- PopupMenuItem
- InkWell
- TextButton
- MaterialButton
- DropdownMenuItem
- DropdownButtonFormField
- BackButton
- CloseButton
- DrawerButton
- EndDrawerButton
- PopupMenuButton
- MenuItemButton
- CheckboxMenuButton
- RadioMenuButton
- MenuBar
- SubmenuButton
- SegmentedButton
- FilterChip
- ChoiceChip
- ActionChip
- InputChip
Fixes https://github.com/flutter/flutter/issues/170296 .
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
---------
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-10-23 22:24:00 +00:00
Valentin Vignal
7811e89823
Migrate to WidgetStateTextStyle ( #176330 )
...
Follow up https://github.com/flutter/flutter/pull/176270
Migrate the remaining files from `MaterialStateTextStyle ` to
`WidgetStateTextStyle `. This PR only focus on `WidgetStateTextStyle`.
- This minimizes conflicts and reduces the size of the PR for easier
reviews and follow up
- I'll work on the other elements of
`packages/flutter/lib/src/material/material_state.dart` into other PRs
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code ).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-10-01 18:55:00 +00:00
Valentin Vignal
4084680ede
Migrate to WidgetStateBorderSide ( #176164 )
...
Follow up https://github.com/flutter/flutter/pull/175981
Migrate the remaining files from `MaterialStateBorderSide ` to
`WidgetStateBorderSide `. This PR only focus on `WidgetStateBorderSide`.
- This minimizes conflicts and reduces the size of the PR for easier
reviews and follow up
- I'll work on the other elements of
`packages/flutter/lib/src/material/material_state.dart` into other PRs
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code ).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-09-30 09:54:35 +00:00
Valentin Vignal
271338bc18
Migrate to WidgetStateMouseCursor ( #175981 )
...
Follow up https://github.com/flutter/flutter/pull/175573
Migrate the remaining files from `MaterialStateMouseCursor ` to
`WidgetStateMouseCursor `. This PR only focus on `WidgetStateColor`.
- This minimizes conflicts and reduces the size of the PR for easier
reviews and follow up
- I'll work on the other elements of
`packages/flutter/lib/src/material/material_state.dart` into other PRs
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code ).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-09-26 17:20:55 +00:00
Valentin Vignal
cb889b9d71
Migrate to WidgetStateColor ( #175573 )
...
Follow up of https://github.com/flutter/flutter/pull/175397
Migrate the remaining files from `MaterialStateColor ` to
`WidgetStateColor `. This PR only focus on `WidgetStateColor`.
- This minimizes conflicts and reduces the size of the PR for easier
reviews and follow up
- I'll work on the other elements of
`packages/flutter/lib/src/material/material_state.dart` into other PRs
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code ).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-09-24 19:56:08 +00:00
Valentin Vignal
27ed1b2261
Migrate examples and defaults to WidgetState ( #174421 )
...
Follow up of https://github.com/flutter/flutter/pull/174323
This pull request updates the usage of state sets in theme and widget
property resolution logic throughout the codebase, replacing all
instances of `MaterialState` with `WidgetState`. This change ensures
consistency with the newer `WidgetState` API and prepares the code for
future enhancements or compatibility. The update affects component
themes, button styles, property generators, and related tests.
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code ).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-08-27 01:35:09 +00:00
Valentin Vignal
e90bd4661d
Make component theme data defaults use WidgetStateProperty ( #173893 )
...
Coming from the comments in
https://github.com/flutter/flutter/pull/173160#discussion_r2252303786
`MaterialStateProperty` is deprecated. This PR remplaces its usage with
`WidgetStateProperty` for the files that generates component theme data
defaults
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
**Note**: The Flutter team is currently trialing the use of [Gemini Code
Assist for
GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code ).
Comments from the `gemini-code-assist` bot should not be taken as
authoritative feedback from the Flutter team. If you find its comments
useful you can update your code accordingly, but if you are unsure or
disagree with the feedback, please feel free to wait for a Flutter team
member's review for guidance on which automated comments should be
addressed.
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-08-20 07:38:22 +00:00
Kostia Sokolovskyi
dd790ea5da
Fix Slider dragged mouse cursor visibility. ( #172759 )
...
Fixes https://github.com/flutter/flutter/issues/172752
### Description
- Fixes dragged cursor visibility in `Slider`
- Replaces `MaterialState` occurrences with `WidgetState`
| Before | After |
| - | - |
| <video
src="https://github.com/user-attachments/assets/bb6c1e9e-fdec-456d-bf29-070ad2cbb47d "
/> | <video
src="https://github.com/user-attachments/assets/8ae76bc2-bb6c-4439-9321-6ec925db7c31 "
/> |
## Pre-launch Checklist
- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [X] I signed the [CLA].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [X] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [X] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [X] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-08-05 06:58:19 +00:00
Bruno Leroux
c825031ba2
Fix SegmentedButton border doesn't reflect states ( #172754 )
...
## Description
This PR fixes `SegmentedButton` border side not depending on the current
state.
It's based on one @TahaTesser 's great PR: see
https://github.com/flutter/flutter/pull/161942 . 🙏
I updated some logic related to disabled border which led to Taha’s PR
failing internal Google tests.
I also added a test to verify the disabled border.
<details><summary>Code sample for screenshots</summary>
```dart
import 'package:flutter/material.dart';
void main() {
runApp(const SegmentedButtonApp());
}
enum Calendar { day, week, month, year }
class SegmentedButtonApp extends StatefulWidget {
const SegmentedButtonApp({super.key});
@override
State<SegmentedButtonApp> createState() => _SegmentedButtonAppState();
}
class _SegmentedButtonAppState extends State<SegmentedButtonApp> {
Calendar? calendarView;
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
segmentedButtonTheme: SegmentedButtonThemeData(
style: ButtonStyle(
side: WidgetStateProperty.fromMap(<WidgetStatesConstraint, BorderSide?>{
WidgetState.disabled: const BorderSide(color: Colors.grey, width: 2),
WidgetState.selected & WidgetState.hovered: const BorderSide(
color: Colors.blue,
width: 2,
),
WidgetState.selected & WidgetState.focused: const BorderSide(
color: Colors.pinkAccent,
width: 2,
),
WidgetState.hovered: const BorderSide(color: Colors.green, width: 2),
WidgetState.focused: const BorderSide(color: Colors.purple, width: 2),
WidgetState.any: const BorderSide(color: Colors.amber, width: 2),
}),
),
),
),
home: Scaffold(
body: Center(
child: SegmentedButton<Calendar>(
segments: const <ButtonSegment<Calendar>>[
ButtonSegment<Calendar>(
value: Calendar.day,
label: Text('Day'),
icon: Icon(Icons.calendar_view_day),
enabled: false,
),
ButtonSegment<Calendar>(
value: Calendar.week,
label: Text('Week'),
icon: Icon(Icons.calendar_view_week),
),
ButtonSegment<Calendar>(
value: Calendar.month,
label: Text('Month'),
icon: Icon(Icons.calendar_view_month),
),
ButtonSegment<Calendar>(
value: Calendar.year,
label: Text('Year'),
icon: Icon(Icons.calendar_today),
),
],
selected: <Calendar>{?calendarView},
emptySelectionAllowed: true,
onSelectionChanged: (Set<Calendar> newSelection) {
setState(() {
calendarView = newSelection.isEmpty ? null : newSelection.first;
});
},
),
),
floatingActionButton: FloatingActionButton(onPressed: () {}, child: const Icon(Icons.add)),
),
);
}
}
```
</details>
# Before
https://github.com/user-attachments/assets/1581f431-f87a-4af3-8ef6-f1f0d170e54a
# After
https://github.com/user-attachments/assets/156a8a64-3d9f-4323-9a1d-60624f5ac5d4
## Related Issue
Fixes [SegmentedButton does not set its MaterialState for side
](https://github.com/flutter/flutter/issues/159884 )
## Tests
Adds 2 tests.
2025-07-29 23:53:22 +00:00
Bruno Leroux
41c21bbf92
Apply normalization to TimePickerThemeData.inputDecorationTheme ( #171584 )
...
## Description
This PR is similar to what was done for `DatePickerThemeData` in
https://github.com/flutter/flutter/pull/168981 .
It changes `TimePickerThemeData.inputDecorationTheme` type to
`InputDecorationThemeData` (instead of `InputDecorationTheme`) and uses
Object? for the corresponding constructor parameter.
## Tests
Adds 1 test
2025-07-09 09:11:10 +00:00
Kate Lovett
a04fb324be
Bump Dart to 3.8 and reformat ( #171703 )
...
Bumps the Dart version to 3.8 across the repo (excluding
engine/src/flutter/third_party) and applies formatting updates from Dart
3.8.
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-07-07 17:58:32 +00:00
Valentin Vignal
bf3e8566eb
Add backgroundColor to RadioThemeData ( #171326 )
...
Part of https://github.com/flutter/flutter/issues/168787
Follow-up of https://github.com/flutter/flutter/pull/171204
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-07-02 18:38:08 +00:00
Bruno Leroux
de3f804590
Normalize input decoration theme ( #168981 )
...
This PR is to make `InputDecorationTheme` conform to Flutter Material's
conventions for component themes:
- Added a `InputDecorationThemeData` class which defines overrides for
the defaults for `InputDecorator` properties.
- Added `InputDecorationTheme` constructor parameters:
`InputDecorationThemeData? data` and `Widget? child`. This is now the
preferred way to configure a `InputDecorationTheme`:
```dart
InputDecorationTheme(
data: InputDecorationThemeData(
filled: true,
fillColor: Colors.amber,
...
),
child: const TextField()
)
```
These two properties are made nullable to not break existing apps which
has customized `ThemeData.inputDecorationTheme`.
- Update `InputDecorationTheme` to be an `InheritedTheme` subclass.
- Changed the type of component theme defaults from
`InputDecorationTheme` to `InputDecorationThemeData`.
- Changed the `InputDecorationTheme bottomAppBarTheme` property to
`Object? bottomAppBarTheme` in `ThemeData` and `ThemeData.copyWith()`
(Object? is used for the moment to minimize Google tests failure. A
follow-up PR will replace `Object?` with `InputDecorationThemeData`.
- Addresses the "theme normalization" sub-project within #91772 .
A migration guide will be created on website repo.
2025-06-21 23:02:13 +00:00
Huy
41acbd244d
Normalize AppBarTheme ( #169130 )
...
This PR is to make `AppBarTheme` conform to Flutter Material's
conventions for component themes:
- Added a `AppBarThemeData` class which defines overrides for the
defaults for `AppBar` properties.
- Added AppBarTheme constructor parameters: `AppBarThemeData? data` and
`Widget? child`. This is now the preferred way to configure a
`AppBarTheme`:
```dart
AppBarTheme(
data: AppBarThemeData(),
child: Scaffold(
appBar: AppBar(
title: xxx,
leading: xxx,
actions: xxx,
),
),
```
These two properties are made nullable to not break existing apps which
has customized `ThemeData.appBarTheme`.
- Update `AppBarTheme` to be an `InheritedWidget` subclass.
- Changed the type of component theme defaults from `AppBarTheme` to
`AppBarThemeData`.
- Add new tests for `AppBarThemeData` and update the existing
`AppBarTheme` tests.
- This also temporarily changes `AppBarThemeData` to `Object?` in
`ThemeData` class, to bypass g3 tests, following
https://github.com/flutter/flutter/pull/168586#discussion_r2082606584 .
- Addresses the "theme normalization" sub-project within
https://github.com/flutter/flutter/issues/91772 .
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
---------
Signed-off-by: huycozy <huy@nevercode.io>
Co-authored-by: Qun Cheng <chengqunq@gmail.com>
2025-06-20 23:07:37 +00:00
Taha Tesser
559c314ba3
Update the RangeSlider widget to the 2024 Material Design appearance ( #163736 )
...
Fixes [Update `RangeSlider` for Material 3
redesign](https://github.com/flutter/flutter/issues/162505 )
### Description
This PR updates `RangeSlider` with `year2023` flag which can be used to
opt into the 2024 `RangeSlider design appearance.
### Code Sample
<details>
<summary>expand to view the code sample</summary>
```dart
import 'package:flutter/material.dart';
void main() => runApp(const RangeSliderExampleApp());
class RangeSliderExampleApp extends StatelessWidget {
const RangeSliderExampleApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
sliderTheme: const SliderThemeData(
showValueIndicator: ShowValueIndicator.always,
),
),
home: Scaffold(
appBar: AppBar(title: const Text('RangeSlider Sample')),
body: const RangeSliderExample(),
),
);
}
}
class RangeSliderExample extends StatefulWidget {
const RangeSliderExample({super.key});
@override
State<RangeSliderExample> createState() => _RangeSliderExampleState();
}
class _RangeSliderExampleState extends State<RangeSliderExample> {
RangeValues _currentRange1Values = const RangeValues(20.0, 60.0);
RangeValues _currentRange2Values = const RangeValues(30.0, 80.0);
@override
Widget build(BuildContext context) {
return Column(
spacing: 20.0,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
RangeSlider(
year2023: false,
values: _currentRange1Values,
max: 100,
onChanged: (RangeValues values) {
setState(() {
_currentRange1Values = values;
});
},
),
RangeSlider(
year2023: false,
values: _currentRange2Values,
max: 100,
divisions: 10,
labels: RangeLabels(
_currentRange2Values.start.round().toString(),
_currentRange2Values.end.round().toString(),
),
onChanged: (RangeValues values) {
setState(() {
_currentRange2Values = values;
});
},
),
],
);
}
}
```
</details>
| Preview 1 | Preview 2 |
| --------------- | --------------- |
| <img
src="https://github.com/user-attachments/assets/e14a1b04-4e32-4b37-b2f5-2d2001f53114 "/>
| <img
src="https://github.com/user-attachments/assets/aad36529-d576-4ec7-b2e5-49c9387456be "/>
|
# Custom track gap and thumb size
<img width="343" alt="Screenshot 2025-02-20 at 15 26 09"
src="https://github.com/user-attachments/assets/06c09679-1df8-4380-b3e6-c4add8f0cc42 "
/>
<img width="338" alt="Screenshot 2025-02-20 at 15 27 19"
src="https://github.com/user-attachments/assets/6226c515-f96b-412a-b59e-cafd2fba0515 "
/>
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-05-19 17:10:12 +00:00
Huy
494b08b420
Normalize BottomAppBarTheme ( #168586 )
...
This PR is to make `BottomAppBarTheme` conform to Flutter Material's
conventions for component themes:
- Added a `BottomAppBarThemeData` class which defines overrides for the
defaults for `BottomAppBar` properties.
- Added `BottomAppBarTheme` constructor parameters:
`BottomAppBarThemeData? data` and `Widget? child`. This is now the
preferred way to configure a `BottomAppBarTheme`:
```dart
BottomAppBarTheme(
data: BottomAppBarThemeData(
color: xxx,
height: xxx,
elevation: xxx,
shape: xxx,
...
),
child: const BottomAppBar()
)
```
These two properties are made nullable to not break existing apps which
has customized `ThemeData.bottomAppBarTheme`.
- Update `BottomAppBarTheme` to be an `InheritedWidget` subclass.
- Changed the type of component theme defaults from `BottomAppBarTheme`
to `BottomAppBarThemeData`.
- Changed the `BottomAppBarTheme bottomAppBarTheme` property to
`BottomAppBarThemeData bottomAppBarTheme` in `ThemeData` and
`ThemeData.copyWith()`. This may cause breaking changes, a migration
guide will be created on website repo.
- Add new tests for `BottomAppBarThemeData` and update the existing
`BottomAppBarTheme` tests. And also turn to `true` for `useMaterial3`
(along with usages accordingly) at the common method `_withTheme()`
since `useMaterial3` is true by default.
- Addresses the "theme normalization" sub-project within #91772 .
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
---------
Signed-off-by: huycozy <huy@nevercode.io>
2025-05-14 17:38:18 +00:00
Mairon Lucas
dc7c2892d9
modify toggle mode style with DatePickerTheme ( #164102 )
...
- Add properties to DatePickerThemeData:
- `toggleModeStyle` allow customization on _DatePickerModeToggleButton
TextStyle;
- `toggleModeForegroundColor` allow changing the color of both button
and Icon with consistency;
- Compatible with existing code by the use of defaults;
- Adjust test to cover new properties
How to customize toggle mode style before:
```dart
showDatePicker(
context: context,
firstDate: DateTime(2025),
lastDate: DateTime(2026),
builder:
(context, child) => Theme(
data: ThemeData.light().copyWith(
textTheme: TextTheme(titleSmall: TextStyle(fontSize: 16)),
datePickerTheme: DatePickerThemeData(
dayStyle: TextStyle(fontSize: 12),
),
),
child: child!,
),
);
```
Now:
```dart
showDatePicker(
context: context,
firstDate: DateTime(2025),
lastDate: DateTime(2026),
builder:
(context, child) => DatePickerTheme(
data: DatePickerThemeData(
toggleModeStyle: TextStyle(fontSize: 16),
dayStyle: TextStyle(fontSize: 12),
),
child: child!,
),
);
```
Ref #163866
Ref #160591
<!--
Thanks for filing a pull request!
Reviewers are typically assigned within a week of filing a request.
To learn more about code review, see our documentation on Tree Hygiene:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
-->
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-04-11 19:38:16 +00:00
Kishan Rathore
c6c3876ba9
Feat: Add yearShape property to DatePickerThemeData ( #163909 )
...
Feat: Add yearShape property to DatePickerThemeData
fixes : #163340
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
---------
Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2025-04-07 06:09:29 +00:00
Kishan Rathore
a59795e812
Refactor: Migrate Date picker from MaterialState and MaterialStateProperty ( #164972 )
...
Refactor: Migrate Date picker from MaterialState and
MaterialStateProperty to WidgetState and WidgetStateProperty
Part 1 of: #161052
Part 2 will contain addition of `selectedBackgroundColor` and
`selectedForegroundColor` which fully adds the requested feature.
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
2025-03-27 23:29:29 +00:00
Taha Tesser
9d7d36cfba
Fix Checkbox default visual density to meet Material 3 guidelines ( #159081 )
...
Fixes [Compact Visual Density is wrongfully applied to Checkboxes with
`MaterialTapTargetSize.padded` on desktop platforms according to
Material 3 Guidelines](https://github.com/flutter/flutter/issues/156408 )
### Description
This PR updates default `Checkbox` visual density to not depend on
`ThemeData.visualDenSity` as it will return `VisualDensity.compact` on
desktop and break Material 3 guidelines for `Checkbox`.
> [!NOTE]
> This makes a similar fix as
https://github.com/flutter/flutter/pull/110722 .
### 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(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ColoredBox(
color: Colors.amber,
child: Checkbox(
materialTapTargetSize: MaterialTapTargetSize.padded,
value: true,
onChanged: (bool? value) {},
),
),
Container(
width: 48,
height: 48,
color: Colors.red,
alignment: Alignment.center,
child: const Text(
'48x48px',
style: TextStyle(fontSize: 10, color: Colors.white),
),
)
],
),
),
),
);
}
}
```
</details>
<img width="577" alt="Screenshot 2024-11-18 at 18 02 01"
src="https://github.com/user-attachments/assets/d390c92f-dd62-4c42-b6b7-d4f101078618 ">
<img width="577" alt="Screenshot 2024-11-18 at 18 01 49"
src="https://github.com/user-attachments/assets/632e8d19-11bf-45c7-9be9-5c4fc308f3ea ">
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2025-01-30 20:03:56 +00:00
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
Taha Tesser
e21db87817
Introduce CircularProgressIndicator.padding for the updated M3 specs ( #159271 )
...
Fix [Add `CircularProgressIndicator` padding to match M3
specs](https://github.com/flutter/flutter/issues/159267 )
### 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(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
width: 40,
height: 40,
color: Colors.red,
alignment: Alignment.center,
child: const Text(
'40x40px',
style: TextStyle(fontSize: 8, color: Colors.white),
),
),
const ColoredBox(
color: Colors.amber,
child: CircularProgressIndicator(
year2023: false,
value: 0.4,
),
),
Container(
width: 48,
height: 48,
color: Colors.red,
alignment: Alignment.center,
child: const Text(
'48x48px',
style: TextStyle(fontSize: 10, color: Colors.white),
),
)
],
),
),
),
);
}
}
```
</details>
### Preview
<img width="454" alt="Screenshot 2024-11-21 at 17 13 25"
src="https://github.com/user-attachments/assets/6f7520f1-a213-4814-8116-6dd996639eec ">
### Specs

## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-11-22 18:42:57 +00:00
Taha Tesser
1686fa7eb4
Update Material 3 CircularProgressIndicator for new visual style ( #158104 )
...
Related [Update both `ProgressIndicator` for Material 3
redesign](https://github.com/flutter/flutter/issues/141340 )
Fixes [Issue: Cannot theme progress indicators, many properties
missing](https://github.com/flutter/flutter/issues/131690 )
Fixes [Cannot override default `CircularProgressIndicator`
size](https://github.com/flutter/flutter/issues/158106 )
### 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 StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
// progressIndicatorTheme: const ProgressIndicatorThemeData(
// constraints: BoxConstraints.tightFor(width: 100, height: 100),
// strokeWidth: 12
// ),
),
home: Scaffold(
appBar: AppBar(title: const Text('CircularProgressIndicator')),
body: const Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
CircularProgressIndicator(year2023: false, value: 0.5),
CircularProgressIndicator(year2023: false),
],
),
),
),
);
}
}
```
</details>
### Preview
<img width="579" alt="Screenshot 2024-11-04 at 16 01 57"
src="https://github.com/user-attachments/assets/d27768c6-5570-48d0-9eed-565e02be8041 ">
### New custom `CircularProgressIndicator.constraints` and stroke width
<img width="579" alt="Screenshot 2024-11-04 at 16 02 40"
src="https://github.com/user-attachments/assets/c67c4a31-58f4-4f82-bfb6-f1b78a000bac ">
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-11-19 23:23:26 +00:00
Taha Tesser
56cfef73fc
Introduce new Material 3 Slider shapes ( #152237 )
...
fixes [Update `Slider` for Material 3
redesign](https://github.com/flutter/flutter/issues/141842 )
previous implementation https://github.com/flutter/flutter/pull/147783
### Description
This PR introduces new Material 3 Slider design.
### Slider Preview
<img width="912" alt="Screenshot 2024-07-24 at 16 38 11"
src="https://github.com/user-attachments/assets/9645ff6c-b72a-40aa-ae95-4f76994f8302 ">
<img width="912" alt="Screenshot 2024-07-24 at 16 38 24"
src="https://github.com/user-attachments/assets/fbaed8bb-2717-43a9-9415-ea1365165d9a ">
### Value indicator Preview
https://github.com/user-attachments/assets/45fa001c-de81-433a-a8e9-6c0d6a2335c0
### New stop indicator
https://github.com/user-attachments/assets/ad05621d-042d-4b17-9dbb-7f7b802a2593
### Customized
<img width="912" alt="Screenshot 2024-07-24 at 16 41 49"
src="https://github.com/user-attachments/assets/2f279240-5af8-4bc8-9c65-a4b4ac718101 ">
## Pre-launch Checklist
- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-11-19 19:10:44 +00:00
Rexios
cc6ee0cc32
Add constraint options to SearchAnchor suggestions builder ( #148856 )
...
Refactors the `SearchAnchor` suggestions builder to not take up the whole screen
https://github.com/flutter/flutter/issues/148852
2024-11-14 01:19:09 +00:00
Taha Tesser
7abb083ae2
Add ability to override NavigationDestination.label padding for NavigationBar ( #158260 )
...
Fixes [Long NavigationBar tab titles can't be padded from the sides of the screen](https://github.com/flutter/flutter/issues/158130 )
### 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(
debugShowCheckedModeBanner: false,
theme: ThemeData(
navigationBarTheme: const NavigationBarThemeData(
labelTextStyle:
WidgetStatePropertyAll(TextStyle(overflow: TextOverflow.ellipsis)),
labelPadding: EdgeInsets.symmetric(horizontal: 16, vertical: 4),
)),
home: Scaffold(
body: Center(
child: Text(
'Custom NavigationBar label padding',
style: Theme.of(context).textTheme.titleMedium,
),
),
bottomNavigationBar: NavigationBar(
destinations: const [
NavigationDestination(
icon: Icon(Icons.favorite_rounded),
label: 'Long Label Text',
),
NavigationDestination(
// icon: SizedBox.shrink(),
icon: Icon(Icons.favorite_rounded),
label: 'Long Label Text',
),
NavigationDestination(
icon: Icon(Icons.favorite_rounded),
label: 'Long Label Text',
),
],
),
),
);
}
}
```
</details>
### Default `NavigationDestination.label` padding with long label
<img width="458" alt="Screenshot 2024-11-06 at 14 30 52" src="https://github.com/user-attachments/assets/637e5e66-e05f-49fa-a4ae-72083b6ff884 ">
### Custom `NavigationDestination.label` padding with long label
<img width="458" alt="Screenshot 2024-11-06 at 14 32 02" src="https://github.com/user-attachments/assets/23ebf715-30d3-433c-92cd-c8f0fdb1571b ">
2024-11-08 14:19:18 +00:00
Taha Tesser
b8dcb0c3c5
Update Material 3 LinearProgressIndicator for new visual style ( #154817 )
...
Related to [Update both `ProgressIndicator` for Material 3 redesign](https://github.com/flutter/flutter/issues/141340 )
### 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 StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
bool isRTL = false;
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Directionality(
textDirection: isRTL ? TextDirection.rtl : TextDirection.ltr,
child: Center(
child: Column(
spacing: 2.0,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text('Default LinearProgressIndicator'),
const Padding(
padding: EdgeInsets.all(16.0),
child: LinearProgressIndicator(
value: 0.45,
),
),
const Text('Default indefinite LinearProgressIndicator'),
const Padding(
padding: EdgeInsets.all(16.0),
child: LinearProgressIndicator(),
),
const Text('Updated height and border radius'),
Padding(
padding: const EdgeInsets.all(16.0),
child: LinearProgressIndicator(
value: 0.25,
minHeight: 16.0,
borderRadius: BorderRadius.circular(16.0),
),
),
const Text('Updated stop indicator color and radius'),
Padding(
padding: const EdgeInsets.all(16.0),
child: LinearProgressIndicator(
value: 0.74,
minHeight: 16.0,
borderRadius: BorderRadius.circular(16.0),
stopIndicatorColor: Theme.of(context).colorScheme.error,
stopIndicatorRadius: 32.0,
),
),
const Text('Track gap and stop indicator radius set to 0'),
Padding(
padding: const EdgeInsets.all(16.0),
child: LinearProgressIndicator(
value: 0.50,
minHeight: 16.0,
borderRadius: BorderRadius.circular(16.0),
trackGap: 0,
stopIndicatorRadius: 0,
),
),
],
),
),
),
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
setState(() {
isRTL = !isRTL;
});
},
label: const Text('Toggle Direction'),
),
),
);
}
}
```
</details>
### Preview
<img width="824" alt="Screenshot 2024-09-09 at 13 53 10" src="https://github.com/user-attachments/assets/d12e56a5-f196-4011-8266-c7ab96be96b2 ">
2024-10-30 18:14:11 +00:00
Nate Wilson
6b1bc456f4
Arrow syntax for getters ( #156483 )
...
This egotistical PR aims to draw attention to a [style guideline](https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#use--for-getters-and-callbacks-that-just-return-literals-or-switch-expressions ) that I changed:
> #### Use `=>` for getters and callbacks that just return literals or switch expressions
<br>
There was an opportunity for valuable discussion in #154753 about how this structure affects readability, but I shut it down pretty quick since there was a lot of other stuff going on there.
Interested to hear thoughts from @Piinks and others.
2024-10-17 19:25:14 +00:00
Crafti
0ce5285051
Implement actionsPadding for AppBar ( #155632 )
...
This pull requests adds a new `actionsPadding` property to AppBar, which controls the padding of the actions row's end. By default, no padding is added.
As it was already discussed in the linked issue below (https://github.com/flutter/flutter/issues/115349#issuecomment-1315582192 ), it is not feasible to change defaults. This PR is an interim solution to allow developers to change layout across the app, until that change/transition can be made (see: the new TODO line).
Different to the original code from 2018, this PR only adds padding to the actual actions row, instead of the entire `NavigationToolbar`.
Fixes #155747
2024-10-17 13:03:22 +00:00
Rexios
e96aaab5e0
Add padding options to SearchAnchor ( #152508 )
...
Cherry-picked padding changes from https://github.com/flutter/flutter/pull/148856
Adds padding configuration options to `SearchAnchor`. This PR adds the following:
- `viewBarPadding`: The padding for items inside the `SearchBar` in the `SearchAnchor` view
- `viewPadding`: The padding to use around the entire `SearchAnchor` view
Working towards https://github.com/flutter/flutter/issues/148852
2024-10-15 20:24:48 +00:00
Qun Cheng
33d3e4bda6
Reland TabBarTheme normalization ( #155969 )
...
Reland https://github.com/flutter/flutter/pull/155476 with test fix.
The test fix uses the method mentioned in https://github.com/flutter/flutter/pull/155476#issuecomment-2377287606 .
2024-10-01 20:13:52 +00:00
auto-submit[bot]
1c9607fc9c
Reverts "Normalize TabBarTheme ( #155476 )" ( #155698 )
...
Reverts: flutter/flutter#155476
Initiated by: eyebrowsoffire
Reason for reverting: The newly added tests are failing in postsubmit. See https://ci.chromium.org/ui/p/flutter/builders/prod/Windows%20framework_tests_libraries/19062/overview
Original PR Author: QuncCccccc
Reviewed By: {TahaTesser}
This change reverts the following previous change:
This PR is to make preparations to make `TabBarTheme` conform to Flutter's conventions for component themes:
* Added a `TabBarThemeData` class which defines overrides for the defaults for `TabBar` properties.
* Added 2 `TabBarTheme` constructor parameters: `TabBarThemeData? data` and `Widget? child`. This is now the preferred way to configure a `TabBarTheme`:
```
TabBarTheme(
data: TabBarThemeData(labelColor: xxx, indicatorColor: xxx, ...),
child: TabBar(...)
)
```
These two properties are made nullable to not break existing apps which has customized `ThemeData.tabBarTheme`.
* Changed the type of component theme defaults from `TabBarTheme` to `TabBarThemeData`.
TODO:
* Fix internal failures.
* Change the type of `ThemeData.tabBarTheme` from `TabBarTheme` to `TabBarThemeData`. This may cause breaking changes, a migration guide will be created.
Addresses the "theme normalization" sub project within https://github.com/flutter/flutter/issues/91772
2024-09-25 17:50:18 +00:00
Qun Cheng
f310625bc6
Normalize TabBarTheme ( #155476 )
...
This PR is to make preparations to make `TabBarTheme` conform to Flutter's conventions for component themes:
* Added a `TabBarThemeData` class which defines overrides for the defaults for `TabBar` properties.
* Added 2 `TabBarTheme` constructor parameters: `TabBarThemeData? data` and `Widget? child`. This is now the preferred way to configure a `TabBarTheme`:
```
TabBarTheme(
data: TabBarThemeData(labelColor: xxx, indicatorColor: xxx, ...),
child: TabBar(...)
)
```
These two properties are made nullable to not break existing apps which has customized `ThemeData.tabBarTheme`.
* Changed the type of component theme defaults from `TabBarTheme` to `TabBarThemeData`.
TODO:
* Fix internal failures.
* Change the type of `ThemeData.tabBarTheme` from `TabBarTheme` to `TabBarThemeData`. This may cause breaking changes, a migration guide will be created.
Addresses the "theme normalization" sub project within https://github.com/flutter/flutter/issues/91772
2024-09-25 17:19:00 +00:00
Nate Wilson
bfa04edca6
un-break ThemeData equality ( #154695 )
...
This PR is _almost_ able to close issue #89127 .
Sadly, no `InheritedModel` or custom `RenderObject`s today; instead the [WidgetState operators](https://main-api.flutter.dev/flutter/widgets/WidgetStateOperators.html ) have been restructured to support equality checks.
`WidgetStateProperty.fromMap()` is now capable of accurate equality checks, and all of the `.styleFrom()` methods have been refactored to use that constructor.
(Equality checks are still broken for `WidgetStateProperty.resolveWith()`, and any other non-`const` objects that implement the interface.)
<br><br>
credit for this idea goes to @justinmc: https://github.com/flutter/flutter/issues/89127#issuecomment-2313187703
2024-09-09 21:49:09 +00:00
Qun Cheng
6dd929ab28
Normalize Dialog theme ( #153982 )
...
This PR is to make preparations to make `DialogTheme` conform to Flutter's conventions for component themes:
* Added a `DialogThemeData` class which defines overrides for the defaults for `Dialog` properties.
* Added 2 `DialogTheme` constructor parameters: `DialogThemeData? data` and `Widget? child`. This is now the preferred way to configure a `DialogTheme`:
```
DialogTheme(
data: DialogThemeData(color: xxx, elevation: xxx, ...),
child: Dialog(...)
)
```
These two properties are made nullable to not break existing apps which has customized `ThemeData.dialogTheme`.
* Changed the type of theme defaults from `DialogTheme` to `DialogThemeData`.
TODO:
* Fix internal failures.
* Change the type of `ThemeData.dialogTheme` from `DialogTheme` to `DialogThemeData`. This may cause breaking changes, a migration guide will be created.
Addresses the "theme normalization" sub project within https://github.com/flutter/flutter/issues/91772
2024-09-05 22:00:23 +00:00
Taha Tesser
d7b092e42d
Fix TimePicker hour and minute inputs are resized on error ( #154008 )
...
Fixes [Defining inputDecorationTheme in TimePickerThemeData Causes Misalignment of Hour and Minute Input Boxes](https://github.com/flutter/flutter/issues/153549 )
### 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(
debugShowCheckedModeBanner: false,
theme: ThemeData(
timePickerTheme: const TimePickerThemeData(
inputDecorationTheme: InputDecorationTheme(),
),
),
home: Scaffold(
body: Center(
child: Builder(builder: (BuildContext context) {
return ElevatedButton(
onPressed: () async {
await showTimePicker(
context: context,
initialEntryMode: TimePickerEntryMode.input,
initialTime: TimeOfDay.now(),
);
},
child: const Text('Show Time Picker'),
);
}),
),
),
);
}
}
```
</details>
### Before
<img width="578" alt="Screenshot 2024-08-23 at 16 49 25" src="https://github.com/user-attachments/assets/f5da2495-551e-4110-85ea-120323cd38d2 ">
### After
<img width="578" alt="Screenshot 2024-08-23 at 16 51 03" src="https://github.com/user-attachments/assets/80224a10-e9d2-46d1-b2eb-f16358699744 ">
2024-08-23 17:15:36 +00:00
Greg Spencer
51ed348f3b
Fix handling of iconSize and iconColor defaults for ButtonStyleButton subclasses. ( #143501 )
...
## Description
Adds defaults that use tokens to define default `iconSize` and `iconColor` values. Previously, the Material 3 token values for button icon sizes and colors were not being used as defaults when the `ButtonStyleButton.defaultStyleOf` function returned the default values.
Adds tests to make sure appropriate `ButtonStyle` fields are populated when defaultStyle is called on buttons.
Updated documentation for `defaultStyleOf` to indicated that not _all_ fields need to be non-null, since some fields make sense to be null (e.g. `fixedSize`) because they would otherwise override the behavior of other fields in the same `ButtonStyle`.
## Tests
- Added tests to make sure that the appropriate fields are non-null in the default button styles for each type of button.
2024-08-02 23:31:07 +00:00
Qun Cheng
2e7fa83f67
Normalize Card theme ( #151914 )
...
This PR is to make preparations to make `CardTheme` conform to Flutter's conventions for component themes:
* Added a `CardThemeData` class which defines overrides for the defaults for `Card` properties.
* Added 2 `CardTheme` constructor parameters: `CardThemeData? data` and `Widget? child`. This is now the preferred way to configure a `CardTheme`:
```dart
CardTheme(
data: CardThemeData(color: xxx, elevation: xxx, ...),
child: Card(...)
)
```
These two properties are made nullable to not break existing apps which has customized `ThemeData.cardTheme`.
* Changed the type of theme defaults from `CardTheme` to `CardThemeData`.
TODO:
* Fix internal failures that may have breakages.
* Change the type of `ThemeData.cardTheme` from `CardTheme` to `CardThemeData`. This may cause breaking changes, a migration guide will be created.
Addresses the "theme normalization" sub project within https://github.com/flutter/flutter/issues/91772
2024-07-29 16:48:06 +00:00
Taha Tesser
e1cd7b11f6
Introduce Switch.padding ( #149884 )
...
fixes [Switch has some padding that leads to uncentered UI](https://github.com/flutter/flutter/issues/148498 )
### 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(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ColoredBox(
color: Colors.amber,
child: Switch(
padding: EdgeInsets.zero,
value: true,
materialTapTargetSize: MaterialTapTargetSize.padded,
onChanged: (bool value) {},
),
),
const SizedBox(height: 16),
ColoredBox(
color: Colors.amber,
child: Switch(
value: true,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onChanged: (bool value) {},
),
),
],
),
),
),
);
}
}
```
</details>
### Default Switch size
<img width="476" alt="Screenshot 2024-07-11 at 13 25 05" src="https://github.com/flutter/flutter/assets/48603081/f9f3f6c6-443d-4bd5-81d4-5e314554b032 ">
### Update Switch size using the new `Switch.padding` to address [Switch has some padding that leads to uncentered UI](https://github.com/flutter/flutter/issues/148498 )
<img width="476" alt="Screenshot 2024-07-11 at 13 24 40" src="https://github.com/flutter/flutter/assets/48603081/aea0717b-e852-4b8d-b703-c8c4999d4863 ">
2024-07-16 20:25:09 +00:00
Bruno Leroux
00419bfb24
Reland fix inputDecorator hint color on M3 ( #150278 )
...
## Description
This PR is a partial reland of https://github.com/flutter/flutter/pull/148944 which was reverted in https://github.com/flutter/flutter/pull/149448 .
It makes the `InputDecoration.hintText` colors compliant with the M3 spec.
The initial PR also changed the font style, I will land the font change in another PR to better track the golden changes.
## Related Issue
Related to the color part of https://github.com/flutter/flutter/issues/148787 .
## Tests
Updates several tests.
2024-06-25 21:42:59 +00:00
Bruno Leroux
4b0c8414fc
Make popup menu hardcoded padding configurable ( #150506 )
...
## Description
This PR exposed `PopupMenuButton.menuPadding` parameter to override the hardcoded value.
Credits to @Moluram for the original PR https://github.com/flutter/flutter/pull/81996 .
And to @arafaysaleem for the update in https://github.com/flutter/flutter/pull/96657 .
https://github.com/flutter/flutter/pull/96657 was reverted due to a Google testing failure. `PopupMenuButton` implementation has evolved since that time so maybe we will not hit this Google testing failure. And if we do, we will try to figure out what is going on.
## Related Issue
Fixes https://github.com/flutter/flutter/issues/143512 .
Fixes https://github.com/flutter/flutter/issues/57110
## Tests
Adds 2 tests, updates several tests.
2024-06-20 19:18:21 +00:00
Bruno Leroux
4608a89137
Fix InputDecorator suffixIcon color when in error and hovered ( #149643 )
...
## Description
This PRs makes the `InputDecoration.suffixIcon` color compliant with the M3 spec when in error state and hovered.
From M3 spec, the color should be `onErrorContainer`, see https://m3.material.io/components/text-fields/specs#e4964192-72ad-414f-85b4-4b4357abb83c

## Related Issue
Fixes https://github.com/flutter/flutter/issues/149410 .
## Tests
Updates 2 tests.
2024-06-06 06:11:25 +00:00
Michael Goderbauer
fbc0ff1f3b
Fix signature for TokenTemplate.updateFile ( #149673 )
...
This method isn't supposed to do any async work.
2024-06-05 20:51:06 +00:00
Bruno Leroux
e02d29d52e
Fix InputDecorator.prefixIcon color when disabled ( #149595 )
...
## Description
This PRs makes the `InputDecoration.prefixIcon` color compliant with the M3 spec.
From M3 spec, the color should be `onSurface.withOpacity(0.38)`, see https://m3.material.io/components/text-fields/specs#e4964192-72ad-414f-85b4-4b4357abb83c

## Related Issue
Fixes https://github.com/flutter/flutter/issues/149411 .
## Tests
Updates 2 tests.
2024-06-03 18:53:16 +00:00
auto-submit[bot]
fc8ab3b4b4
Reverts "Fix InputDecorator default hint text style on M3 ( #148944 )" ( #149448 )
...
Reverts: flutter/flutter#148944
Initiated by: loic-sharma
Reason for reverting: This caused Skia golden changes that might be unexpected. We can reland once we confirm these changes are expected, or, fixed the changes to the floating label.
Original PR Author: bleroux
Reviewed By: {Renzo-Olivares, guidezpl}
This change reverts the following previous change:
## Description
This PRs makes the `InputDecoration.hintText` style compliant with the M3 spec.
The hint style is not clearly specified in https://m3.material.io/components/text-fields/specs , but it is in the M3 Figma kit.
('hint' terminology came from the Material1 specification, since M2 the terminology is 'Placeholder').
See this Figma screenshot taken while focusing on the 'Placeholder' text (which corresponds to hint).

It seems that the intention is that the 'Placeholder' colors should be the same as the 'supporting text' ones, that is why is reused 'supporting text' tokens.
## Related Issue
Fixes https://github.com/flutter/flutter/issues/148787 .
## Tests
Updates several tests.
2024-05-31 22:06:26 +00:00
Bruno Leroux
b201fbdee5
Fix InputDecorator default hint text style on M3 ( #148944 )
...
## Description
This PRs makes the `InputDecoration.hintText` style compliant with the M3 spec.
The hint style is not clearly specified in https://m3.material.io/components/text-fields/specs , but it is in the M3 Figma kit.
('hint' terminology came from the Material1 specification, since M2 the terminology is 'Placeholder').
See this Figma screenshot taken while focusing on the 'Placeholder' text (which corresponds to hint).

It seems that the intention is that the 'Placeholder' colors should be the same as the 'supporting text' ones, that is why is reused 'supporting text' tokens.
## Related Issue
Fixes https://github.com/flutter/flutter/issues/148787 .
## Tests
Updates several tests.
2024-05-31 20:56:07 +00:00
Nate
73ecc8a9b2
Reland "if chains → switch expressions" ( #148634 )
...
I did a goof a while back:

Now that [the bug is fixed](e9d403541f ), I think we're good to re-implement the if-chains cleanup!
Related:
- https://github.com/flutter/flutter/pull/147793
- https://github.com/flutter/flutter/pull/148556
- https://github.com/flutter/flutter/issues/148548
2024-05-20 17:43:00 +00:00
Zachary Anderson
597462a3c4
Revert "if chains → switch expressions" ( #148556 )
...
Reverts flutter/flutter#147793
Introduced https://github.com/flutter/flutter/issues/148548 .
2024-05-17 10:27:02 -07:00
Valentin Vignal
ffae7c60c2
Add clipBehavior to DrawerThemeData ( #148061 )
...
Fixes https://github.com/flutter/flutter/issues/148060
2024-05-15 18:37:07 +00:00