11404 Commits

Author SHA1 Message Date
Kostia Sokolovskyi
e8d9d9bfd5
HeroController should dispatch creation and disposal events. (#137835) 2023-11-03 20:42:47 -07:00
Alex Isaienko
b5fb6652d6
InheritedElement.removeDependent() (#129210)
Call the `dependency.removeDependent(this)` instead of `dependency._dependents.remove(this)` inside the `Element.deactivate()`. This allows `InheritedElements` to know when they can release resources associated with a given dependent `Element`.

Fixes #129207
2023-11-03 23:27:21 +00:00
Michael Goderbauer
8a0f9118ea
Remove unused generic type from BottomSheet (#137791)
Fixes https://github.com/flutter/flutter/issues/137424.

The generic type argument was unused.
2023-11-03 22:25:37 +00:00
Chris Bracken
4455e86d90
Send caret rect to embedder on selection update (#137863)
Background: In the framework, the position of the caret rect is updated on each cursor position change such that if the user initiates composing input, the current cursor position can be used for the first character until the composing rect can be sent.

Previously, no update was sent on selection changes, on the assumption that the most recent cursor position will remain the correct position for the duration of the selection. While this is the case for forward selections, it is an incorrect assumption for reversed selections, where selection.base > selection.extent.

We now update the cursor position during selection changes such that the cursor position sent to the embedder is always the position at which next text input would occur. This is the start position of the selection or min(selection.baseOffset, selection.extentOffset).

Issue: https://github.com/flutter/flutter/issues/137677
2023-11-03 22:09:09 +00:00
Chris Bobbe
e7f99821cc
Tooltip docs: Recommend setting preferBelow to false in theme (#135879)
As discussed at https://github.com/flutter/flutter/pull/133007#issuecomment-1743916183, this is a docs change meant to help people in the absence of a fix for #133006, which is being closed as WONTFIX.
2023-11-03 20:18:36 +00:00
Kostia Sokolovskyi
a52f030cda
InkFeature should dispatch creation and disposal events. (#137793) 2023-11-03 12:34:16 -07:00
Kostia Sokolovskyi
2369897f09
AppLifecycleListener should dispatch creation and disposal events. (#137840) 2023-11-03 12:31:46 -07:00
Hans Muller
3479aaba75
Updated the nested navigation NavigationBar example (#137788)
Updated the NavigationBar API doc that describes
examples/api/lib/material/navigation_bar/navigation_bar.2.dart and made
some cosmetic changes to the example to improve its appearance in
Material 3. Also did a little gratuitous reformatting.

Fixes #136125
2023-11-03 10:46:09 -07:00
Sam Rawlins
d796b013b2
Avoid passing a nullable value to potentially non-nullable parameters (#137359)
Also ignore one case where it is hard to fix.

The code with out the null assertion is legal as per the type signature,
but will throw a runtime exception if the nullable value is null. To
make this exception more explicit, the value must be null-checked before
completing the completer with the value.

The analyzer will soon enforce such checks. See
https://github.com/dart-lang/sdk/issues/53253.

Fixes https://github.com/flutter/flutter/issues/137294

## 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.
- [ ] 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] 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/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#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/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-11-02 12:59:23 -07:00
Valentin Vignal
f15f2313b9
Fixes DragTarget crash if Draggable.data is null (#133136)
Makes the `data` parameter of `Draggable` non-nullable.

Fixes https://github.com/flutter/flutter/issues/84816

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2023-11-02 17:59:16 +00:00
derdilla
7646430c25
Cupertino date picker should dispose scroll controllers it created. (#135355) 2023-11-02 10:36:57 -07:00
Qun Cheng
615dd968e7
Update IconButton.iconSize documentation (#137741)
fixes https://github.com/flutter/flutter/issues/137580

---

This PR is just to add two sentences for `IconButton.iconSize`'s documentation.
2023-11-02 17:24:08 +00:00
Jasper van Riet
55eb5e11db
Remove duplicate padding on CupertinoFormSection (#137039)
Fixes #128419, removes the duplicate padding that exists around the header and footer on `CupertinoFormSection`. This PR takes the implementation in #129065 and adds tests. I added the ones suggested in the PR review, as well as one more to test that `margin` is passed correctly from `CupertinoFormSection` to `CupertinoListSection`.

Note: I can't quite figure out if this is also a fix to #121543.

Potential review questions:

- Is the use of `offsetMoreOrLessEquals` here correct? I used it because of the vertical positioning. The horizontal positioning is always exact.

### Screenshots
<details>
  <summary>Before</summary>
  
![image](https://github.com/flutter/flutter/assets/5138348/1bce10c9-706a-40c8-a581-2dcb574ed937)
</details>
<details>
  <summary>After</summary>
  
![image](https://github.com/flutter/flutter/assets/5138348/cd1d529b-7be5-45df-af31-0f7760dc3fe9)
</details>
2023-11-02 16:40:59 +00:00
Binni Goel
39f2974192
Instrument ImageStreamCompleterHandle for LeakTracking (#137482) 2023-11-02 07:49:21 -07:00
Binni Goel
e2d5e8fdce
Instrumented PipelineOwner for leak tracking (#137494) 2023-11-02 07:48:22 -07:00
Qun Cheng
4a0f261b4e
Add Card.filled and Card.outlined factory methods (#136229)
Fixes #119401

This PR is to:
* add `Card.filled` and `Card.outlined` factory methods so that we can use tokens for these two types of cards to generate default theme instead of providing hard-corded values in example.
* update card.2.dart example.
* add test file for card.2.dart example.
* fix some mismatch caused by editing the auto-generated defaults by hand in navigation_bar.dart and navigation_drawer.dart.
2023-11-01 23:29:49 +00:00
auto-submit[bot]
b47e4c4acb
Reverts "Update framework_test.dart to remove ButtonBar usage and remove references from other clases" (#137731)
Reverts flutter/flutter#137550
Initiated by: Piinks
This change reverts the following previous change:
Original Description:
This PR removes `ButtonBar` usage from `framework_test.dart` class and update other references in preparation for `ButtonBar` deprecation

related to https://github.com/flutter/flutter/issues/127955
2023-11-01 22:58:19 +00:00
Tirth
43dc3fcfcc
Added EdgeInsetsDirectional.copyWith (#137559)
Added `EdgeInsetsDirectional.copyWith` named constructor.

Fixes #137475
2023-11-01 22:30:15 +00:00
Taha Tesser
b1f5d96a82
Update framework_test.dart to remove ButtonBar usage and remove references from other clases (#137550)
This PR removes `ButtonBar` usage from `framework_test.dart` class and update other references in preparation for `ButtonBar` deprecation

related to https://github.com/flutter/flutter/issues/127955
2023-11-01 22:03:54 +00:00
Dan Field
d843863c4a
reset state of CustomSemanticsAction before running tests (#137697)
Fixes https://github.com/flutter/flutter/issues/137696

This will get the tree green again.

The problem is that `CustomSemanticsAction` has static state in it, and todays test seed order makes things unhappy.
2023-11-01 20:09:41 +00:00
Binni Goel
01b8854011
Fix. typos (#137479)
## Description

This PR fixes typos in 
- `editable_text_show_on_screen_test.dart`
- `form_test.dart`
- `framework.dart`
2023-11-01 19:56:47 +00:00
Kostia Sokolovskyi
cdcacd06e4
PerformanceModeRequestHandle should dispatch creation and disposal events. (#137642) 2023-10-31 16:53:53 -07:00
Binni Goel
e7726ea6f2
fix. typos (#137178)
## Description

This PR fixes typos in 
- `checkbox.dart`
- `chip_test.dart`
- `color_scheme.dart`
- `color_scheme_test.dart`
- `curves.dart`
2023-10-31 23:27:03 +00:00
Todd Volkert
5160c5e184
Document the scale argument to NetworkImage (#137456)
Add docs to NetworkImage constructor
2023-10-31 23:15:07 +00:00
Taha Tesser
b547e0e4be
Update ColorScheme.light, ColorScheme.dark, ColorScheme.highContrastLight, & ColorScheme.highContrastDark constructors docs for Material 3 (#137149)
fixes [Clarify ColorScheme fromSwatch/fromSeed usage](https://github.com/flutter/flutter/issues/132584)

"This explains how to use `ColorScheme.fromSeed` as a substitute for each `ColorScheme` constructor."

| `ColorScheme.light` (left) to `ColorScheme.fromSeed` (right) | 
| --------------- | 
| ![light](https://github.com/flutter/flutter/assets/48603081/e056e723-5640-4b05-8feb-ca6b517c8682)	|

| `ColorScheme.dark` (left) to `ColorScheme.fromSeed` (right) | 
| --------------- | 
| ![dark](https://github.com/flutter/flutter/assets/48603081/5ff32611-bfb6-49ee-a34e-f935f580e84e)	|

| `ColorScheme.highContrastLight` (left) to `ColorScheme.fromSeed` (right) | 
| --------------- | 
| ![highContrastLight](https://github.com/flutter/flutter/assets/48603081/4b47f2e3-ea8e-4148-85cc-69690e9082c7) |

| `ColorScheme.highContrastDark` (left) to `ColorScheme.fromSeed` (right) | 
| --------------- | 
| ![highContrastDark](https://github.com/flutter/flutter/assets/48603081/3dbd7ec4-c78e-4228-a8ed-673832681563) |
2023-10-31 19:03:03 +00:00
Binni Goel
231bfac8d3
Fix. typos (#137465)
## Description

This PR fixes typos in 
- `date_picker.dart`
- `date_picker_theme.dart`
- `dropdown.dart`
2023-10-31 17:36:10 +00:00
Kostia Sokolovskyi
f05bb9a182
Instrument RestorationBucket, _RouteEntry and DisposableBuildContext for leak tracking. (#137477) 2023-10-28 13:27:00 -07:00
Kostia Sokolovskyi
50ecd5700f
BannerPainter should dispatch creation and disposal events. (#137472) 2023-10-28 13:23:32 -07:00
Polina Cherkasova
65c71d4294
Instrument more disposables. (#137309) 2023-10-27 21:30:04 -07:00
Kostia Sokolovskyi
fea561301b
TextPainter should dispatch creation and disposal events. (#137416) 2023-10-27 21:29:02 -07:00
Greg Spencer
5907c9757e
Add isLogicalKeyPressed to KeyEvent (#136856)
## Description

Adds some convenience methods to `KeyEvent` that allow testing to see if a logical or physical key is pressed from the event object. These are similar to the ones already on `RawKeyEvent`, and will make migration the to `KeyEvent` easier (so it could more easily be a `flutter fix` migration).

Added:

- `bool isLogicalKeyPressed(LogicalKeyboardKey key)`
- `bool isPhysicalKeyPressed(PhysicalKeyboardKey key)`
- `bool get isControlPressed`
- `bool get isShiftPressed`
- `bool get isAltPressed`
- `bool get isMetaPressed`

## Related Issues
 - https://github.com/flutter/flutter/issues/136419

## Tests
 - Added tests for the new methods.
2023-10-27 18:52:08 +00:00
LongCatIsLooong
7a3135b9c1
Make SemanticsNode.isMergedIntoParent Readonly (#137304)
Fixes https://github.com/flutter/flutter/issues/54665
2023-10-27 17:22:13 +00:00
Todd Volkert
37da62a6eb
Add ConstrainedLayoutBuilder.updateShouldRebuild() (#136691)
This method controls whether the builder needs to be called again again even if the layout constraints are the same.

By default, the builder will always be called when the widget is updated because the logic in the callback might have changed. However, there are cases where subclasses of ConstrainedLayoutBuilder know that certain property updates only affect paint and not build. In these cases, we lack a way of expressing that the builder callback is not needed -- and we end up doing superfluous work.

This PR gives subclasses the ability to know exactly when the callback needs to be called and when it can be skipped.
2023-10-27 05:38:28 +00:00
Binni Goel
9e04246c48
Fix. typos (#137325)
## Description

This PR fixes typos in 
- `actions.dart`
- `app_bar.dart`
- `basic.dart`
- `button_bar_theme.dart`
2023-10-27 01:09:03 +00:00
Kostia Sokolovskyi
aeb500a060
AnimationController should dispatch creation in constructor. (#134839) 2023-10-26 16:23:33 -07:00
Greg Price
5b3293c5ae
Fix dislocated doc and comment on ThemeData localize cache (#137315)
This comment on _localizedThemeDataCacheSize was a bit garbled from getting split up, and the doc on _localizedThemeDataCache was missing from having been moved elsewhere.

It looks like the dislocation happened in 8b86d238b (#116088), which was otherwise making unrelated changes, including a couple of lines near these.  Likely it was due to an error in resolving merge or rebase conflicts at some point while revising that PR.
2023-10-26 20:57:52 +00:00
Bruno Leroux
b2ec34fcb4
Add ProcessTextService (#137145)
## Description

This PR adds `ProcessTextService` on the framework side to communicate with the engine to query and run text processing actions (on the engine side, only Android is supported currently, see https://github.com/flutter/engine/pull/44579).

## Related Issue

Non-UI framework side for https://github.com/flutter/flutter/issues/107603

## Tests

Adds 3 tests.
2023-10-26 11:44:07 +00:00
Mairramer
de4e3d67a0
fix:: trigger onTapOutside only if has focus (#136291)
Adds new feat and fix to https://github.com/flutter/flutter/issues/134341
2023-10-26 00:26:20 +00:00
fzyzcjy
6df6c897ef
Let OverflowBox be shrink-wrappable (#129095)
Close https://github.com/flutter/flutter/issues/129094

I have demonstrated how this PR fixes the problem using tests in #129094. I will further add tests in this PR if the PR looks roughly acceptable :)
2023-10-25 03:51:24 +00:00
yim
25c5bf0640
fix SliverReorderableLists item wrong offset (#136828)
This PR fixes the issue of items being created at the wrong position during dragging.

Fixes #135819
2023-10-25 01:11:18 +00:00
lirantzairi
7cd6fd43a1
TextField - allow to customize cursor color in error state (#136121)
The color of the TextField's cursor in error state is the same as the error text color by default. However we should be allowed to customize it

Fixes #135580
2023-10-24 20:44:18 +00:00
cui fliter
c5e71b3e59
fix some typos (#137144)
*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

fix some typos

*List which issues are fixed by this PR. You must list at least one issue.*

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2023-10-24 15:27:07 +00:00
Ross Llewallyn
57a20ef2a1
CustomPainterSemantics doc typo (#137081)
Just a documentation typo, I think.

#137080
2023-10-23 20:52:29 +00:00
LongCatIsLooong
117c7097ca
Fix TextStyle terminology (#137000)
cascading -> inheritance
2023-10-23 17:15:10 +00:00
Tirth
2de1af40f3
Add InputDatePickerFormField.focusNode prop (#136673)
Adds `focusNode` prop to `InputDatePickerFormField` widget.

Fixes #105881
2023-10-23 17:15:08 +00:00
Taha Tesser
6c3010e7e1
Add delete button support to FilterChip (#136645)
fixes [`FilterChip` should have `DeletableChipAttributes`/`trailing` to match Material 3 spec.](https://github.com/flutter/flutter/issues/135595)

### 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(useMaterial3: true),
      home: const Example(),
    );
  }
}

class Example extends StatelessWidget {
  const Example({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text('FilterChip'),
            const SizedBox(height: 8),
            FilterChip(
              avatar: const Icon(Icons.favorite_rounded),
              label: const Text('FilterChip'),
              selected: true,
              showCheckmark: false,
              onSelected: (bool value) {},
              onDeleted: () {},
              deleteButtonTooltipMessage: 'Delete Me!',
            ),
            const SizedBox(height: 16),
            FilterChip(
              avatar: const Icon(Icons.favorite_rounded),
              label: const Text('FilterChip'),
              onSelected: (bool value) {},
              onDeleted: () {},
            ),
            const SizedBox(height: 48),
            const Text('FilterChip.elevated'),
            const SizedBox(height: 8),
            FilterChip.elevated(
              avatar: const Icon(Icons.favorite_rounded),
              label: const Text('FilterChip'),
              selected: true,
              showCheckmark: false,
              onSelected: (bool value) {},
              onDeleted: () {},
            ),
            const SizedBox(height: 16),
            FilterChip.elevated(
              avatar: const Icon(Icons.favorite_rounded),
              label: const Text('FilterChip'),
              onSelected: (bool value) {},
              onDeleted: () {},
            ),
          ],
        ),
      ),
    );
  }
}
```

</details>

### Before

Not possible to add delete button

### After 
![Screenshot 2023-10-16 at 17 56 51](https://github.com/flutter/flutter/assets/48603081/ad751ef9-c2bc-4184-ae5f-4d1017eff664)
2023-10-23 16:19:25 +00:00
Taha Tesser
5e8b5f4ea2
Update ColorScheme.fromSwatch docs for Material 3 (#136816)
part of [Clarify ColorScheme fromSwatch/fromSeed usage](https://github.com/flutter/flutter/issues/132584)
2023-10-23 15:57:44 +00:00
chunhtai
e8691444a2
Reland "Fixes ability to call nextFocus() on a node to focus its desc… (#136898)
…endant" (#136894)"

This reverts commit c2bd2c1175f5b81e9543955760aec5b876b4e57e.

fixes https://github.com/flutter/flutter/issues/134854

This is a straight reland, the internal test is testing a wrong behave. https://critique.corp.google.com/cl/575028981
2023-10-23 15:56:06 +00:00
LongCatIsLooong
af129b61c5
OverlayPortal.overlayChild contributes semantics to OverlayPortal instead of Overlay (#134921)
Fixes https://github.com/flutter/flutter/issues/134456
2023-10-23 15:45:46 +00:00
Todd Volkert
cb9a3f698c
Add timeline events for post frame callbacks (#136435)
Before this change, long-running post-frame callbacks wouldn't show up in the timeline at all.  This adds a timeline event for post-frame callbacks, with a debug flag that will add timeline events for each individual callback.

#testexempt -- we have no way to test calls to the timeline.
2023-10-22 20:46:21 +00:00