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
Kyle Finlinson
b8157ceb60
Use gestureSettings.touchSlop in PrimaryPointerGestureRecognizer ( #161549 )
...
<!--
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
-->
Use `gestureSettings.touchSlop` in
`PrimaryPointerGestureRecognizer.handleEvent()` unless a non-default
value (including `null`) is specified.
This behavior will be reflected in subclasses (`TapGestureRecognizer`
and `LongPressGestureRecognizer`) and enable `GestureDetector` tap and
long-press touch slop to be configured out of the box with `MediaQuery`
instead of providing custom gesture recognizers:
```dart
// After this PR you can do this:
child: MediaQuery(
data: MediaQuery.of(context).copyWith(
gestureSettings: const DeviceGestureSettings(touchSlop: 64),
),
child: GestureDetector(
onTap: widget.onTap,
child: Container(),
),
// instead of this:
child: RawGestureDetector(
gestures: <Type, GestureRecognizerFactory>{
TapGestureRecognizer: GestureRecognizerFactoryWithHandlers<TapGestureRecognizer>(
// Without https://github.com/flutter/flutter/pull/161541 , we'll actually need to make
// our own custom TapGestureRecognizer class to expose slop parameters too.
() => TapGestureRecognizer(preAcceptSlopTolerance: 64, postAcceptSlopTolerance: 64, onTap: onTap),
(TapGestureRecognizer instance) {},
),
},
child: Container(),
),
```
*List which issues are fixed by this PR. You must list at least one
issue. An issue is not required if the PR fixes something trivial like a
typo.*
https://github.com/flutter/flutter/issues/154215
*If you had to change anything in the [flutter/tests] repo, include a
link to the migration guide as per the [breaking change policy].*
## 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].
<!-- 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-21 22:59:36 +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
Nate Wilson
788a0e3d2f
Implementing null-aware logic in /packages/flutter/ ( #152294 )
...
Hopefully soon, [flutter.dev/go/dart-patterns](https://flutter.dev/go/dart-patterns ) will have lots of good feedback; in the meantime, I'll focus refactoring efforts on uncontroversial things :)
Previously, I was under the impression that I could solve issue #143803 with [just 1 PR](https://github.com/flutter/flutter/pull/143804 ).
It turns out that I had overlooked quite a bit!
<br>
```dart
// before
if (chunkEvents != null) {
chunkEvents.listen((ImageChunkEvent event) {
reportImageChunkEvent(event);
},
);
}
// after
chunkEvents?.listen(reportImageChunkEvent);
```
2024-07-31 23:35:24 +00:00
Dimil Kalathiya
158a9a8177
fixes some gesture not getting disposed ( #147112 )
2024-04-20 10:20:37 -07:00
Kostia Sokolovskyi
a6aaad3487
GestureRecognizer should dispatch creation and disposal events. ( #138223 )
2023-11-10 13:14:14 -08:00
Kate Lovett
3570cce58e
Remove deprecated kind in GestureRecognizer et al ( #119572 )
...
* Remove deprecated kind in GestureRecognizer et al
* Fix null case
2023-02-03 01:34:17 +00:00
Michael Goderbauer
51bcdb9407
super parameters for framework ( #100905 )
2022-04-13 22:38:40 -07:00
Ian Hickson
ab89ce285f
Clean up the bindings APIs. ( #89451 )
2022-02-03 14:55:15 -08:00
Ren You
3dea9f0251
Revert "Clean up the bindings APIs ( #86438 )" ( #86484 )
...
This reverts commit d056500bfe6a712cdace450d06c4a8fb2290e63a.
2021-07-15 09:29:16 -07:00
Ian Hickson
d056500bfe
Clean up the bindings APIs ( #86438 )
2021-07-14 14:41:24 -07:00
Zachary Anderson
7f741e9181
Revert "Clean up the bindings APIs ( #86388 )" ( #86404 )
...
This reverts commit 31de052e3fddb4909ff88172a6937db7f3dc49db.
2021-07-13 21:32:29 -07:00
Ian Hickson
31de052e3f
Clean up the bindings APIs ( #86388 )
2021-07-13 18:31:11 -07:00
Ian Hickson
c800b9c3e4
Revert "Clean up the bindings APIs ( #83843 )" ( #86386 )
...
This reverts commit e2490f2906060d0aaecbbe34a9240ca3d54ef998.
2021-07-13 15:47:40 -07:00
Ian Hickson
e2490f2906
Clean up the bindings APIs ( #83843 )
2021-07-13 12:41:03 -07:00
Todd Volkert
1cf492f254
Re-apply "Gesture recognizer cleanup" ( #82885 )
...
This is a re-application of https://github.com/flutter/flutter/pull/81884 ,
but with https://github.com/flutter/flutter/pull/82834 landed first.
Fixes https://github.com/flutter/flutter/issues/81883
2021-05-19 16:32:15 -07:00
Todd Volkert
3fc408200e
Revert "Gesture recognizer cleanup ( #81884 )" ( #82831 )
...
This reverts commit e88a387b26b097d8516c92babe1287edede79206.
2021-05-18 09:50:24 -07:00
Todd Volkert
e88a387b26
Gesture recognizer cleanup ( #81884 )
...
* Gesture recognizer cleanup
1) Make OneSequenceGestureRecognizer.addAllowedPointer()
call startTrackingPointer(), and change subclasses to
call super.addAllowedPointer() in place of manually
calling startTrackingPointer().
2) Fix addAllowedPointer overrides to take PointerDownEvent
where some were taking PointerEvent.
3) Add API documentation to OneSequenceGestureRecognizer
4) Make the following fields in OneSequenceGestureRecognizer
private with public getters instead of publicly writable:
`state`, `primaryPointer`, and `initialPosition`.
5) Clean up gesture recognizer state in
OneSequenceGestureRecognizer.didStopTrackingLastPointer.
Fixes #81883
2021-05-17 16:53:49 -07:00
Kate Lovett
e74c15cac4
Deprecate GestureDetector.kind in favor of new supportedDevices ( #81858 )
2021-05-07 14:24:03 -07:00
Phil Quitslund
61c30c41b2
fix sort_directives violations ( #80817 )
2021-04-21 13:49:03 -07:00
Darren Austin
01e8c39534
Migrate gestures, physics and scheduler tests to null safety. ( #62701 )
2020-10-05 16:01:34 -07:00
Alexandre Ardhuin
4d7525f05c
Opt out nnbd in packages/flutter ( #59186 )
...
* add language version 2.8 in packages/flutter
* enable non-nullable analyzer flag
2020-06-11 14:11:30 +02:00
Ian Hickson
449f4a6673
License update ( #45373 )
...
* Update project.pbxproj files to say Flutter rather than Chromium
Also, the templates now have an empty organization so that we don't cause people to give their apps a Flutter copyright.
* Update the copyright notice checker to require a standard notice on all files
* Update copyrights on Dart files. (This was a mechanical commit.)
* Fix weird license headers on Dart files that deviate from our conventions; relicense Shrine.
Some were already marked "The Flutter Authors", not clear why. Their
dates have been normalized. Some were missing the blank line after the
license. Some were randomly different in trivial ways for no apparent
reason (e.g. missing the trailing period).
* Clean up the copyrights in non-Dart files. (Manual edits.)
Also, make sure templates don't have copyrights.
* Fix some more ORGANIZATIONNAMEs
2019-11-27 15:04:02 -08:00
Michael Goderbauer
ae23d4a490
Transform PointerEvents to the local coordinate system of the event receiver ( #32192 )
2019-05-31 16:48:50 -07:00
Alexandre Ardhuin
d927c93310
Unnecessary new ( #20138 )
...
* enable lint unnecessary_new
* fix tests
* fix tests
* fix tests
2018-09-12 08:29:29 +02:00
Jacob Richman
93a98327a8
Add Diagnosticable base class and add documentation. ( #11458 )
...
Add Diagnosticable base class and documentation
2017-08-03 09:49:44 -07:00
Ian Hickson
87445e5913
Increase the touch slop. ( #11419 )
...
It was 8.0. It's now arbitrarily 18.0.
Changing this required adjusting some tests. Adjusting the tests
required debugging the tests. Debugging the tests required some tools
to help debugging gesture recognizers and gesture arenas, so I added
some. It also required updating some toString() methods which resulted
in some changes to the tree diagnostics logic.
Also I cleaned up some docs while I was at it.
2017-07-27 14:01:06 -07:00
Chris Bracken
46291903e0
Declare locals final where not reassigned (tests) ( #8566 )
2017-03-03 17:43:22 -08:00
Adam Barth
a60fefc131
Improve test coverage ( #5473 )
...
These tests should hit some previously untested lines.
2016-08-17 18:18:07 -07:00