Commit graph

23121 commits

Author SHA1 Message Date
Taha Tesser 5d2353c105
CalendarDatePicker doesn't announce selected date on desktop (#143583)
fixes [Screen reader is not announcing the selected date as selected on DatePicker](https://github.com/flutter/flutter/issues/143439)

### Descriptions
- This fixes an issue where `CalendarDatePicker` doesn't announce selected date on desktop.
- Add semantic label to describe the selected date is indeed "Selected".

### 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 const MaterialApp(
      home: MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  MyHomePageState createState() => MyHomePageState();
}

class MyHomePageState extends State<MyHomePage> {
  void _showDatePicker() async {
    await showDatePicker(
      context: context,
      initialDate: DateTime.now(),
      firstDate: DateTime(1900),
      lastDate: DateTime(2200),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title,
            style: const TextStyle(fontFamily: 'ProductSans')),
      ),
      body: const Center(
        child: Text('Click the button to show date picker.'),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _showDatePicker,
        tooltip: 'Show date picker',
        child: const Icon(Icons.edit_calendar),
      ),
    );
  }
}

// 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: CalendarDatePicker(
//             initialDate: DateTime.now(),
//             firstDate: DateTime(2020),
//             lastDate: DateTime(2050),
//             onDateChanged: (date) {
//               print(date);
//             },
//           ),
//         ),
//       ),
//     );
//   }
// }
```

</details>

### Before

https://github.com/flutter/flutter/assets/48603081/c82e1f15-f067-4865-8a5a-1f3c0c8d91da

### After

https://github.com/flutter/flutter/assets/48603081/193d9e26-df9e-4d89-97ce-265c3d564607
2024-02-21 08:59:24 +00:00
Taha Tesser 95cdebedae
Add timeSelectorSeparatorColor and timeSelectorSeparatorTextStyle for Material 3 Time Picker (#143739)
fixes [`Time selector separator` in TimePicker is not centered vertically](https://github.com/flutter/flutter/issues/143691)

Separator currently `hourMinuteTextStyle` to style itself.

This introduces `timeSelectorSeparatorColor` and `timeSelectorSeparatorTextStyle` from Material 3 specs to correctly style  the separator. This also adds ability to change separator color without changing `hourMinuteTextColor`.

### Specs for the time selector separator
https://m3.material.io/components/time-pickers/specs
![image](https://github.com/flutter/flutter/assets/48603081/0c84f649-545d-441b-adbf-2b9ec872b14c)

### Code sample

<details>
<summary>expand to view the code sample</summary> 

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(const App());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        // timePickerTheme: TimePickerThemeData(
        //   hourMinuteTextColor: Colors.amber,
        // )
      ),
      home: Scaffold(
        body: Center(
          child: Builder(builder: (context) {
            return ElevatedButton(
              onPressed: () async {
                await showTimePicker(
                  context: context,
                  initialTime: TimeOfDay.now(),
                );
              },
              child: const Text('Pick Time'),
            );
          }),
        ),
      ),
    );
  }
}

```

</details>

| Before | After |
| --------------- | --------------- |
| <img src="https://github.com/flutter/flutter/assets/48603081/20beeba4-5cc2-49ee-bba8-1c552c0d1e44" /> | <img src="https://github.com/flutter/flutter/assets/48603081/24927187-aff7-4191-930c-bceab6a4b4c2" /> |
2024-02-21 08:10:01 +00:00
Jonah Williams f58a162da0
more fixes to unstable impeller goldens. (#143811)
Part of  https://github.com/flutter/flutter/issues/143616
2024-02-21 03:14:19 +00:00
Kevin Moore bc334396db
[flutter_tools] enable wasm compile on beta channel (#143779)
Wasm compilation is now available on `master` and `beta` channels.
2024-02-21 01:20:04 +00:00
Simon Friis Vindum 6c78e36ccb
Fix initialization of time in repeat on AnimationController (#142887)
This PR fixes #142885.

The issue is that in `_RepeatingSimulation` the initial time is calculated as follows:

```
(initialValue / (max - min)) * (period.inMicroseconds / Duration.microsecondsPerSecond)
```

This calculation does not work in general. For instance, if `max` is 300, `min` is 100, and `initialValue` is 100 then `initialValue / (max - min)` is 1/2 when it should be 0

The current tests work by happenstance because the numbers used happen to work. To reveal the bug I've added some more tests similar to the existing ones but with different numbers.

A "side-effect" of the incorrect calculation is that if `initialValue` is 0, then the animation will always start from `min` no matter what. For instance, in one of the tests, an `AnimationController` with the value 0 is told to `repeat` between 0.5 and 1.0, and this starts the animation from 0.5. To preserve this behavior, and to more generally handle the case where the initial value is out of bounds, this PR clamps the initial value to be within the lower and upper bounds of the repetition.

Just for reference, this calculation was introduced at https://github.com/flutter/flutter/pull/25125.
2024-02-21 00:36:08 +00:00
Jonah Williams 1e822ca2fd
Disable debug banner to stabilize impeller goldens. (#143794)
Fixes some of https://github.com/flutter/flutter/issues/143616 by disabling the debug banner, which does not appear to be a critical part of the golden.
2024-02-21 00:34:11 +00:00
auto-submit[bot] f9b3b84d4e
Reverts "Changing TextPainter.getOffsetForCaret implementation to remove the logarithmic search (#143281)" (#143801)
Reverts flutter/flutter#143281

Initiated by: LongCatIsLooong

Reason for reverting: https://github.com/flutter/flutter/issues/143797

Original PR Author: LongCatIsLooong

Reviewed By: {justinmc, jason-simmons}

This change reverts the following previous change:
Original Description:
The behavior largely remains the same, except:

1. The EOT cursor `(textLength, downstream)` for text ending in the opposite writing direction as the paragraph is now placed at the visual end of the last line. 
  For example, in a LTR paragraph, the EOT cursor for `aA` (lowercase for LTR and uppercase for RTL) is placed to the right of the line: `aA|` (it was `a|A` before). 
  This matches the behavior of most applications that do logical order arrow key navigation instead of visual order navigation. 
  And it makes the navigation order consistent for `aA\naA`:
```
  |aA    =>  aA|  => aA|  => aA  => aA   => aA 
   aA        aA      aA     |aA     aA|     aA|     
   (1)       (2)     (3)    (4)    (5)      (6)
```
This is indeed still pretty confusing as (2) and (3), as well as (5) and (6) are hard to distinguish (when the I beam has a large width they are actually visually distinguishable -- they use the same anchor but one gets painted to the left and the other to the right. I noticed that emacs does the same). 
But logical order navigation will always be confusing in bidi text, in one way or another.

Interestingly there are 3 different behaviors I've observed in chrome:
- the chrome download dialog (which I think uses GTK text widgets but not sure which version) gives me 2 cursors when navigating bidi text, and 
- its HTML fields only show one, and presumably they place the I beam at the **trailing edge** of the character (which makes more sense for backspacing I guess). 
- On the other hand, its (new) omnibar seems to use visual order arrow navigation

Side note: we may need to update the "tap to place the caret here" logic to handle the case where the tap lands outside of the text and the text ends in the opposite writing direction. 

2. Removed the logarithmic search. The same could be done using the characters package but when glyphInfo tells you about the baseline location in the future we probably don't need the `getBoxesForRange` call. This should fix https://github.com/flutter/flutter/issues/123424.

## Internal Tests

This is going to change the image output of some internal golden tests. I'm planning to merge https://github.com/flutter/flutter/pull/143281 before this to avoid updating the same golden files twice for invalid selections.
2024-02-21 00:10:18 +00:00
LongCatIsLooong 174e58697c
Avoid applying partial dartfixes on CI (#143551)
Unblocks https://github.com/flutter/tests/pull/345

Add `bulkApply: false` to partial fixes so they don't automatically get applied on registered tests.
2024-02-20 23:27:26 +00:00
Nate fc07b241ae
Implement _suspendedNode fix (#143556)
Previously we merged #142930, to solve issue #87061.

Since then, I discovered that the keyboard input wasn't being captured after the app had been paused and resumed. After some digging, I realized that the problem was due to [a line in editable_text.dart](d4b1b6e744/packages/flutter/lib/src/widgets/editable_text.dart (L3589)) that called the `focusNode.consumeKeyboardToken()` method.

Luckily, it's a very easy fix: we just use `requestFocus()` instead of `applyFocusChangesIfNeeded()`. @gspencergoog could you take a look when you have a chance?
2024-02-20 22:46:22 +00:00
xubaolin 6707f5efbe
Change ItemExtentBuilder's return value nullable (#142428)
Fixes https://github.com/flutter/flutter/issues/138912

Change `ItemExtentBuilder`'s return value nullable, it should return null if asked to build an item extent with a greater index than exists.
2024-02-20 22:14:00 +00:00
Jonah Williams 4c0b5ccebc
[gold] Always provide host ABI to gold config (#143621)
This can help us split goldens that are different due to arm non-arm mac, et cetera.

Part of https://github.com/flutter/flutter/issues/143616
2024-02-20 21:06:01 +00:00
Andrew Kolos b491f16d9c
instead of exiting the tool, print a warning when using --flavor with an incompatible device (#143735)
Fixes https://github.com/flutter/flutter/issues/143574 by printing a warning (instead of exiting) when `--flavor` is used with a target platform that doesn't have flavors support.
2024-02-20 21:02:49 +00:00
Nate 7a4c2465af
Implementing switch expressions: everything in flutter/lib/src/ (#143634)
This PR is the 9ᵗʰ step in the journey to solve issue #136139 and make the entire Flutter repo more readable.

(previous pull requests: #139048, #139882, #141591, #142279, #142634, #142793, #143293, #143496)

I did a pass through all of `packages/flutter/lib/src/` and found an abundance of `switch` statements to improve. Whereas #143496 focused on in-depth refactoring, this PR is full of simple, straightforward changes. (I ended up making some more complicated changes in `rendering/` and will file those separately after this PR is done.)
2024-02-20 21:02:47 +00:00
LongCatIsLooong 3538e4c788
Changing TextPainter.getOffsetForCaret implementation to remove the logarithmic search (#143281)
The behavior largely remains the same, except:

1. The EOT cursor `(textLength, downstream)` for text ending in the opposite writing direction as the paragraph is now placed at the visual end of the last line. 
  For example, in a LTR paragraph, the EOT cursor for `aA` (lowercase for LTR and uppercase for RTL) is placed to the right of the line: `aA|` (it was `a|A` before). 
  This matches the behavior of most applications that do logical order arrow key navigation instead of visual order navigation. 
  And it makes the navigation order consistent for `aA\naA`:
```
  |aA    =>  aA|  => aA|  => aA  => aA   => aA 
   aA        aA      aA     |aA     aA|     aA|     
   (1)       (2)     (3)    (4)    (5)      (6)
```
This is indeed still pretty confusing as (2) and (3), as well as (5) and (6) are hard to distinguish (when the I beam has a large width they are actually visually distinguishable -- they use the same anchor but one gets painted to the left and the other to the right. I noticed that emacs does the same). 
But logical order navigation will always be confusing in bidi text, in one way or another.

Interestingly there are 3 different behaviors I've observed in chrome:
- the chrome download dialog (which I think uses GTK text widgets but not sure which version) gives me 2 cursors when navigating bidi text, and 
- its HTML fields only show one, and presumably they place the I beam at the **trailing edge** of the character (which makes more sense for backspacing I guess). 
- On the other hand, its (new) omnibar seems to use visual order arrow navigation

Side note: we may need to update the "tap to place the caret here" logic to handle the case where the tap lands outside of the text and the text ends in the opposite writing direction. 

2. Removed the logarithmic search. The same could be done using the characters package but when glyphInfo tells you about the baseline location in the future we probably don't need the `getBoxesForRange` call. This should fix https://github.com/flutter/flutter/issues/123424.

## Internal Tests

This is going to change the image output of some internal golden tests. I'm planning to merge https://github.com/flutter/flutter/pull/143281 before this to avoid updating the same golden files twice for invalid selections.
2024-02-20 20:51:06 +00:00
Polina Cherkasova 39befd81dd
Clean leaks. (#142818) 2024-02-20 11:14:16 -08:00
Qun Cheng a2c7ed95d1
Introduce tone-based surfaces and accent color add-ons - Part 2 (#138521)
This PR is to introduce 19 new color roles and deprecate 3 color roles in `ColorScheme`.
**Tone-based surface colors** (7 colors): 
* surfaceBright
* surfaceDim
* surfaceContainer
* surfaceContainerLowest
* surfaceContainerLow
* surfaceContainerHigh
* surfaceContainerHighest

**Accent color add-ons** (12 colors):
* primary/secondary/tertiary-Fixed
* primary/secondary/tertiary-FixedDim
* onPrimary/onSecondary/onTertiary-Fixed
* onPrimary/onSecondary/onTertiary-FixedVariant

**Deprecated colors**:
* background -> replaced with surface
* onBackground -> replaced with onSurface
* surfaceVariant -> replaced with surfaceContainerHighest

Please checkout this [design doc](https://docs.google.com/document/d/1ODqivpM_6c490T4j5XIiWCDKo5YqHy78YEFqDm4S8h4/edit?usp=sharing) for more information:)

![Screenshot 2024-01-08 at 4 56 51 PM](https://github.com/flutter/flutter/assets/36861262/353cdb4c-6ba9-4435-a518-fd3f67e415f0)
2024-02-20 19:01:50 +00:00
Greg Price eacf0f9e41
Explain when and why to use CrossAxisAlignment.baseline (#143632)
Improves the docs around horizontal alignment of text, due to several issues expressing confusion about this topic.
2024-02-20 10:59:12 -08:00
Zachary Anderson 8a8616f913
Handle FormatException from SkiaGoldClient (#143755)
Seen in
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20Framework%20Smoke%20Tests/17183/overview
closing the engine tree.
2024-02-20 09:57:23 -08:00
Greg Price 2d422a3261
Small fixes in TextEditingController docs (#143717)
This follows up on #143452, to slightly further address #95978.

The double- rather than triple-slash on the blank line caused it to be ignored by dartdoc, so that the two paragraphs it's intended to separate were getting joined as one paragraph instead.

Also expand this constructor's summary line slightly to mention its distinctive feature compared with the other constructor, and make other small fixes that I noticed in other docs on this class.
2024-02-20 05:49:05 +00:00
Gustl22 9620e3f69c
Reland (2): "Fix how Gradle resolves Android plugin" (#142498)
Previous PR: #137115, 
Revert: #142464
Fixes #141940
Closes #142487
2024-02-19 18:07:33 +00:00
yim bce848ebf9
Fixed the issue of incorrect item position when prototypeItem is set in SliverReorderableList. (#142880)
Fixes #142708
2024-02-18 02:30:18 +00:00
yim 73c26a1c0b
ShowCaretOnScreen is correctly scheduled within a SliverMainAxisGroup (#141671)
Fixes #141577 
Fixes #135407
2024-02-18 02:28:22 +00:00
Jason Simmons 8036488776
Add an override annotation to the lineTerminator setter in the MemoryStdout fake class (#143646)
This is required by a new API recently added to Dart.

See https://github.com/flutter/flutter/issues/143614
2024-02-17 16:41:27 +00:00
Bruno Leroux 8a5efa53d8
InputDecorator M3 tests migration - Step3 (#143520)
## Description

This PR is the third step for the M3 test migration for `InputDecorator`.
Step 1: https://github.com/flutter/flutter/pull/142981
Step 2: https://github.com/flutter/flutter/pull/143369

This PR moves some tests out of the 'Material2' group (the ones that are ok on M3).
@justinmc The diff is almost unreadable, I moved the tests as carefully as possible and I checked that before and after the number of tests is exactly the same. 

## Related Issue

Related to https://github.com/flutter/flutter/issues/139076

## Tests

Move some tests from 'Material2' group to main().
2024-02-17 07:34:35 +00:00
Bruno Leroux 13ed551e19
Update InputDecoration.contentPadding documentation (#143519)
## Description

This PR updates the `InputDecoration.contentPadding` documentation to detail both Material 3 and Material 2 default values.

## Related Issue

Follow-up to https://github.com/flutter/flutter/pull/142981.

## Tests

Documentation only.
2024-02-17 07:24:34 +00:00
Jonah Williams ae1488cfe8
[Impeller] skip selectable text goldens for instability. (#143627)
Similar to other issues, appears that text goldens are really unstable with Impeller.

Part of https://github.com/flutter/flutter/issues/143616
2024-02-17 04:21:17 +00:00
Jonah Williams 4e27f3472c
[Impeller] skip perspective transformed text goldens. (#143623)
Part of https://github.com/flutter/flutter/issues/143616

The perspective transformed text goldens are super unstable, possibly for the same reason they are in flutter/engine.
2024-02-17 02:13:22 +00:00
Jonah Williams bb1c7a6ccb
[framework] Skip 5 failing framework tests. (#143618)
Part of https://github.com/flutter/flutter/issues/143616
2024-02-17 01:18:33 +00:00
Brian Quinlan e8dcf1909e
Implement lineTerminator in MemoryStdout Fake (#143608)
https://dart-review.googlesource.com/c/sdk/+/326761/24/sdk/lib/io/stdio.dart#380
added a `lineTerminator` field to `Stdout`.

Add that field to the fake in packages/test.

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

## 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] 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
2024-02-16 15:46:01 -08:00
LongCatIsLooong c61b9501e3
Don't paint the cursor for an invalid selection (#143533)
Fixes https://github.com/flutter/flutter/issues/79495

This is basically a reland of https://github.com/flutter/flutter/pull/79607.

Currently when the cursor is invalid, arrow key navigation / typing / backspacing doesn't work since the cursor position is unknown. 
Showing the cursor when the selection is invalid gives the user the wrong information about the current insert point in the text. 

This is going to break internal golden tests.
2024-02-16 23:40:26 +00:00
Michael Goderbauer 546bdec7ef
Fix implementation imports outside of lib (#143594)
Work towards https://github.com/dart-lang/linter/issues/4859

There are libraries outside a `lib/` directory, which violate `implementation_imports`.

Supersedes https://github.com/flutter/flutter/pull/143560.
2024-02-16 22:38:10 +00:00
Andrew Kolos 3a18473bd6
add parsing of assets transformer declarations in pubspec.yaml (#143557)
In service of https://github.com/flutter/flutter/issues/143348.

This PR enables parsing of the pubspec yaml schemes for assets with transformations as described in #143348.
2024-02-16 22:24:59 +00:00
Michael Goderbauer 50862bc04a
Fix SemanticsFinder for multi-view (#143485)
Fixes https://github.com/flutter/flutter/issues/143405.

It was counter-intuitive that a SemanticsFinder without specifying a FlutterView would only search the nodes in the default view. This change makes it so that when no view is specified the semantics trees of all known FlutterViews are searched.
2024-02-16 22:24:55 +00:00
Andrew Kolos 9a6bda87d9
rebuild the asset bundle if a file has been modified between flutter test runs (#143569)
Fixes https://github.com/flutter/flutter/issues/143513
Should be cherry-picked to beta.
2024-02-16 22:21:08 +00:00
Tirth 1b8742b9dc
Added Missing Field Name in Doc Comment in SnackBarThemeData (#143588)
Added Missing Field Name in Doc Comment in SnackBarThemeData.
2024-02-16 20:50:07 +00:00
Nate 944cd11d87
Implementing switch expressions [refactoring flutter/lib/src/] (#143496)
This PR is the 8ᵗʰ step in the journey to solve issue #136139 and make the entire Flutter repo more readable.

(previous pull requests: #139048, #139882, #141591, #142279, #142634, #142793, #143293)

I did a pass through all of `packages/flutter/lib/src/` and found a whole bunch of `switch` statements to improve: most of them were really simple, but many involved some thorough refactoring.

This pull request is just the complicated stuff. 😎 I'll make comments to describe the changes, and then in the future there will be another PR (and it'll be much easier to review than this one).
2024-02-16 20:19:34 +00:00
Taha Tesser a603a17875
Update MaterialStatesController docs for calling setState in a listener (#143453)
fixes [Calling `setState` in a `MaterialStatesController` listener and `MaterialStateController.update` causes Exception](https://github.com/flutter/flutter/issues/138986)

### Description
`MaterialStatesController` listener  calls `setState` during build when `MaterialStatesController.update` listener calls `notifyListeners`.

I tried fixing this issue by putting `notifyListeners` in a post-frame callback. However, this breaks existing customer tests (particularly super editor tests).

A safer approach would be to document that the listener's `setState` call should be in a post-frame callback to delay it and not call this during the build phase triggered by the `MaterialStatesController.update` in the widgets such as InkWell or buttons.
2024-02-16 07:43:50 +00:00
Taha Tesser 8129797045
Update DataTable docs for disabled DataRow ink well (#143450)
fixes [[`DataTable`] Data row does not respond to `MaterialState.hovered`](https://github.com/flutter/flutter/issues/138968)
2024-02-16 06:56:59 +00:00
Martin Kustermann d4b1b6e744
Reland "Disentangle and align flutter build web --wasm flags (#143517)" (#143549)
Update: Accidentally use `--O4` instead of `-O4` in `dev/devicelab/lib/tasks/web_benchmarks.dart` update.

Original description:

* Make `flutter build web` have one option that determins the
optimization level: `-O<level>` / `--optimization-level=<level>` =>
Defaulting to -O4 => Will apply to both dart2js and dart2wasm

* Deprecate `--dart2js-optimization=O<level>`

* Disentagle concept of optimization from concept of static symbols =>
Add a `--strip-wasm` / `--no-strip-wasm` flag that determins whether
static symbols are kept in the resulting wasm file.

* Remove copy&past'ed code in the tests for wasm build tests

* Cleanup some artifacts code, now that we no longer use `wasm-opt`
inside flutter tools
2024-02-16 00:19:38 +00:00
Bartek Pacia c4b0322d57
Android Gradle file templates: make it easier to convert them to Kotlin DSL in the future (#142146)
This PR will make it easier for future Flutter-Android apps/plugins/modules etc. to migrate to Gradle Kotlin DSL.

This PR is similar to #140452 but concerns public Gradle templates instead of Flutter's internal Gradle code. It should be a no-op change.

**before**

![before](https://github.com/flutter/flutter/assets/40357511/5d0cb2bb-a693-43bc-aa10-b8f431e0c68c)

**after**

![after](https://github.com/flutter/flutter/assets/40357511/e4a945a5-866f-42f7-813b-b08b26bb89dc)
2024-02-15 23:42:13 +00:00
Jake 22d2703834
Fix minor spelling error (#143541)
*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

*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.*

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2024-02-15 22:46:30 +00:00
Danny Tuppeny 86613d198e
[flutter_tool] [dap] Forward Flutter progress events to DAP client (#142524)
Builds can be slow and the legacy debug adapter would handle Flutter's `app.progress` events to update the toast notification during builds. This was lost in the new adapters - we should only a single "Launching.." notification for the whole progress.

This change listens to `app.progress` events and forwards those with `finished=false` to the client if the launch progress is still active.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4938

https://github.com/flutter/flutter/assets/1078012/8c60cf08-e034-4a72-b31e-9c61dca388bf
2024-02-15 22:22:48 +00:00
auto-submit[bot] 86ca31d005
Reverts "Disentangle and align flutter build web --wasm flags (#143517)" (#143547)
Reverts flutter/flutter#143517

Initiated by: dnfield

Reason for reverting: broke CI, see https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20web_benchmarks_skwasm/3446/overview

Original PR Author: mkustermann

Reviewed By: {eyebrowsoffire}

This change reverts the following previous change:
Original Description:
* Make `flutter build web` have one option that determins the optimization level: `-O<level>` / `--optimization-level=<level>` => Defaulting to -O4 => Will apply to both dart2js and dart2wasm

* Deprecate `--dart2js-optimization=O<level>`

* Disentagle concept of optimization from concept of static symbols => Add a `--strip-wasm` / `--no-strip-wasm` flag that determins whether static symbols are kept in the resulting wasm file.

* Remove copy&past'ed code in the tests for wasm build tests

* Cleanup some artifacts code, now that we no longer use `wasm-opt` inside flutter tools
2024-02-15 22:05:18 +00:00
Kate Lovett ea3d066237
Reland simulatedAccessibilityTraversal fix (#143527)
Relands https://github.com/flutter/flutter/pull/143386
Which was reverted in https://github.com/flutter/flutter/pull/143523
Fixes https://github.com/flutter/flutter/issues/143173
Unblocks https://github.com/flutter/flutter/pull/143485

⭐ ➡️  Update from the revert is in this commit: 1e6853291e
2024-02-15 21:37:40 +00:00
Martin Kustermann 178898e45d
Disentangle and align flutter build web --wasm flags (#143517)
* Make `flutter build web` have one option that determins the
optimization level: `-O<level>` / `--optimization-level=<level>` =>
Defaulting to -O4 => Will apply to both dart2js and dart2wasm

* Deprecate `--dart2js-optimization=O<level>`

* Disentagle concept of optimization from concept of static symbols =>
Add a `--strip-wasm` / `--no-strip-wasm` flag that determins whether
static symbols are kept in the resulting wasm file.

* Remove copy&past'ed code in the tests for wasm build tests

* Cleanup some artifacts code, now that we no longer use `wasm-opt`
inside flutter tools
2024-02-15 21:39:58 +01:00
auto-submit[bot] d00fe8faae
Reverts "Fix and test SemanticsController.simulatedAccessibilityTraversal (#143386)" (#143523)
Reverts flutter/flutter#143386

Initiated by: Piinks

Reason for reverting: This broke a customer test.

Original PR Author: Piinks

Reviewed By: {goderbauer}

This change reverts the following previous change:
Original Description:
Fixes https://github.com/flutter/flutter/issues/143173

The `start` and `end` parameters of `SemanticsController.simulatedAccessibilityTraversal` were deprecated in https://github.com/flutter/flutter/issues/112413, but no tests were added that verified the new API. 😳

This change
- fixes a typo in an error message
- fixes the new `startNode` and `endNode` not being accounted for in setting the traversal range
- adds dart fixes for the deprecations
- adds tests for the new API that is meant to replace the deprecated one.
  - Filed https://github.com/flutter/flutter/issues/143405 to follow up on the new API not working in multiple views.
2024-02-15 15:49:26 +00:00
Hossein Yousefi 97ab92ee35
Modify plugin_ffi and package_ffi template (#143376)
* Use `dart run` instead of `flutter pub run` in the documentation as it is now deprecated.
* Use `int64_t` instead of `intptr_t` for `sum` examples.
2024-02-15 10:37:30 +00:00
auto-submit[bot] 0fac13b443
Reverts "[a11y] Add isEnabled semantics flag to text field (#143334)" (#143494)
Reverts flutter/flutter#143334

Initiated by: hangyujin

Reason for reverting: broke g3 tests

Original PR Author: hangyujin

Reviewed By: {LongCatIsLooong}

This change reverts the following previous change:
Original Description:
Add a semantics flag to   text field to fix https://github.com/flutter/flutter/issues/143337 (in IOS the disabled text field is not read `dimmed`)

internal: b/322345393
2024-02-14 22:43:18 +00:00
auto-submit[bot] eae0c6a357
Reverts "[a11y] Fix date picker cannot focus on the edit field (#143117)" (#143493)
Reverts flutter/flutter#143117

Initiated by: dnfield

Reason for reverting: made the tree red.

Original PR Author: hangyujin

Reviewed By: {QuncCccccc}

This change reverts the following previous change:
Original Description:
fixes: https://github.com/flutter/flutter/issues/143116
fixes: https://github.com/flutter/flutter/issues/141992

https://b.corp.google.com/issues/322173632
2024-02-14 22:17:18 +00:00
hangyu 846719ecaf
[a11y] Fix date picker cannot focus on the edit field (#143117)
fixes: [DatePicker edit field](https://github.com/flutter/flutter/issues/143116) 

https://b.corp.google.com/issues/322173632
2024-02-14 21:09:44 +00:00
Michael Goderbauer 3f09b23338
cleanup now-irrelevant ignores for deprecated_member_use (#143403)
Follow-up to https://github.com/flutter/flutter/pull/143347.
2024-02-14 21:08:25 +00:00
Kate Lovett f190d6259f
Fix and test SemanticsController.simulatedAccessibilityTraversal (#143386)
Fixes https://github.com/flutter/flutter/issues/143173

The `start` and `end` parameters of `SemanticsController.simulatedAccessibilityTraversal` were deprecated in https://github.com/flutter/flutter/issues/112413, but no tests were added that verified the new API. 😳

This change
- fixes a typo in an error message
- fixes the new `startNode` and `endNode` not being accounted for in setting the traversal range
- adds dart fixes for the deprecations
- adds tests for the new API that is meant to replace the deprecated one.
  - Filed https://github.com/flutter/flutter/issues/143405 to follow up on the new API not working in multiple views.
2024-02-14 20:48:36 +00:00
Qun Cheng 9bc839321d
The initial/selected item on popup menu should always be visible (#143118)
Fixes #142895

With the change of #143121, this PR is to add auto scroll to `PopupMenuButton` so when we open the menu, it will automatically scroll to the selected item.

https://github.com/flutter/flutter/assets/36861262/c2bc0395-0641-4e7a-a54d-57a8e62ee26f
2024-02-14 20:29:17 +00:00
Daco Harkes db83bc6e59
Roll native_assets_builder to 0.5.0 (#143472)
Roll of https://github.com/dart-lang/native/pull/964, which separates the `KernelAsset`s (the asset information embedded in the Dart kernel snapshot) from `Asset`s (the assets in the `build.dart` protocol). See the linked issue for why they ought to be different instead of shared.

This PR does not change any functionality in Flutter.

(Now that https://github.com/flutter/flutter/pull/143055 has landed, we can land breaking changes.)

For reference, the same roll in the Dart SDK: https://dart-review.googlesource.com/c/sdk/+/352642
2024-02-14 20:23:23 +00:00
Bruno Leroux 5b005e4791
InputDecorator M3 test migration step2 (#143369)
## Description

This PR is the second step for the M3 test migration for `InputDecorator` (step 1 was https://github.com/flutter/flutter/pull/142981).

This PR migrate the two first tests of the M2 section. Those were big tests. I splitted them in several testsn organized in groups, and I narrowed their scope when possible.

@justinmc  I did not move yet the M2 tests to a separate file (I move them to a group) because it would mean we loss the line history which is useful during the migration. In the next step, I will focus on moving out some tests that are in the 'Material2' group (the ones that are ok with both M2 and M3).

## Related Issue

Related to https://github.com/flutter/flutter/issues/139076

## Tests

Adds several tests for M3.
2024-02-14 20:10:21 +00:00
Bruno Leroux 5c88fbf0b9
Add more documentation for TextEditingController default constructor (#143452)
## Description

This PR adds more documentation for `TextEditingController(String text)` constructor and it adds one example.

https://github.com/flutter/flutter/pull/96245 was a first improvement to the documentation.
https://github.com/flutter/flutter/issues/79495 tried to hide the cursor when an invalid selection is set but it was reverted.
https://github.com/flutter/flutter/pull/123777 mitigated the issue of having a default invalid selection: it takes care of setting a proper selection when a text field is focused and its controller selection is not initialized.

I will try changing the initial selection in another PR, but It will probably break several existing tests.

## Related Issue

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

## Tests

Adds 1 test for the new example.
2024-02-14 20:10:18 +00:00
Gray Mackall c61dc2a586
Format all kotlin according to ktlint (#143390)
Entire pr generated with [ktlint](https://github.com/pinterest/ktlint) --format. First step before enabling linting as part of presubmit for kotlin changes.
2024-02-14 17:58:18 +00:00
Anas ca03beda4d
[tools] Add column header for emulators information (#142853)
Add column information as table header for `flutter emulators` command.

**Before:**

```
2 available emulators:

Pixel_3_API_30   • Pixel 3 API 30   • Google • android
Resizable_API_33 • Resizable API 33 • Google • android

To run an emulator, run 'flutter emulators --launch <emulator id>'.
To create a new emulator, run 'flutter emulators --create [--name xyz]'.

You can find more information on managing emulators at the links below:
  https://developer.android.com/studio/run/managing-avds
  https://developer.android.com/studio/command-line/avdmanager
```

**After:**

```
2 available emulators:

Id               • Name             • Manufacturer • Platform

Pixel_3_API_30   • Pixel 3 API 30   • Google       • android
Resizable_API_33 • Resizable API 33 • Google       • android

To run an emulator, run 'flutter emulators --launch <emulator id>'.
To create a new emulator, run 'flutter emulators --create [--name xyz]'.

You can find more information on managing emulators at the links below:
  https://developer.android.com/studio/run/managing-avds
  https://developer.android.com/studio/command-line/avdmanager
```

fixes #140656
2024-02-14 12:49:24 +00:00
Martin Kustermann abadf9ff8c
Use dart compile wasm for wasm compilations (#143298)
* Flags to `dart compile wasm`

Some options are not relevant to a standalone user of `dart compile
wasm` (e.g. specyfing dart-sdk, platform file etc). => Those aren't
offered by the `dart compile wasm` tool directly. => We use the
`--extra-compiler-option=` instead which passes through arbitrary
options to the dart2wasm compiler. => We don't maintain compatibility of
those options, if we update them we'll ensure to also update flutter
tools

* Binaryen optimization passes

This change will mean we use the binaryen flags from Dart SDK which are
slightly different from the ones in flutter.

* Optimization configuration

This change will also start using the more standardized `-O` flag for
determining optimization levels. The meaning of those flags have been
mostly aligned with dart2js (with some differences remaining).

* Minimization

Using the new optimization flags, namely `-O4` for `--wasm-opt=full`,
will automatically enable the new `--minify` support. Minification is
Dart semantics preserving but changes the `<obj>.runtimeType.toString()`
to use minified names (just as in dart2js).

* Code size changes

  Overall this change will reduce wonderous code size by around 10%.

Issue https://github.com/dart-lang/sdk/issues/54675
2024-02-14 11:15:14 +01:00
Andrew Kolos 14bcc694ff
Fix AssetsEntry::equals (#143355)
In service of https://github.com/flutter/flutter/issues/143348.

**Issue.** The `equals` implementation of `AssetsEntry` is incorrect. It compares `flavors` lists using reference equality. This PR addresses this.

This also adds a test to make sure valid asset `flavors` declarations are parsed correctly.

While we are here, this PR also includes a couple of refactorings:
  * `flutter_manifest_test.dart` is a bit large. To better match our style guide, I've factored out some related tests into their own file.
  *  A couple of changes to the `_validateListType` function in `flutter_manifest.dart`:
      * The function now returns a list of errors instead of accepting a list to append onto. This is more readable and also allows callers to know which errors were found by the call.
      * The function is renamed to `_validateList` and now accepts an `Object?` instead of an `YamlList`. If the argument is null, an appropriate error message is contained in the output. This saves callers that are only interested in validation from having to write their own null-check, which they all did before.
      * Some error strings were tweaked for increased readability and/or grammatical correctness.
2024-02-14 00:11:24 +00:00
Nate f01ce9f4cb
Have FocusManager respond to app lifecycle state changes (#142930)
fixes #87061

It doesn't matter whether I'm using Google Chrome, VS Code, Discord, or a Terminal window: any time a text cursor is blinking, it means that the characters I type will show up there.

And this isn't limited to text fields: if I repeatedly press `Tab` to navigate through a website, there's a visual indicator that goes away if I click away from the window, and it comes back if I click or `Alt+Tab` back into it.

<details open>
<summary>Example (Chrome):</summary>

![focus node](https://github.com/flutter/flutter/assets/10457200/bef42cd9-28e5-4214-b071-b7ef56b26609)

</details>

<details open>
<summary>This PR adds the same functionality to Flutter apps:</summary>

![Flutter demo](https://github.com/flutter/flutter/assets/10457200/6eb34c44-5fb0-4b27-aa10-6606a1eb187e)

</details>
2024-02-13 23:27:19 +00:00
Loïc Sharma b4270f7b06
Improve some scrollbar error messages (#143279)
Adds some missing spaces, rewords some errors, and splits some errors into more lines.
2024-02-13 22:46:56 +00:00
hangyu 14bce28f3c
[a11y] Add isEnabled semantics flag to text field (#143334)
Add a semantics flag to   text field to fix https://github.com/flutter/flutter/issues/143337 (in IOS the disabled text field is not read `dimmed`)

internal: b/322345393
2024-02-13 22:35:43 +00:00
Taha Tesser ccf42dde88
Introduce avatarBoxConstraints & deleteIconBoxConstraints for the chips (#143302)
fixes [Chip widget's avatar padding changing if label text is more than 1 line](https://github.com/flutter/flutter/issues/136892)

### Code sample

<details>
<summary>expand to view the code sample</summary> 

```dart
import 'package:flutter/material.dart';

List<String> strings = [
  'hello good morning',
  'hello good morning hello good morning',
  'hello good morning hello good morning hello good morning'
];

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.spaceEvenly,
            children: [
              Column(
                mainAxisSize: MainAxisSize.min,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  const Text(
                      'avatarBoxConstraints: null \ndeleteIconBoxConstraints: null',
                      textAlign: TextAlign.center),
                  for (String string in strings)
                    Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: RawChip(
                        label: Container(
                          width: 150,
                          color: Colors.amber,
                          child: Text(
                            string,
                            maxLines: 3,
                            overflow: TextOverflow.ellipsis,
                          ),
                        ),
                        avatar: const Icon(Icons.settings),
                        onDeleted: () {},
                      ),
                    ),
                ],
              ),
              Column(
                mainAxisSize: MainAxisSize.min,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  const Text(
                      'avatarBoxConstraints: BoxConstraints.tightForFinite() \ndeleteIconBoxConstraints: BoxConstraints.tightForFinite()',
                      textAlign: TextAlign.center),
                  for (String string in strings)
                    Padding(
                      padding: const EdgeInsets.all(8.0),
                      child: RawChip(
                        avatarBoxConstraints:
                            const BoxConstraints.tightForFinite(),
                        deleteIconBoxConstraints:
                            const BoxConstraints.tightForFinite(),
                        label: Container(
                          width: 150,
                          color: Colors.amber,
                          child: Text(
                            string,
                            maxLines: 3,
                            overflow: TextOverflow.ellipsis,
                          ),
                        ),
                        avatar: const Icon(Icons.settings),
                        onDeleted: () {},
                      ),
                    ),
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }
}

```

</details>

### Preview
![Screenshot 2024-02-12 at 14 58 35](https://github.com/flutter/flutter/assets/48603081/5724bd07-7ac7-4987-b992-fa3ab8488273)

# Example previews
![Screenshot 2024-02-12 at 22 15 14](https://github.com/flutter/flutter/assets/48603081/33af472d-3561-47d4-8d0d-e1628de1e0aa)
![Screenshot 2024-02-12 at 22 15 46](https://github.com/flutter/flutter/assets/48603081/3de78b59-5cb6-4fd8-879b-8e204aacb069)
2024-02-13 20:30:53 +00:00
Reid Baker a8e9f209a1
Update dependencies in integration test (#143111)
Update dependencies to latest versions
Related to #142618 
Fixes #143219

- [ x I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
2024-02-13 20:29:35 +00:00
Jackson Gardner 5a9fa1e7bf
Dual compile reland (#143262)
This is an attempt at a reland of https://github.com/flutter/flutter/pull/141396

The main changes here that are different than the original PR is fixes to wire up the `flutter test` command properly with the web renderer.
2024-02-13 20:02:10 +00:00
Andrew Kolos e8a75aa088
refactor: remove implicit globals dependencies in writeBundle (#143343)
This is in service of https://github.com/flutter/flutter/pull/141194

This will make it easier to get the `flutter run -d <browser>` and `flutter build fuschia` cases easier to get under test.
2024-02-13 19:38:37 +00:00
Matan Lurey 66367dd888
Remove message about pub cache that is not actionable (#143357)
... and neither the pub nor tools team think it's important.

Fixes https://github.com/flutter/flutter/issues/140628.
2024-02-13 11:15:15 -08:00
Taha Tesser 2adbc2b8ce
Fix chips constructor docs for callbacks (#143361)
fixes [ActionChip constructor documentation does not match class documentation](https://github.com/flutter/flutter/issues/137964)
2024-02-13 19:09:42 +00:00
Nate 8eea4f175f
Implementing switch expressions in widgets/ (#143293)
This PR is the 7ᵗʰ step in the journey to solve issue #136139 and make the entire Flutter repo more readable.

(previous pull requests: #139048, #139882, #141591, #142279, #142634, #142793)

This pull request covers everything in `packages/flutter/lib/src/widgets/`. Most of it should be really straightforward, but there was some refactoring in the `getOffsetToReveal()` function in `two_dimensional_viewport.dart`. I'll add some comments to describe those changes.
2024-02-13 18:51:03 +00:00
Gray Mackall 8ba086a277
[Re-re-land] Enforce a policy on supported Gradle, Java, AGP, and KGP versions (#143341)
This is a direct revert of (the revert of (the reland of (the policy pr))): https://github.com/flutter/flutter/pull/143132. 

The only change is:
1. to put a conditional all on one line, because the packages repository has a test that uses an old flutter project to make sure nothing regresses. The old project uses an old gradle version, and the old gradle version bundles an old groovy version, and the old groovy version has a bug where lines that start with `&&` don't always work: https://issues.apache.org/jira/browse/GROOVY-7218 (I enjoy that the revert reason ends up providing another strong justification to go forward with the policy). Also thanks to @reidbaker for pointing out this bug.
2. I also made a slight formatting change to the messages that print when out of the support bounds, which I think looks slightly better.

I tested this with on a branch that included a revert of https://github.com/flutter/flutter/pull/142008, and was able to recreate the failure and verify that it was resolved by 1).
2024-02-13 15:44:17 +00:00
Taha Tesser 1f8d110b8f
Fix InputDecorators suffix and prefix widgets are tappable when hidden (#143308)
fixes [The InputDecoration's suffix and prefix widget can be tapped even if it does not appear](https://github.com/flutter/flutter/issues/139916)

This PR also updates two existing tests to pass the tests for this PR. These tests are trying to tap prefix and  suffix widgets when they're hidden. While the linked issue had visible prefix and suffix widgets https://github.com/flutter/flutter/issues/39376 for reproduction.

### Code sample

<details>
<summary>expand to view the code sample</summary> 

```dart
import 'package:flutter/material.dart';

void main() {
  runApp(MainApp());
}

class MainApp extends StatelessWidget {
  final _messangerKey = GlobalKey<ScaffoldMessengerState>();

  MainApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      scaffoldMessengerKey: _messangerKey,
      home: Scaffold(
        body: Container(
          alignment: Alignment.center,
          padding: const EdgeInsets.all(16.0),
          child: TextField(
            decoration: InputDecoration(
              labelText: 'Something',
              prefix: GestureDetector(
                onTap: () {
                  _messangerKey.currentState?.showSnackBar(
                      const SnackBar(content: Text('A tap has occurred')));
                },
                child: const Icon(Icons.search),
              ),
              suffix: GestureDetector(
                onTap: () {
                  _messangerKey.currentState?.showSnackBar(
                      const SnackBar(content: Text('A tap has occurred')));
                },
                child: const Icon(Icons.search),
              ),
            ),
          ),
        ),
      ),
    );
  }
}
```

</details>

### Before
![ScreenRecording2024-02-12at18 40 34-ezgif com-video-to-gif-converter](https://github.com/flutter/flutter/assets/48603081/c101e0d6-ce5a-4b28-9626-28bcb83d2a5c)

### After
![ScreenRecording2024-02-12at18 40 10-ezgif com-video-to-gif-converter](https://github.com/flutter/flutter/assets/48603081/923b348e-8adf-4d64-9dc3-e75d30e3e2fb)
2024-02-13 08:48:18 +00:00
Tirth e93a10d1fb
Pass-Through inputFormatters in DropdownMenu (#143250)
Pass-Through `inputFormatters` in `DropdownMenu`.

Fixes: #142374
2024-02-13 03:57:15 +00:00
Taha Tesser d271791e8c
Fix insetPadding parameter nullability for dialogs (#143305)
fixes [`insetPadding` should be nullable in dialogs](https://github.com/flutter/flutter/issues/117125)
2024-02-13 00:12:02 +00:00
Camille Simon 0650b76884
Revert "Migrate integration_test plugin to Gradle Kotlin DSL (#142008)" (#143329)
This reverts https://github.com/flutter/flutter/pull/142008 because it broke the Flutter --> packages roller.
2024-02-12 23:26:18 +00:00
Ross Llewallyn 525cffd717
Badge class doc typo - missing [ (#143318)
Doc typo fix

No issue made
2024-02-12 23:24:41 +00:00
Kevin Moore e1645b150f
[web] Move JS interop to extension types (#143274)
Now that we can bump the min SDK to latest.
2024-02-12 11:14:10 -08:00
Valentin Vignal 52f923c360
Add documentation for best practices for StreamBuilder like FutureBuilder (#143295)
Fixes https://github.com/flutter/flutter/issues/142189
2024-02-12 18:25:57 +00:00
Nitesh Sharma 49f620d8ea
Fix dual focus issue in CheckboxListTile, RadioListTile and SwitchListTile (#143213)
These widgets can now only receive focus once when tabbing through the focus tree.
2024-02-12 10:07:51 -08:00
Reid Baker ace3e58f0a
Revert "[Re-land] Enforce a policy on supported Gradle, Java, AGP, and KGP versions" (#143314)
Reverts flutter/flutter#143132
2024-02-12 18:04:05 +00:00
Jenn Magder 1d25b0c700
Update integration_test iOS FTL README script to remove targeted version (#143248)
1. Remove `dev_target` from suggested Firebase Test Lab iOS script and use wildcard instead.
2. First run `flutter clean` before building to avoid collisions between runs.
3. Use `zip --must-match` in case the xctestrun or `Release-iphoneos` directories are missing (like ran with `--profile` instead of `--release` on purpose) to fail instead of zipping up only part of what's needed.

This came out of a discussion with FTL about these instructions and I tried to run them locally and avoided setting `dev_target`.

See also #74428
2024-02-12 17:53:05 +00:00
Tirth 10442399fb
Introduce iconAlignment for the buttons with icon (#137348)
Adds `iconAlignment` property to `ButtonStyleButton` widget.

Fixes #89564

### Example

https://github.com/flutter/flutter/assets/13456345/1b5236c4-5c60-4915-b3c6-0a56c43f8a19
2024-02-12 17:08:20 +00:00
LongCatIsLooong bc49cf8091
Fix text painter longest line resizing logic for TextWidthBasis.longestLine (#143024)
Fixes https://github.com/flutter/flutter/issues/142309.
2024-02-10 23:39:20 +00:00
Polina Cherkasova b48dfca382
Upgrade leak_tracker. (#143236) 2024-02-09 14:41:22 -08:00
Kris Pypen 2f117c545b
Fix: performance improvement on golden test comparison (#142913)
During golden test image comparison 2 lists of a different type are compared with the method "identical", so this will never be true. The test image is a _Uint8ArrayView while the master image is an Uint8List. So that results in always a heavy computation to get the difference between the test and the master image.

When you run this test snippet I go from 51 seconds to 14 seconds:
```dart
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

void main() {
  for (int i = 0; i < 100; i++) {
    testWidgets('Small test', (WidgetTester tester) async {
      await tester.pumpWidget(Directionality(textDirection: TextDirection.ltr, child: Text('jo')));
      await expectLater(find.byType(Text), matchesGoldenFile('main.png'));
    });
  }
}
```
2024-02-09 22:05:00 +00:00
Nate 1887bc410f
Implementing switch expressions in lib/src/material/ (#142793)
This PR is the 6ᵗʰ step in the journey to solve issue #136139 and make the entire Flutter repo more readable.

(previous pull requests: #139048, #139882, #141591, #142279, #142634)

The current focus is on `packages/flutter/lib/src/material/`. The previous 2 PRs covered files in this directory starting with letters `a-m`; this one takes care of everything else.
2024-02-09 22:03:23 +00:00
Henry Riehl fa71e8029b
Add position data to OnDragEnd callback (#140378)
This PR adds localPosition/globalPosition data to the `DragEndDetails`
argument of the `onDragEnd` callback.
2024-02-09 12:37:20 -08:00
Jenn Magder 2fc19619e8
Set plugin template minimum iOS version to 12.0 (#143167)
Fixes https://github.com/flutter/flutter/issues/140474

See https://github.com/flutter/flutter/pull/122625 where this was done 11->12.
2024-02-09 18:32:10 +00:00
Bartek Pacia 60f30a65b4
Migrate integration_test plugin to Gradle Kotlin DSL (#142008)
We already have a simple app in this repo that fully uses Gradle Kotlin DSL (see #141541). The next small step is to have at least one plugin that also uses Gradle Kotlin DSL. Let's use `integration_test` for that, since it's versioned with Flutter SDK.
2024-02-09 18:07:56 +00:00
David Martos f0bb9d57e6
barrierColor property in DialogTheme (#142490) 2024-02-09 01:50:14 -08:00
Michael Goderbauer 0aa9b5e17d
Layout animated GIFs only once (#143188)
Fixes https://github.com/flutter/flutter/issues/138610.

When `RenderImage` receives a new `Image` it only needs to fire up the layout machinery when the dimensions of the image have changed compared to the previous image. If the dimensions are the same, a repaint is sufficient.
2024-02-09 01:12:06 +00:00
Gustl22 2299ec781f
Set default flutter source directory for gradle builds (#142934)
See [#142498](https://github.com/flutter/flutter/pull/142498#discussion_r1478602032)
See this discussion: https://discord.com/channels/608014603317936148/1186378330178601000
2024-02-08 22:28:39 +00:00
Gray Mackall 4b0abc7771
[Re-land] Enforce a policy on supported Gradle, Java, AGP, and KGP versions (#143132)
Re land of https://github.com/flutter/flutter/pull/142000. 
Differences:
1. Fixed the test that was failing in postsubmit. The reason was that the Flutter Gradle Plugin was being applied after KGP in that test, so we couldn't find the KGP version. This caused a log, and the test expects no logs. I moved FGP to after KGP
2. Added to the logs for when we can't find AGP. Change is from
>  "Warning: unable to detect project AGP version. Skipping version checking."

to 
> ~"Warning: unable to detect project AGP version. Skipping version checking. \nThis may be because you have applied the Flutter Gradle Plugin after AGP."~

update: the above is wrong, changed to 
> "Warning: unable to detect project KGP version. Skipping version checking. \nThis may be because you have applied AGP after the Flutter Gradle Plugin."

3. Added a note to the app-level build.gradle templates that FGP must go last
> // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugin.
2024-02-08 22:10:58 +00:00
Jackson Gardner 2efeeb47bc
Revert Dual Web Compile changes (#143175)
Dual Web Compile has had some issues where `flutter test` is not respecting the `--web-renderer` flag for some reason. I haven't gotten entirely to the bottom of the issue, but for now we need to rever these changes while I investigate. This reverts the following PRs:

https://github.com/flutter/flutter/pull/143128
https://github.com/flutter/flutter/pull/141396

While doing this revert, I had a few merge conflicts with https://github.com/flutter/flutter/pull/142760, and I tried to resolve the merge conflicts within the spirit of that PR's change, but @chingjun I might need your input on whether the imports I have modified are okay with regards to the change you were making.
2024-02-08 21:45:09 +00:00
Michael Goderbauer 8d3c7b6f6a
Cross-link SliverFixedExtentList/SliverPrototypeExtentList/SliverVariedExtentList (#143184)
Fixes https://github.com/flutter/flutter/issues/141678.
2024-02-08 21:45:06 +00:00
Zachary Anderson fbc9f2d5bf
[flutter_tool] Retry a gradle build on connection timeout (#143084)
This PR will likely not help with the issue on our CI discussed in
https://github.com/flutter/flutter/issues/142637, but will do one retry
for our users if they hit the same issue.
2024-02-08 12:39:00 -08:00
Qun Cheng cc4abe92fb
Correct menu position when menu is constrained (#143121)
Fixes #142896

The original code below is to always place the selected item above(overlap) the popup button so that the selected item can always be visible: f8a77225f3/packages/flutter/lib/src/material/popup_menu.dart (L723-L732)

But when menu height is constrained and the menu itself is super long, the selected item still assumes there is enough space to push up all the items whose index is smaller than the selected index. As a result, every time when the menu is open, the calculation provides a different result to be the offset for the selected index,  and then with a constrained height, the menu looks jumping all over the place based on the different selected index.

https://github.com/flutter/flutter/assets/36861262/ad761f95-0ff5-4311-a81d-dac56df879c5

Even though the original calculation is to make the selected item visible when open the menu, the menu doesn't auto scroll and only expands itself as much as possible to show the selected one. In this case, if the screen it too small to show the selected item, we still cannot see it. This can be fixed by using `Scrollable.ensureVisible()`(#143118).

So we remove the calculation in this PR and the menu will always show up based on the top left of the anchor(button).

https://github.com/flutter/flutter/assets/36861262/03272f26-9440-4ac4-a701-9a0b41776ff9
2024-02-08 20:36:24 +00:00
Daco Harkes 4e70bfae2b
Reland "Move native assets to isolated/ directory" (#143055)
Reland of https://github.com/flutter/flutter/pull/142709.

The revert of the revert is in the first commit, the fix in the commit on top.

The move of the fakes for packages/flutter_tools/test/general.shard/resident_runner_test.dart was erroneous before, as it was trying to use setters instead of a private field. This PR changes the private `_devFS` field in the fake to be a public `fakeDevFS` in line with other fakes.

## Original PR description

Native assets in other build systems are not built with `package:native_assets_builder` invoking `build.dart` scripts. Instead all packages have their own blaze rules. Therefore we'd like to not depend on `package:native_assets_builder` from flutter tools in g3 at all.

This PR aims to move the imports of `native_assets_builder` and `native_assets_cli` into the `isolated/` directory and into the files with a `main` function that are not used in with other build systems.

In order to be able to remove all imports in files used by other build systems, two new interfaces are added `HotRunnerNativeAssetsBuilder` and `TestCompilerNativeAssetsBuilder`. New parameters are then piped all the way through from the entry points:

* bin/fuchsia_tester.dart
* lib/executable.dart

The build_system/targets dir is already excluded in other build systems.

So, after this PR only the two above files and build_system/targets import from `isolated/native_assets/` and only `isolated/native_assets/` import `package:native_assets_cli` and `package:native_assets_builder`.

Context:

* https://github.com/flutter/flutter/issues/142041
2024-02-08 17:49:48 +00:00
Bartek Pacia deaa600204
Reland "Update gradle lockfiles template (#140115)" (#143081)
Trying to reland #140115 which I had to revert in #142889 because [it broke the tree](https://github.com/flutter/flutter/pull/140115#issuecomment-1925774719).

In this PR I fixed the post-submit following tests:
2024-02-08 16:22:15 +00:00
Jackson Gardner 71c6cd0cb9
Pass along web renderer into debugging options in the test command. (#143128)
We need to pass along the web renderer in the debugging options to make sure that the resident web runner sets up the targets correctly.
2024-02-08 01:21:07 +00:00
Qun Cheng d85497d91b
Add a unit test for NavigationRail (#143108)
Adding `SingleChildScrollView` to `NavigationRail` may cause exception if the nav rail has some expanded widgets inside, like the issue: https://github.com/flutter/flutter/issues/143061. This PR is just to add a unit test to avoid causing this breaking again.
2024-02-07 23:14:56 +00:00
auto-submit[bot] cc4e07954d
Reverts "Improve build output for all platforms" (#143125)
Reverts flutter/flutter#128236

Initiated by: vashworth

Reason for reverting: Causing `Mac_pixel_7pro run_release_test` and `Mac_arm64_android run_release_test` to fail: https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_pixel_7pro%20run_release_test/547/overview 
https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_arm64_android%20run_release_test/10516/overview

Original PR Author: guidezpl

Reviewed By: {christopherfujino, loic-sharma}

This change reverts the following previous change:
Original Description:
Improves the build output:

1. Gives confirmation that the build succeeded, in green
1. Gives the path to the built executable, without a trailing period to make it slightly easier to cmd/ctrl+open
1. Gives the size of the built executable (when the built executable is self contained) 

### `apk`, `appbundle` 

<img width="607" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ecc52abe-cd2e-4116-b22a-8385ae3e980d">

<img width="634" alt="image" src="https://github.com/flutter/flutter/assets/6655696/8af8bd33-c0bd-4215-9a06-9652ee019436">

### `macos`, `ios`, `ipa`
Build executables are self-contained and use a newly introduced `OperatingSystemUtils.getDirectorySize`.

<img width="514" alt="image" src="https://github.com/flutter/flutter/assets/6655696/b5918a69-3959-4417-9205-4f501d185257">

<img width="581" alt="image" src="https://github.com/flutter/flutter/assets/6655696/d72fd420-18cf-4470-9e4b-b6ac10fbcd50">

<img width="616" alt="image" src="https://github.com/flutter/flutter/assets/6655696/5f235ce1-252a-4c13-898f-139f6c7bc698">

### `windows`, `linux`, and `web`
Build executables aren't self-contained, and folder size can sometimes overestimate distribution size, therefore their size isn't mentioned (see discussion below).

<img width="647" alt="image" src="https://github.com/flutter/flutter/assets/6655696/7179e771-1eb7-48f6-b770-975bc073437b">

<img width="658" alt="image" src="https://github.com/flutter/flutter/assets/6655696/a6801cab-7b5a-4975-a406-f4c9fa44d7a2">

<img width="608" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ee7c4125-a273-4a65-95d7-ab441edf8ac5">

### Size reporting
When applicable, the printed size matches the OS reported size.

- macOS
    <img width="391" alt="image" src="https://github.com/flutter/flutter/assets/6655696/881cbfb1-d355-444b-ab44-c1a6343190ce">
- Windows
    <img width="338" alt="image" src="https://github.com/flutter/flutter/assets/6655696/3b806def-3d15-48a9-8a25-df200d6feef7">
- Linux   
    <img width="320" alt="image" src="https://github.com/flutter/flutter/assets/6655696/89a4aa3d-2148-4f3b-b231-f93a057fee2b">

## Related issues
Part of #120127
Fixes https://github.com/flutter/flutter/issues/121401
2024-02-07 22:44:19 +00:00
Pierre-Louis 2fceeb0e3c
Improve build output for all platforms (#128236)
Improves the build output:

1. Gives confirmation that the build succeeded, in green
1. Gives the path to the built executable, without a trailing period to make it slightly easier to cmd/ctrl+open
1. Gives the size of the built executable (when the built executable is self contained) 

### `apk`, `appbundle` 

<img width="607" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ecc52abe-cd2e-4116-b22a-8385ae3e980d">

<img width="634" alt="image" src="https://github.com/flutter/flutter/assets/6655696/8af8bd33-c0bd-4215-9a06-9652ee019436">

### `macos`, `ios`, `ipa`
Build executables are self-contained and use a newly introduced `OperatingSystemUtils.getDirectorySize`.

<img width="514" alt="image" src="https://github.com/flutter/flutter/assets/6655696/b5918a69-3959-4417-9205-4f501d185257">

<img width="581" alt="image" src="https://github.com/flutter/flutter/assets/6655696/d72fd420-18cf-4470-9e4b-b6ac10fbcd50">

<img width="616" alt="image" src="https://github.com/flutter/flutter/assets/6655696/5f235ce1-252a-4c13-898f-139f6c7bc698">

### `windows`, `linux`, and `web`
Build executables aren't self-contained, and folder size can sometimes overestimate distribution size, therefore their size isn't mentioned (see discussion below).

<img width="647" alt="image" src="https://github.com/flutter/flutter/assets/6655696/7179e771-1eb7-48f6-b770-975bc073437b">

<img width="658" alt="image" src="https://github.com/flutter/flutter/assets/6655696/a6801cab-7b5a-4975-a406-f4c9fa44d7a2">

<img width="608" alt="image" src="https://github.com/flutter/flutter/assets/6655696/ee7c4125-a273-4a65-95d7-ab441edf8ac5">

### Size reporting
When applicable, the printed size matches the OS reported size.

- macOS
    <img width="391" alt="image" src="https://github.com/flutter/flutter/assets/6655696/881cbfb1-d355-444b-ab44-c1a6343190ce">
- Windows
    <img width="338" alt="image" src="https://github.com/flutter/flutter/assets/6655696/3b806def-3d15-48a9-8a25-df200d6feef7">
- Linux   
    <img width="320" alt="image" src="https://github.com/flutter/flutter/assets/6655696/89a4aa3d-2148-4f3b-b231-f93a057fee2b">

## Related issues
Part of #120127
Fixes https://github.com/flutter/flutter/issues/121401
2024-02-07 22:22:25 +00:00
yim 16e7218cd4
Fixed cursor blinking during selection. (#141380)
The cursor now correctly stops blinking while it's being interacted with.
2024-02-07 13:39:30 -08:00
auto-submit[bot] d60643e82f
Reverts "Enforce a policy on supported Gradle, Java, AGP, and KGP versions" (#143114)
Reverts flutter/flutter#142000

Initiated by: vashworth

Reason for reverting: Causing `Mac_pixel_7pro run_release_test` and `Mac_arm64_android run_debug_test_android` to fail: https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_pixel_7pro%20run_release_test/539/overview
https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_arm64_android%20run_debug_test_android/6682/overview

Original PR Author: gmackall

Reviewed By: {reidbaker, camsim99, bartekpacia}

This change reverts the following previous change:
Original Description:
Policy per https://flutter.dev/go/android-dependency-versions.

https://github.com/flutter/flutter/issues/140913

~Still a WIP while I clean up some error handling, remove some prints, and figure out a Java test (more difficult than the others because I believe we can only install one java version per ci shard).~

~Also it looks like there are errors that I need to fix when this checking is applied to a project that uses the old way of applying AGP/KGP using the top-level `build.gradle` file (instead of the new template way of applying them in the `settings.gradle` file).~ Done, this is why [these lines exist](9af6bae6b9/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy (L72-L88)) in `flutter.groovy`. They just needed to be added
2024-02-07 21:22:26 +00:00
Gray Mackall 337bc79b0c
Enforce a policy on supported Gradle, Java, AGP, and KGP versions (#142000)
Policy per https://flutter.dev/go/android-dependency-versions.

https://github.com/flutter/flutter/issues/140913

~Still a WIP while I clean up some error handling, remove some prints, and figure out a Java test (more difficult than the others because I believe we can only install one java version per ci shard).~

~Also it looks like there are errors that I need to fix when this checking is applied to a project that uses the old way of applying AGP/KGP using the top-level `build.gradle` file (instead of the new template way of applying them in the `settings.gradle` file).~ Done, this is why [these lines exist](9af6bae6b9/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy (L72-L88)) in `flutter.groovy`. They just needed to be added
2024-02-07 20:56:07 +00:00
Jackson Gardner 2aef6c570c
Fix inputs and outputs for WebReleaseBundle (#143023)
Since `WebReleaseBundle` is responsible for copying over the outputs from the subtargets, so it needs to be reflected in inputs and outputs so that things will be recopied when something changes.
2024-02-07 20:00:02 +00:00
Ian Hickson 9fccb32a58
Various improvements to text-editing-related documentation. (#142561) 2024-02-07 19:58:06 +00:00
Michael Goderbauer 4becae25b0
Revert "Add SingleChildScrollView for NavigationRail" (#143097)
Reverts flutter/flutter#137415

Reverting due to https://github.com/flutter/flutter/issues/143061. this is breaking some existing use cases, see also https://github.com/flutter/samples/pull/2157. If we try this again, we need to add this in less breaking way.

Fixes https://github.com/flutter/flutter/issues/143061
2024-02-07 19:30:02 +00:00
Gray Mackall 120a01ccd2
Restore log dumps for gradle OOM crashes, and set a value for MaxMetaspaceSize (#143085)
Re-sets two jvmargs that were getting cleared because we set a value for `-Xmx`. Could help with https://github.com/flutter/flutter/issues/142957. Copied from comment here https://github.com/flutter/flutter/issues/142957:
>Two random things I ran into while looking into this that might help:
>
>1. Gradle has defaults for a couple of the jvmargs, and setting any one of them clears those defaults for the others (bug here https://github.com/gradle/gradle/issues/19750). This can cause the "Gradle daemon to consume more and more native memory until it crashes", though the bug typically has a different associated error. It seems worth it to re-set those defaults.
>2. There is a property we can set that will give us a heap dump on OOM ([-XX:HeapDumpOnOutOfMemoryError](https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/clopts001.html))

Mostly just a find and replace from `find . -name gradle.properties -exec sed -i '' 's/\-Xmx4G/-Xmx4G\ \-XX:MaxMetaspaceSize=2G\ \-XX:+HeapDumpOnOutOfMemoryError/g' {} \;`, with the templates and the one test that writes from a string replaced by hand. I didn't set a value for `MaxMetaspaceSize` in the template files because I want to make sure this value doesn't cause problems in ci first (changes to the templates are essentially un-revertable for those who `flutter create` while the changes exist).
2024-02-07 19:25:39 +00:00
Ian Hickson 1699ff38fe
Add a test for the isAvailableForEnvironment logic (#142251)
This is part 3 of a broken down version of the #140101 refactor.

There's some TODOs showing where I think we should change the behaviour, but in this PR the behaviour is unchanged.
A future PR will remove the tests that are redundant with these tests, but I wanted to make sure we had both sets in the codebase at the same time first.
This PR includes a change to the golden control test so that we can verify that these specific values do work on main. It would be extremely surprising if not, but in the interests of rigour...
2024-02-07 19:01:48 +00:00
Valentin Vignal ab836a2db0
Add the number of mismatched pixels to golden tests output (#142975)
Fixes https://github.com/flutter/flutter/issues/141036
2024-02-07 18:59:57 +00:00
Michael Goderbauer 0202e3bf7a
Add indexInParent to SemanticsNode debug information (#142826)
https://github.com/flutter/flutter/issues/93232
2024-02-07 18:51:04 +00:00
Andrew Kolos 34c2080b9d
Remove redundant rootDirectoryPath parameter in DevFS::update (#143034)
Resolves #143041
2024-02-07 18:04:31 +00:00
maRci002 8e2da8414c
Handle transitions to AppLifecycleState.detached in lifecycle state generation (#142523)
Generates the correct lifecycle state transitions in ServicesBinding when detaching.
2024-02-07 10:01:22 -08:00
Bruno Leroux 6a7baf573e
Fix M3 text field height + initial step for input decorator M3 test migration (#142981)
## Description

This PR main purpose is to make progress on the M3 test migration for `InputDecorator` (see https://github.com/flutter/flutter/issues/139076).

Before this PR more than 80 of the 156 tests defined in `input_decorator_test.dart` fail on M3.
Migrating all those tests in one shot is not easy at all because many failures are related to wrong positionning due to M3 typography changes. Another reason is that several M3 specific changes are required in order to get a proper M3 compliant text field, for instance:
- https://github.com/flutter/flutter/issues/142972
- https://github.com/flutter/flutter/issues/141354

Most of the tests were relying on an helper function (`buildInputDecorator`) which had a `useMaterial3` parameter. Unfortunately when `useMaterial3: true `was passed to this function it forced `useMaterial3: false` at the top level but overrided it at a lower level, which was very misleading because people could assume that the tests are ok with M3 (but in fact they were run using M2 typography but have some M3 logic in use).
I considered various way to make this change and I finally decided to run all existing tests only on M2 for the moment. Next step will be to move most of those tests to M3. In this PR, I migrated two of these existing tests for illustration.

Because many of the existing tests are checking input decorator height, I think it would also make sense to fix https://github.com/flutter/flutter/issues/142972 first. That's why I choosed to include a fix to https://github.com/flutter/flutter/issues/142972 in this PR.

A M3 filled `TextField` on Android:

| Before this PR | After this PR |
|--------|--------|
| ![image](https://github.com/flutter/flutter/assets/840911/403225b7-4c91-4aee-b19c-0490447ae7e3) | ![image](https://github.com/flutter/flutter/assets/840911/e96cf786-a9f5-4e15-bcdd-078350ff1608) | 

## Related Issue

Fixes https://github.com/flutter/flutter/issues/142972
Related to https://github.com/flutter/flutter/issues/139076

## Tests

Updates many existing tests 
+ adds 2 tests related to the fix for https://github.com/flutter/flutter/issues/142972
+ adds 1 tests for the M3 migration
+ move 1 tests related to M3
2024-02-07 13:57:21 +00:00
Taha Tesser c539ded64b
[reland] Add AnimationStyle to showSnackBar (#143052)
[Original was reverted due to uncaught analysis failure 
](https://github.com/flutter/flutter/pull/142825#issuecomment-1930620085)

---

fixes [`showSnackBar` is always replacing `animation` parameter of `SnackBar`](https://github.com/flutter/flutter/issues/141646)

### Code sample preview

![Screenshot 2024-02-02 at 21 10 57](https://github.com/flutter/flutter/assets/48603081/66d808f0-d638-4561-b9a4-96d1b93938f4)
2024-02-07 10:26:27 +00:00
Jason Simmons db141ecd28
Copy the flutter version JSON file into the simulated Flutter SDK used by update_packages (#143035)
Dart pub now expects that file to be present in a Flutter SDK (see
https://dart.googlesource.com/pub/+/dce232ec195df802a730eb3a66163e28d2ec6444)
2024-02-06 20:00:08 -08:00
Dan Field 7514c16a6a
Dispose precached image info (#143017)
`precacheImage` was failing to dipose the `ImageInfo` it receives. That's part of the contract of being an image listener.

I'm doing this in the frame callback for the same reason as evicting it from the cache.
2024-02-07 03:28:06 +00:00
Polina Cherkasova ac5c3dec87
Instrument CurvedAnimation. (#143007) 2024-02-07 03:26:40 +00:00
Andrew Brampton 10f1e63579
Update _goldens_io.dart to generate failure images during a size mism… (#142177)
Update the `matchesGoldenFile()` / `LocalComparisonOutput` code to generate failure images for golden tests that fail when the image sizes do not match. This can make it far quicker to identify what is wrong with the test image.

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

- [ x I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
2024-02-07 03:23:29 +00:00
auto-submit[bot] 310a7edbca
Reverts "Activate InkSparkle on CanvasKit" (#143036)
Reverts flutter/flutter#138545

Initiated by: zanderso

Reason for reverting: Failing in post-submit: https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20web_long_running_tests_5_5/14975/overview

```
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞═════════════════
The following FormatException was thrown running a test:
Invalid Shader Data

When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.da

Original PR Author: bleroux

Reviewed By: {Piinks}

This change reverts the following previous change:
Original Description:
## Description

This PR activates the M3 `InkSparkle` splash animation on Android + CanvasKit.
Before it `InkSparkle` was only activated on native Android.

## Related Issue

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

## Tests

Updates several existing tests.
2024-02-07 02:44:21 +00:00
Bruno Leroux 7f811fb444
Activate InkSparkle on CanvasKit (#138545)
## Description

This PR activates the M3 `InkSparkle` splash animation on Android + CanvasKit.
Before it `InkSparkle` was only activated on native Android.

## Related Issue

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

## Tests

Updates several existing tests.
2024-02-07 00:28:04 +00:00
Chris Bracken 9f8fe3f04c
[Windows] Fix signed/unsigned int comparison (#142341)
Previously, we were comparing the signed int `target_length` (returned by WideCharToMultiByte) to a size_t string length, resulting in a signed/unsigned comparison warning as follows:

```
windows\runner\utils.cpp(54,43): warning C4018:  '>': signed/unsigned mismatch
```

WideCharToMultiByte returns:
* 0 on error
* the number of bytes written to the buffer pointed to by its fifth parameter, lpMultiByteStr, on success.

As a result it's safe to store the return value in an unsigned int, which eliminates the warning.

No changes to tests since this is dependent on end-user project settings/modifications and does not trigger a warning with default project settings.

Fixes: https://github.com/flutter/flutter/issues/134227
2024-02-07 00:09:57 +00:00
auto-submit[bot] ceca606662
Reverts "Move native assets to isolated/ directory" (#143027)
Reverts flutter/flutter#142709

Initiated by: vashworth

Reason for reverting: `Mac tool_tests_general` started failing on this commit: https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20tool_tests_general/15552/overview

Original PR Author: dcharkes

Reviewed By: {christopherfujino, chingjun, reidbaker}

This change reverts the following previous change:
Original Description:
Native assets in other build systems are not built with `package:native_assets_builder` invoking `build.dart` scripts. Instead all packages have their own blaze rules. Therefore we'd like to not depend on `package:native_assets_builder` from flutter tools in g3 at all.

This PR aims to move the imports of `native_assets_builder` and `native_assets_cli` into the `isolated/` directory and into the files with a `main` function that are not used in with other build systems.

In order to be able to remove all imports in files used by other build systems, two new interfaces are added `HotRunnerNativeAssetsBuilder` and `TestCompilerNativeAssetsBuilder`. New parameters are then piped all the way through from the entry points:

* bin/fuchsia_tester.dart
* lib/executable.dart

The build_system/targets dir is already excluded in other build systems.

So, after this PR only the two above files and build_system/targets import from `isolated/native_assets/` and only `isolated/native_assets/` import `package:native_assets_cli` and `package:native_assets_builder`.

Context:

* https://github.com/flutter/flutter/issues/142041
2024-02-07 00:01:18 +00:00
Simon Friis Vindum 2911bfb84c
Make destructiveRed a CupertinoDynamicColor (#141364)
`destructiveRed` is an alias for `systemRed`, but, in the definition, the precise type information is lost.

This PR gives `destructiveRed` the type `CupertinoDynamicColor` (and not the superclass `Color`) like all the other colors defined in this file.
2024-02-06 21:26:52 +00:00
Daco Harkes a069e62e8a
Move native assets to isolated/ directory (#142709)
Native assets in other build systems are not built with `package:native_assets_builder` invoking `build.dart` scripts. Instead all packages have their own blaze rules. Therefore we'd like to not depend on `package:native_assets_builder` from flutter tools in g3 at all.

This PR aims to move the imports of `native_assets_builder` and `native_assets_cli` into the `isolated/` directory and into the files with a `main` function that are not used in with other build systems.

In order to be able to remove all imports in files used by other build systems, two new interfaces are added `HotRunnerNativeAssetsBuilder` and `TestCompilerNativeAssetsBuilder`. New parameters are then piped all the way through from the entry points:

* bin/fuchsia_tester.dart
* lib/executable.dart

The build_system/targets dir is already excluded in other build systems.

So, after this PR only the two above files and build_system/targets import from `isolated/native_assets/` and only `isolated/native_assets/` import `package:native_assets_cli` and `package:native_assets_builder`.

Context:

* https://github.com/flutter/flutter/issues/142041
2024-02-06 20:59:49 +00:00
Callum Moffat 1aa6ff5614
Fix CupertinoPageScaffold resizeToAvoidBottomInset (#142776)
Need to create a `MediaQuery` to expose the fact that the `viewInsets` have been consumed.

Fixes #142775
2024-02-06 20:57:53 +00:00
auto-submit[bot] 83aca58fa7
Reverts "Add AnimationStyle to showSnackBar" (#143001)
Reverts flutter/flutter#142825

Initiated by: zanderso

Reason for reverting: Analysis failure closing the engine tree https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8756815302197889649/+/u/Framework_analyze/Framework_analyze/stdout?format=raw

Original PR Author: TahaTesser

Reviewed By: {HansMuller}

This change reverts the following previous change:
Original Description:
fixes [`showSnackBar` is always replacing `animation` parameter of `SnackBar`](https://github.com/flutter/flutter/issues/141646)

### Code sample preview

![Screenshot 2024-02-02 at 21 10 57](https://github.com/flutter/flutter/assets/48603081/66d808f0-d638-4561-b9a4-96d1b93938f4)
2024-02-06 19:35:19 +00:00
David Martos 37fd173e03
Material 3 - Tab indicator stretch animation (#141954)
Fixes #128696 (Motion checkbox)

This PR updates the Material 3 tab indicator animation, so that it stretches, as it can be seen in the showcase videos in the specification https://m3.material.io/components/tabs/accessibility#13ed756b-fb35-4bb3-ac8c-1157e49031d8

One thing to note is that the Material 3 videos have a tab transition duration of 700 ms, whereas currently in Flutter the duration is 300 ms. I recorded 4 comparison videos to see the difference better (current animation vs stretch animation  and  300 ms vs 700 ms)
@Piinks You mentioned the other day that the default tab size could be updated in the future to better reflect the new size in M3. Maybe the `kTabScrollDuration` constant is another one that could end up being updated, as 300 ms for this animation feels too fast.

Here are the comparison videos (Material 3 spec showcase on the left and Flutter on the right)

## Original animation - 300 ms

https://github.com/flutter/flutter/assets/22084723/d5b594fd-52ea-4328-b8e2-ddb597c81f69

## New animation - 300 ms

https://github.com/flutter/flutter/assets/22084723/c822f7ab-3fc4-4403-a53b-872d047f6227

---

## Original animation - 700 ms

https://github.com/flutter/flutter/assets/22084723/fe39a32d-3d10-4c0d-98df-bd5e1c9336d0

## New animation - 700 ms

https://github.com/flutter/flutter/assets/22084723/8d4b0628-6312-40c2-bd99-b4bcb8e23ba9

---

## Code sample

```dart
void main() => runApp(const MyApp());

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: TabExample(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      initialIndex: 1,
      length: 3,
      child: Scaffold(
        appBar: AppBar(
          title: const Text('My saved media'),
          bottom: const TabBar(
            tabs: <Widget>[
              Tab(
                icon: Icon(Icons.videocam_outlined),
                text: "Video",
              ),
              Tab(
                icon: Icon(Icons.photo_outlined),
                text: "Photos",
              ),
              Tab(
                icon: Icon(Icons.audiotrack),
                text: "Audio",
              ),
            ],
          ),
        ),
        body: const TabBarView(
          children: <Widget>[
            Center(
              child: Text("Tab 1"),
            ),
            Center(
              child: Text("Tab 2"),
            ),
            Center(
              child: Text("Tab 3"),
            ),
          ],
        ),
      ),
    );
  }
}
```

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2024-02-06 19:01:49 +00:00
Taha Tesser 0cc381da19
Add AnimationStyle to showSnackBar (#142825)
fixes [`showSnackBar` is always replacing `animation` parameter of `SnackBar`](https://github.com/flutter/flutter/issues/141646)

### Code sample preview

![Screenshot 2024-02-02 at 21 10 57](https://github.com/flutter/flutter/assets/48603081/66d808f0-d638-4561-b9a4-96d1b93938f4)
2024-02-06 18:54:41 +00:00
Renzo Olivares 0903bf7055
TextField context menu should fade on scroll on mobile devices (#138313)
This change affects Android and iOS devices using the TextField's context menu. After this change the context menu will fade out when scrolling the text and fade in when the scroll ends. 

If the scroll ends and the selection is outside of the view, then the toolbar will be scheduled to show in a future scroll end. This toolbar scheduling can be invalidated if the `TextEditingValue` changed anytime between the scheduling and when the toolbar is ready to be shown.

This change also fixes a regression where the TextField context menu would not fade when the selection handles where not visible.

When using the native browser context menu this behavior is not controlled by Flutter.

https://github.com/flutter/flutter/assets/948037/3f46bcbb-ba6f-456c-8473-e42919b9d572

Fixes #52425
Fixes #105804
Fixes #52426
2024-02-06 05:42:40 +00:00
Shaun Byrne c21fbabc2b
Grey out non-selectable days in CupertinoDatePicker (#136181)
This PR changes the text color of non-selectable days in the CupertinoDatePicker to match non-selectable months and years.

Current:
![Screenshot_1696829290](https://github.com/flutter/flutter/assets/147121557/209fee88-9efc-4b92-803a-453ecc6a7c16)

New:
![Screenshot_1696830232](https://github.com/flutter/flutter/assets/147121557/ecd11266-4c22-49cc-9bb5-2df39d10cf79)

Fixes #136179
2024-02-05 23:49:17 +00:00
Ann Marie Mossman e5a922fed4
Update AGP version validation code to support KGP and kotlin build files. (#142357)
Addresses: https://github.com/flutter/flutter/issues/141410
2024-02-05 21:47:39 +00:00
Alexander Dahlberg f3ee371285
Fixed test in language_version_test.dart that failed when shuffling, … (#142904)
…and removed the no-shuffle tag.

This PR fixes #142376 by fixing the flaky test in language_version_test.dart and removes the no-shuffle tag.
 
## The Problem
The test expected the language version that is set at the top of the test file ('2.13' set in language_version_test.dart – line 14) but defaulted to the language version set in the file it is testing ('2.12' is set in language_version.dart).

This problem was hidden when some other test ran before this test and set up the language version correctly.
 
## The Fix
Make the test itself load the default language version we are testing against.
2024-02-05 20:25:39 +00:00
BiskupMaik 0b5cd5073a
fix AppBar docs for backgroundColor & foregroundColor (#142430)
Before the M3 migration, the doc made sense. but after, it needed to specify which material version does this issue occur in.
The _AppBarDefaultsM3 don't take the brightness in consideration anymore:

<img width="517" alt="image" src="https://github.com/flutter/flutter/assets/124896814/d4dbe278-5b50-42d7-9143-c54d343efddf">
2024-02-05 05:16:23 +00:00
auto-submit[bot] f8a77225f3
Reverts "Update gradle lockfiles template" (#142889)
Reverts flutter/flutter#140115

Initiated by: bartekpacia

Reason for reverting: broke the tree

- [`Linux firebase_abstract_method_smoke_test`](https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20firebase_abstract_method_smoke_test/15844/overview)
- [`Linux_android android_view_scroll_perf__timeline_summary`](https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_android%20android_view_scroll_perf__timeline_summary/13453/overview)
- [`Linux_android platform_views

Original PR Author: bartekpacia

Reviewed By: {gmackall}

This change reverts the following previous change:
Original Description:
This PR updates almost* all Gradle buildscripts in the Flutter repo the `example` and `dev` (in particular, in `dev/integration_tests` and in `dev/benchmarks`) directories to apply Flutter's Gradle plugins using the declarative `plugins {}` block.

*almost, because:
- add-to-app (aka hybrid) apps are not migrated (related https://github.com/flutter/flutter/issues/138756)
- apps that purposefully use build files to ensure backward compatibility (e.g. [`gradle_deprecated_settings`](https://github.com/flutter/flutter/tree/3.16.0/dev/integration_tests/gradle_deprecated_settings))
2024-02-04 14:28:18 +00:00
Bartek Pacia 85888bccf2
Update gradle lockfiles template (#140115)
This PR updates almost* all Gradle buildscripts in the Flutter repo the `example` and `dev` (in particular, in `dev/integration_tests` and in `dev/benchmarks`) directories to apply Flutter's Gradle plugins using the declarative `plugins {}` block.

*almost, because:
- add-to-app (aka hybrid) apps are not migrated (related https://github.com/flutter/flutter/issues/138756)
- apps that purposefully use build files to ensure backward compatibility (e.g. [`gradle_deprecated_settings`](https://github.com/flutter/flutter/tree/3.16.0/dev/integration_tests/gradle_deprecated_settings))
2024-02-04 13:10:49 +00:00
Justin McCandless f1eeda7415
Update TextSelectionOverlay (#142463)
Fixes a bug where changing parameters in EditableText that affect the selection overlay didn't update the overlay.
2024-02-02 13:35:11 -08:00
Luccas Clezar fc3f4ed882
Fix CupertinoTextSelectionToolbar clipping (#138195)
The CupertinoTextSelectionToolbar sets the maxWidth of the whole toolbar to the width of the first page. This ends up clipping other pages from the toolbar. This PR just removes this limitation.

It was easy enough that I thought there was a catch, but I ran the tests locally and they all passed.

|Before|After|
|-|-|
|![Simulator Screenshot - iPhone Xʀ - 2023-11-09 at 19 45 29](https://github.com/flutter/flutter/assets/12024080/c84c40b9-3b02-48bf-9e87-17a9e4cfb461)|![Simulator Screenshot - iPhone Xʀ - 2023-11-09 at 19 44 30](https://github.com/flutter/flutter/assets/12024080/0c3d829b-952e-462b-9f02-8a2833c6f65d)|

https://github.com/flutter/flutter/issues/138177
2024-02-02 20:22:42 +00:00
Bartek Pacia 6facb96953
Reland "Add support for Gradle Kotlin DSL (#140744)" (#142752)
This PR attempts to:
- reland #140744
- reland #141541 (which is also in #142300 - I will close it once this PR is merged)
2024-02-02 20:19:42 +00:00
Justin McCandless 3280be9371
Support navigation during a Cupertino back gesture (#142248)
Fixes a bug where programmatically navigating during an iOS back gesture caused the app to enter an unstable state.
2024-02-02 11:27:20 -08:00
Lau Ching Jun ac7879e2aa
Avoid depending on files from build_system/targets other than from top level entrypoints in flutter_tools. (#142760)
Add a new `BuildTargets` class that provides commonly used build targets. And avoid importing files from `build_system/targets` except from the top level entrypoints or from top level commands.

Also move `scene_importer.dart` and `shader_compiler.dart` into `build_system/tools` because they are not `Target` classes, but wrapper for certain tools.

With this change, we can ignore all files in `build_system/targets` internally and make PR #142709 easier to land internally. See cl/603434066 for the corresponding internal change.

Related to:
https://github.com/flutter/flutter/pull/142709
https://github.com/flutter/flutter/issues/142041

Also note that I have opted to add a new variable in `globals.dart` for `BuildTargets` in this PR, but I know that we are trying to get rid of globals. Several alternatives that I was considering:

1. Add a new field in `BuildSystem` that returns a `BuildTargets` instance. Since `BuildSystem` is already in `globals`, we can access build targets using `globals.buildSystem.buildTargets` without adding a new global variable.
2. Properly inject the `BuildTargetsImpl` instance from the top level `executable.dart` and top level commands.

Let me know if you want me to do one of the above instead. Thanks!
2024-02-02 18:23:08 +00:00
Jackson Gardner ba626dc83a
Wasm/JS Dual Compile with the flutter tool (#141396)
This implements dual compile via the newly available flutter.js bootstrapping APIs for intelligent build fallback.
* Users can now use the `FlutterLoader.load` API from flutter.js
* Flutter tool injects build info into the `index.html` of the user so that the bootstrapper knows which build variants are available to bootstrap
* The semantics of the `--wasm` flag for `flutter build web` have changed:
  - Instead of producing a separate `build/web_wasm` directory, the output goes to the `build/web` directory like a normal web build
  - Produces a dual build that contains two build variants: dart2wasm+skwasm and dart2js+CanvasKit. The dart2wasm+skwasm will only work on Chrome in a cross-origin isolated context, all other environments will fall back to dart2js+CanvasKit.
  - `--wasm` and `--web-renderer` are now mutually exclusive. Since there are multiple build variants with `--wasm`, the web renderer cannot be expressed via a single command-line flag. For now, we are hard coding what build variants are produced with the `--wasm` flag, but I plan on making this more customizable in the future.
* Build targets now can optionally provide a "build key" which can uniquely identify any specific parameterization of that build target. This way, the build target can invalidate itself by changing its build key. This works a bit better than just stuffing everything into the environment defines because (a) it doesn't invalidate the entire build, just the targets which are affected and (b) settings for multiple build variants don't translate well to the flat map of environment defines.
2024-02-02 01:52:28 +00:00
Hans Muller c6f2cea65e
Reland: Added ButtonStyle.foregroundBuilder and ButtonStyle.backgroundBuilder (#142762)
Reland https://github.com/flutter/flutter/pull/141818 with a fix for a special case: If only `background` is specified for `TextButton.styleFrom` or `OutlinedButton.styleFrom` it applies the button's disabled state, i.e. as if the same value had been specified for disabledBackgroundColor.

The change relative to #141818 is the indicated line below:
```dart
final MaterialStateProperty<Color?>? backgroundColorProp = switch ((backgroundColor, disabledBackgroundColor)) {
  (null, null) => null,
  (_, null) => MaterialStatePropertyAll<Color?>(backgroundColor), // ADDED THIS LINE
  (_, _) => _TextButtonDefaultColor(backgroundColor, disabledBackgroundColor),
};
  ```

This backwards incompatibility cropped up in an internal test, see internal Google issue b/323399158.
2024-02-02 01:48:17 +00:00
Nate 5b947c889b
Implement switch expressions in lib/src/material/ (#142634)
This PR is step 5 in the journey to solve issue #136139 and make the entire Flutter repo more readable.

(previous pull requests: #139048, #139882, #141591, #142279)

The current focus is on `packages/flutter/lib/src/material/`.  
The previous PR covered files in this directory starting with `a`, `b`, and `c`; this pull request is for `d` through `m`.
2024-02-01 22:31:10 +00:00
Victoria Ashworth e5c286e02e
Upload DerivedData logs in CI (#142643)
When the Dart VM is not found within 10 minutes in CI on CoreDevices (iOS 17+), stop the app and upload the logs from DerivedData. The app has to be stopped first since the logs are not put in DerivedData until it's stopped.

Also, rearranged some logic to have CoreDevice have its own function for Dart VM url discovery.

Debugging for https://github.com/flutter/flutter/issues/142448.
2024-02-01 21:31:28 +00:00
auto-submit[bot] 07ca92a69e
Reverts "Added ButtonStyle.foregroundBuilder and ButtonStyle.backgroundBuilder" (#142748)
Reverts flutter/flutter#141818
Initiated by: XilaiZhang
This change reverts the following previous change:
Original Description:
Fixes https://github.com/flutter/flutter/issues/139456, https://github.com/flutter/flutter/issues/130335, https://github.com/flutter/flutter/issues/89563.

Two new properties have been added to ButtonStyle to make it possible to insert arbitrary state-dependent widgets in a button's background or foreground. These properties can be specified for an individual button, using the style parameter, or for all buttons using a button theme's style parameter.

The new ButtonStyle properties are `backgroundBuilder` and `foregroundBuilder` and their (function) types are:

```dart
typedef ButtonLayerBuilder = Widget Function(
  BuildContext context,
  Set<MaterialState> states,
  Widget? child
);
```

The new builder functions are called whenever the button is built and the `states` parameter communicates the pressed/hovered/etc state fo the button.

## `backgroundBuilder`

Creates a widget that becomes the child of the button's Material and whose child is the rest of the button, including the button's `child` parameter.  By default the returned widget is clipped to the Material's ButtonStyle.shape.

The `backgroundBuilder` can be used to add a gradient to the button's background. Here's an example that creates a yellow/orange gradient background:

![opaque-gradient-bg](https://github.com/flutter/flutter/assets/1377460/80df8368-e7cf-49ef-aee7-2776a573644c)

```dart
TextButton(
  onPressed: () {},
  style: TextButton.styleFrom(
    backgroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      return DecoratedBox(
        decoration: BoxDecoration(
          gradient: LinearGradient(colors: [Colors.orange, Colors.yellow]),
        ),
        child: child,
      );
    },
  ),
  child: Text('Text Button'),
)
```

Because the background widget becomes the child of the button's Material, if it's opaque (as it is in this case) then it obscures the overlay highlights which are painted on the button's Material. To ensure that the highlights show through one can decorate the background with an `Ink` widget.  This version also overrides the overlay color to be (shades of) red, because that makes the highlights look a little nicer with the yellow/orange background.

![ink-gradient-bg](https://github.com/flutter/flutter/assets/1377460/68a49733-f30e-44a1-a948-dc8cc95e1716)

```dart
TextButton(
  onPressed: () {},
  style: TextButton.styleFrom(
    overlayColor: Colors.red,
    backgroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      return Ink(
        decoration: BoxDecoration(
          gradient: LinearGradient(colors: [Colors.orange, Colors.yellow]),
        ),
        child: child,
      );
    },
  ),
  child: Text('Text Button'),
)
```

Now the button's overlay highlights are painted on the Ink widget. An Ink widget isn't needed if the background is sufficiently translucent. This version of the example creates a translucent backround widget. 

![translucent-graident-bg](https://github.com/flutter/flutter/assets/1377460/3b016e1f-200a-4d07-8111-e20d29f18014)

```dart
TextButton(
  onPressed: () {},
  style: TextButton.styleFrom(
    overlayColor: Colors.red,
    backgroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      return DecoratedBox(
        decoration: BoxDecoration(
          gradient: LinearGradient(colors: [
            Colors.orange.withOpacity(0.5),
            Colors.yellow.withOpacity(0.5),
          ]),
        ),
        child: child,
      );
    },
  ),
  child: Text('Text Button'),
)
```

One can also decorate the background with an image. In this example, the button's background is an burlap texture image. The foreground color has been changed to black to make the button's text a little clearer relative to the mottled brown backround.

![burlap-bg](https://github.com/flutter/flutter/assets/1377460/f2f61ab1-10d9-43a4-bd63-beecdce33b45)

```dart
TextButton(
  onPressed: () {},
  style: TextButton.styleFrom(
    foregroundColor: Colors.black,
    backgroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      return Ink(
        decoration: BoxDecoration(
          image: DecorationImage(
            image: NetworkImage(burlapUrl),
            fit: BoxFit.cover,
          ),
        ),
        child: child,
      );
    },
  ),
  child: Text('Text Button'),
)
```

The background widget can depend on the `states` parameter. In this example the blue/orange gradient flips horizontally when the button is hovered/pressed.

![gradient-flip](https://github.com/flutter/flutter/assets/1377460/c6c6fe26-ae47-445b-b82d-4605d9583bd8)

```dart
TextButton(
  onPressed: () {},
  style: TextButton.styleFrom(
    backgroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      final Color color1 = Colors.blue.withOpacity(0.5);
      final Color color2 = Colors.orange.withOpacity(0.5);
      return DecoratedBox(
        decoration: BoxDecoration(
          gradient: LinearGradient(
            colors: switch (states.contains(MaterialState.hovered)) {
              true => <Color>[color1, color2],
              false => <Color>[color2, color1],
            },
          ),
        ),
        child: child,
      );
    },
  ),
  child: Text('Text Button'),
)
```

The preceeding examples have not included a BoxDecoration border because ButtonStyle already supports `ButtonStyle.shape` and `ButtonStyle.side` parameters that can be uesd to define state-dependent borders. Borders defined with the ButtonStyle side parameter match the button's shape. To add a border that changes color when the button is hovered or pressed, one must specify the side property using `copyWith`, since there's no `styleFrom` shorthand for this case.

![border-gradient-bg](https://github.com/flutter/flutter/assets/1377460/63cffcd3-0dcf-4eb1-aed5-d14adf1e57f6)

```dart
TextButton(
  onPressed: () {},
  style: TextButton.styleFrom(
    foregroundColor: Colors.indigo,
    backgroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      final Color color1 = Colors.blue.withOpacity(0.5);
      final Color color2 = Colors.orange.withOpacity(0.5);
      return DecoratedBox(
        decoration: BoxDecoration(
          gradient: LinearGradient(
            colors: switch (states.contains(MaterialState.hovered)) {
              true => <Color>[color1, color2],
              false => <Color>[color2, color1],
            },
          ),
        ),
        child: child,
      );
    },
  ).copyWith(
    side: MaterialStateProperty.resolveWith<BorderSide?>((Set<MaterialState> states) {
      if (states.contains(MaterialState.hovered)) {
        return BorderSide(width: 3, color: Colors.yellow);
      }
      return null; // defer to the default
    }),
  ),
  child: Text('Text Button'),
)
```

Although all of the examples have created a ButtonStyle locally and only applied it to one button, they could have configured the `ThemeData.textButtonTheme` instead and applied the style to all TextButtons. And, of course, all of this works for all of the ButtonStyleButton classes, not just TextButton.

## `foregroundBuilder`

Creates a Widget that contains the button's child parameter. The returned widget is clipped by the button's [ButtonStyle.shape] inset by the button's [ButtonStyle.padding] and aligned by the button's [ButtonStyle.alignment].

The `foregroundBuilder` can be used to wrap the button's child, e.g. with a border or a `ShaderMask` or as a state-dependent substitute for the child.

This example adds a border that's just applied to the child. The border only appears when the button is hovered/pressed.

![border-fg](https://github.com/flutter/flutter/assets/1377460/687a3245-fe68-4983-a04e-5fcc77f8aa21)

```dart
ElevatedButton(
  onPressed: () {},
  style: ElevatedButton.styleFrom(
    foregroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      final ColorScheme colorScheme = Theme.of(context).colorScheme;
      return DecoratedBox(
        decoration: BoxDecoration(
          border: states.contains(MaterialState.hovered)
            ? Border(bottom: BorderSide(color: colorScheme.primary))
            : Border(), // essentially "no border"
        ),
        child: child,
      );
    },
  ),
  child: Text('Text Button'),
)
```

The foregroundBuilder can be used with `ShaderMask` to change the way the button's child is rendered. In this example the ShaderMask's gradient causes the button's child to fade out on top.

![shader_mask_fg](https://github.com/flutter/flutter/assets/1377460/54010f24-e65d-4551-ae58-712135df3d8d)

```dart
ElevatedButton(
  onPressed: () { },
  style: ElevatedButton.styleFrom(
    foregroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      final ColorScheme colorScheme = Theme.of(context).colorScheme;
      return ShaderMask(
        shaderCallback: (Rect bounds) {
          return LinearGradient(
            begin: Alignment.bottomCenter,
            end: Alignment.topCenter,
            colors: <Color>[
              colorScheme.primary,
              colorScheme.primaryContainer,
            ],
          ).createShader(bounds);
        },
        blendMode: BlendMode.srcATop,
        child: child,
      );
    },
  ),
  child:  const Text('Elevated Button'),
)
```

A commonly requested configuration for butttons has the developer provide images, one for pressed/hovered/normal state. You can use the foregroundBuilder to create a button that fades between a normal image and another image when the button is pressed. In this case the foregroundBuilder doesn't use the child it's passed, even though we've provided the required TextButton child parameter.

![image-button](https://github.com/flutter/flutter/assets/1377460/f5b1a22f-43ce-4be3-8e70-06de4c958380)

```dart
TextButton(
  onPressed: () {},
  style: TextButton.styleFrom(
    foregroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      final String url = states.contains(MaterialState.pressed) ? smiley2Url : smiley1Url;
      return AnimatedContainer(
        width: 100,
        height: 100,
        duration: Duration(milliseconds: 300),
        decoration: BoxDecoration(
          image: DecorationImage(
            image: NetworkImage(url),
            fit: BoxFit.contain,
          ),
        ),
      );
    },
  ),
  child: Text('No Child'),
)
```

In this example the button's default overlay appears when the button is hovered and pressed. Another image can be used to indicate the hovered state and the default overlay can be defeated by specifying `Colors.transparent` for the `overlayColor`:

![image-per-state](https://github.com/flutter/flutter/assets/1377460/7ab9da2f-f661-4374-b395-c2e0c7c4cf13)

```dart
TextButton(
  onPressed: () {},
  style: TextButton.styleFrom(
    overlayColor: Colors.transparent,
    foregroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      String url = states.contains(MaterialState.hovered) ? smiley3Url : smiley1Url;
      if (states.contains(MaterialState.pressed)) {
        url = smiley2Url;
      }
      return AnimatedContainer(
        width: 100,
        height: 100,
        duration: Duration(milliseconds: 300),
        decoration: BoxDecoration(
          image: DecorationImage(
            image: NetworkImage(url),
            fit: BoxFit.contain,
          ),
        ),
      );
    },
  ),
  child: Text('No Child'),
)
```
2024-02-01 21:11:26 +00:00
Polina Cherkasova fdf05c90bf
Fix leaks in tests. (#142677) 2024-02-01 11:49:54 -08:00
Simone Stasi cd6ed39550
fix CupertinoTabView's Android back button handling with PopScope (#141604)
This PR fixes CupertinoTabView's handling of Android back button with PopScope and nested navigators by calling `NavigatorState.maybePop` instead of `NavigatorState.pop`, so that the Navigator pops only when it should.

Fix #139050
2024-02-01 19:07:45 +00:00
Christopher Fujino a80333349a
Unpin test (#141427)
Fixes https://github.com/flutter/flutter/issues/140169
2024-02-01 18:53:23 +00:00
Qun Cheng 4d61823ce4
Introduce tone-based surfaces and accent color add-ons - Part 1 (#142654)
This PR is to add 19 new `ColorScheme` roles following the Material Design 3 specs. This PR doesn't apply the new colors to `ThemeData`  or any widgets.

This PR is created to split the big change in #138521, once this is merged, another PR that contains the rest of the changes(apply new color roles to widgets and deprecate 3 more colors) will follow.

**Tone-based surface colors** (7 colors): 
* surfaceBright
* surfaceDim
* surfaceContainer
* surfaceContainerLowest
* surfaceContainerLow
* surfaceContainerHigh
* surfaceContainerHighest

**Accent color add-ons** (12 colors):
* primary/secondary/tertiary-Fixed
* primary/secondary/tertiary-FixedDim
* onPrimary/onSecondary/onTertiary-Fixed
* onPrimary/onSecondary/onTertiary-FixedVariant

Please checkout this [design doc](https://docs.google.com/document/d/1ODqivpM_6c490T4j5XIiWCDKo5YqHy78YEFqDm4S8h4/edit?usp=sharing) for more information:)
2024-02-01 04:59:05 +00:00
Andrew Kolos 31116770ed
improve error message when --base-href argument does not start with / (#142667)
Resolves https://github.com/flutter/flutter/issues/137700.

In particular, see [this comment from the thread](https://github.com/flutter/flutter/issues/137700#issuecomment-1920241979) to see exactly what this PR is addressing.
2024-02-01 03:23:05 +00:00
Greg Spencer 2652b9a305
Convert button .icon and .tonalIcon constructors to take nullable icons. (#142644)
## Description

This changes the factory constructors for `TextButton.icon`, `ElevatedButton.icon`, `FilledButton.icon`, and `FilledButton.tonalIcon` to take nullable icons. If the icon is null, then the "regular" version of the button is created.

## Tests
 - Added tests for all four constructors.
2024-02-01 00:24:54 +00:00
David Martos b34ee07372
Fix token usages on Regular Chip and Action Chip (#141701)
The regular chip and the action chip templates were referencing non existent M3 design tokens.

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

The `ActionChip` doesn't have any visual difference. Even though the template and file changes, the default `labelStyle` color already uses `onSurface`.
For the reviewer, I've changed the `action_chip_test` to expect a color from the colorScheme so that it is more explicit that the color might not be the same as the labelLarge default in the global textTheme, even if for this case the color is the same.

The regular `Chip` does have visual differences, in particular, the label and trailing icon colors, which were not following the specification. In order to fix this, the regular chip now is based from the `filter-chip` spec as described in the linked issue.

## Before

![image](https://github.com/flutter/flutter/assets/22084723/d602ef42-625a-4b5c-b63b-c46cb2070d80)

## After

![image](https://github.com/flutter/flutter/assets/22084723/dddb754f-fd29-4c4c-96cc-e7f508219f12)
2024-02-01 00:05:22 +00:00
Hans Muller ff6c8f5d37
Added ButtonStyle.foregroundBuilder and ButtonStyle.backgroundBuilder (#141818)
Fixes https://github.com/flutter/flutter/issues/139456, https://github.com/flutter/flutter/issues/130335, https://github.com/flutter/flutter/issues/89563.

Two new properties have been added to ButtonStyle to make it possible to insert arbitrary state-dependent widgets in a button's background or foreground. These properties can be specified for an individual button, using the style parameter, or for all buttons using a button theme's style parameter.

The new ButtonStyle properties are `backgroundBuilder` and `foregroundBuilder` and their (function) types are:

```dart
typedef ButtonLayerBuilder = Widget Function(
  BuildContext context,
  Set<MaterialState> states,
  Widget? child
);
```

The new builder functions are called whenever the button is built and the `states` parameter communicates the pressed/hovered/etc state fo the button.

## `backgroundBuilder`

Creates a widget that becomes the child of the button's Material and whose child is the rest of the button, including the button's `child` parameter.  By default the returned widget is clipped to the Material's ButtonStyle.shape.

The `backgroundBuilder` can be used to add a gradient to the button's background. Here's an example that creates a yellow/orange gradient background:

![opaque-gradient-bg](https://github.com/flutter/flutter/assets/1377460/80df8368-e7cf-49ef-aee7-2776a573644c)

```dart
TextButton(
  onPressed: () {},
  style: TextButton.styleFrom(
    backgroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      return DecoratedBox(
        decoration: BoxDecoration(
          gradient: LinearGradient(colors: [Colors.orange, Colors.yellow]),
        ),
        child: child,
      );
    },
  ),
  child: Text('Text Button'),
)
```

Because the background widget becomes the child of the button's Material, if it's opaque (as it is in this case) then it obscures the overlay highlights which are painted on the button's Material. To ensure that the highlights show through one can decorate the background with an `Ink` widget.  This version also overrides the overlay color to be (shades of) red, because that makes the highlights look a little nicer with the yellow/orange background.

![ink-gradient-bg](https://github.com/flutter/flutter/assets/1377460/68a49733-f30e-44a1-a948-dc8cc95e1716)

```dart
TextButton(
  onPressed: () {},
  style: TextButton.styleFrom(
    overlayColor: Colors.red,
    backgroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      return Ink(
        decoration: BoxDecoration(
          gradient: LinearGradient(colors: [Colors.orange, Colors.yellow]),
        ),
        child: child,
      );
    },
  ),
  child: Text('Text Button'),
)
```

Now the button's overlay highlights are painted on the Ink widget. An Ink widget isn't needed if the background is sufficiently translucent. This version of the example creates a translucent backround widget. 

![translucent-graident-bg](https://github.com/flutter/flutter/assets/1377460/3b016e1f-200a-4d07-8111-e20d29f18014)

```dart
TextButton(
  onPressed: () {},
  style: TextButton.styleFrom(
    overlayColor: Colors.red,
    backgroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      return DecoratedBox(
        decoration: BoxDecoration(
          gradient: LinearGradient(colors: [
            Colors.orange.withOpacity(0.5),
            Colors.yellow.withOpacity(0.5),
          ]),
        ),
        child: child,
      );
    },
  ),
  child: Text('Text Button'),
)
```

One can also decorate the background with an image. In this example, the button's background is an burlap texture image. The foreground color has been changed to black to make the button's text a little clearer relative to the mottled brown backround.

![burlap-bg](https://github.com/flutter/flutter/assets/1377460/f2f61ab1-10d9-43a4-bd63-beecdce33b45)

```dart
TextButton(
  onPressed: () {},
  style: TextButton.styleFrom(
    foregroundColor: Colors.black,
    backgroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      return Ink(
        decoration: BoxDecoration(
          image: DecorationImage(
            image: NetworkImage(burlapUrl),
            fit: BoxFit.cover,
          ),
        ),
        child: child,
      );
    },
  ),
  child: Text('Text Button'),
)
```

The background widget can depend on the `states` parameter. In this example the blue/orange gradient flips horizontally when the button is hovered/pressed.

![gradient-flip](https://github.com/flutter/flutter/assets/1377460/c6c6fe26-ae47-445b-b82d-4605d9583bd8)

```dart
TextButton(
  onPressed: () {},
  style: TextButton.styleFrom(
    backgroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      final Color color1 = Colors.blue.withOpacity(0.5);
      final Color color2 = Colors.orange.withOpacity(0.5);
      return DecoratedBox(
        decoration: BoxDecoration(
          gradient: LinearGradient(
            colors: switch (states.contains(MaterialState.hovered)) {
              true => <Color>[color1, color2],
              false => <Color>[color2, color1],
            },
          ),
        ),
        child: child,
      );
    },
  ),
  child: Text('Text Button'),
)
```

The preceeding examples have not included a BoxDecoration border because ButtonStyle already supports `ButtonStyle.shape` and `ButtonStyle.side` parameters that can be uesd to define state-dependent borders. Borders defined with the ButtonStyle side parameter match the button's shape. To add a border that changes color when the button is hovered or pressed, one must specify the side property using `copyWith`, since there's no `styleFrom` shorthand for this case.

![border-gradient-bg](https://github.com/flutter/flutter/assets/1377460/63cffcd3-0dcf-4eb1-aed5-d14adf1e57f6)

```dart
TextButton(
  onPressed: () {},
  style: TextButton.styleFrom(
    foregroundColor: Colors.indigo,
    backgroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      final Color color1 = Colors.blue.withOpacity(0.5);
      final Color color2 = Colors.orange.withOpacity(0.5);
      return DecoratedBox(
        decoration: BoxDecoration(
          gradient: LinearGradient(
            colors: switch (states.contains(MaterialState.hovered)) {
              true => <Color>[color1, color2],
              false => <Color>[color2, color1],
            },
          ),
        ),
        child: child,
      );
    },
  ).copyWith(
    side: MaterialStateProperty.resolveWith<BorderSide?>((Set<MaterialState> states) {
      if (states.contains(MaterialState.hovered)) {
        return BorderSide(width: 3, color: Colors.yellow);
      }
      return null; // defer to the default
    }),
  ),
  child: Text('Text Button'),
)
```

Although all of the examples have created a ButtonStyle locally and only applied it to one button, they could have configured the `ThemeData.textButtonTheme` instead and applied the style to all TextButtons. And, of course, all of this works for all of the ButtonStyleButton classes, not just TextButton.

## `foregroundBuilder`

Creates a Widget that contains the button's child parameter. The returned widget is clipped by the button's [ButtonStyle.shape] inset by the button's [ButtonStyle.padding] and aligned by the button's [ButtonStyle.alignment].

The `foregroundBuilder` can be used to wrap the button's child, e.g. with a border or a `ShaderMask` or as a state-dependent substitute for the child.

This example adds a border that's just applied to the child. The border only appears when the button is hovered/pressed.

![border-fg](https://github.com/flutter/flutter/assets/1377460/687a3245-fe68-4983-a04e-5fcc77f8aa21)

```dart
ElevatedButton(
  onPressed: () {},
  style: ElevatedButton.styleFrom(
    foregroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      final ColorScheme colorScheme = Theme.of(context).colorScheme;
      return DecoratedBox(
        decoration: BoxDecoration(
          border: states.contains(MaterialState.hovered)
            ? Border(bottom: BorderSide(color: colorScheme.primary))
            : Border(), // essentially "no border"
        ),
        child: child,
      );
    },
  ),
  child: Text('Text Button'),
)
```

The foregroundBuilder can be used with `ShaderMask` to change the way the button's child is rendered. In this example the ShaderMask's gradient causes the button's child to fade out on top.

![shader_mask_fg](https://github.com/flutter/flutter/assets/1377460/54010f24-e65d-4551-ae58-712135df3d8d)

```dart
ElevatedButton(
  onPressed: () { },
  style: ElevatedButton.styleFrom(
    foregroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      final ColorScheme colorScheme = Theme.of(context).colorScheme;
      return ShaderMask(
        shaderCallback: (Rect bounds) {
          return LinearGradient(
            begin: Alignment.bottomCenter,
            end: Alignment.topCenter,
            colors: <Color>[
              colorScheme.primary,
              colorScheme.primaryContainer,
            ],
          ).createShader(bounds);
        },
        blendMode: BlendMode.srcATop,
        child: child,
      );
    },
  ),
  child:  const Text('Elevated Button'),
)
```

A commonly requested configuration for butttons has the developer provide images, one for pressed/hovered/normal state. You can use the foregroundBuilder to create a button that fades between a normal image and another image when the button is pressed. In this case the foregroundBuilder doesn't use the child it's passed, even though we've provided the required TextButton child parameter.

![image-button](https://github.com/flutter/flutter/assets/1377460/f5b1a22f-43ce-4be3-8e70-06de4c958380)

```dart
TextButton(
  onPressed: () {},
  style: TextButton.styleFrom(
    foregroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      final String url = states.contains(MaterialState.pressed) ? smiley2Url : smiley1Url;
      return AnimatedContainer(
        width: 100,
        height: 100,
        duration: Duration(milliseconds: 300),
        decoration: BoxDecoration(
          image: DecorationImage(
            image: NetworkImage(url),
            fit: BoxFit.contain,
          ),
        ),
      );
    },
  ),
  child: Text('No Child'),
)
```

In this example the button's default overlay appears when the button is hovered and pressed. Another image can be used to indicate the hovered state and the default overlay can be defeated by specifying `Colors.transparent` for the `overlayColor`:

![image-per-state](https://github.com/flutter/flutter/assets/1377460/7ab9da2f-f661-4374-b395-c2e0c7c4cf13)

```dart
TextButton(
  onPressed: () {},
  style: TextButton.styleFrom(
    overlayColor: Colors.transparent,
    foregroundBuilder: (BuildContext context, Set<MaterialState> states, Widget? child) {
      String url = states.contains(MaterialState.hovered) ? smiley3Url : smiley1Url;
      if (states.contains(MaterialState.pressed)) {
        url = smiley2Url;
      }
      return AnimatedContainer(
        width: 100,
        height: 100,
        duration: Duration(milliseconds: 300),
        decoration: BoxDecoration(
          image: DecorationImage(
            image: NetworkImage(url),
            fit: BoxFit.contain,
          ),
        ),
      );
    },
  ),
  child: Text('No Child'),
)
```
2024-02-01 00:02:23 +00:00
Christopher Fujino a1a801a48d
[flutter_tools] add debugging to ios/core_devices.dart (#142187)
Add debugging for #141892 to detect when the temp file mysteriously
disappears after running devicectl.
2024-01-31 15:36:15 -08:00
Greg Spencer e1e1c36d49
Fix showDialog docs (#142458)
## Description

Fixes a paragraph in the `showDialog` docs that had strange placement due to evolution of the docs. Fixed some missing words too.

## Related Issues
 - Fixes https://github.com/flutter/flutter/issues/142097
2024-01-31 22:43:03 +00:00
Dan Field c417c4623c
Refactor ShaderTarget to not explicitly mention impeller or Skia (#141460)
Refactors `ShaderTarget` to make it opaque as to whether it's using Impeller or SkSL and instead has it focus on the target platform it's generating for.

ImpellerC includes SkSL right now whether you ask for it or not. 

The tester target also might need SkSL or Vulkan depending on whether `--enable-impeller` is passed.
2024-01-31 21:30:02 +00:00
LouiseHsu 42317804ee
Show Mac Designed For iPad in 'flutter devices' (#141718)
Addresses https://github.com/flutter/flutter/issues/141290 by allow Mac Designed For IPad Devices to appear with 'flutter devices'.

<img width="573" alt="Screenshot 2024-01-29 at 12 23 24 AM" src="https://github.com/flutter/flutter/assets/36148254/35709a93-56fc-44c9-98d5-cf45afce967d">
<img width="725" alt="Screenshot 2024-01-29 at 12 26 01 AM" src="https://github.com/flutter/flutter/assets/36148254/b6cbcfce-44db-42c6-ac01-0ab716d30373">
2024-01-31 19:34:07 +00:00
Michael Goderbauer 3da5ff5490
Fix ParentDataWidget crash for multi view scenarios (#142486)
Fixes https://github.com/flutter/flutter/issues/142480.

This fixes a crash occurring during hot reload when a `ViewAnchor` is used between a `ParentDataWidget` (like `Positioned`) and its closest `RenderObject` descendant. Prior to the fix, the `ParentDataWidget` was accidentally applying its parent data to the render object in the `ViewAnchor.view` slot, which crashed because that render object wasn't (and shouldn't be) setup to accept parent data (after all, it is in a different render tree). Instead, the parent data should only be applied to the render object in the `ViewAnchor.child` slot. Luckily, with `Element.renderObjectAttachingChild` we already have API in place to walk the widget tree such as that only `RenderObjectWidgets` from the same render tree are considered.
2024-01-31 19:22:07 +00:00
Justin McCandless 9c2c487e02
"System back gesture" explanation (#142254)
Improve docs around PopScope and its interaction with back gestures on Android and iOS.
2024-01-31 10:46:52 -08:00
Polina Cherkasova 6d8aa4afaa
Mark test that leaks image. (#142539) 2024-01-31 09:58:00 -08:00
LongCatIsLooong 43aee92e61
Fix unresponsive mouse tooltip (#142282)
Fixes https://github.com/flutter/flutter/issues/142045

The intent of using `??=` was that if the tooltip is already scheduled for showing, rescheduling another show does nothing. But if the tooltip is already scheduled for dismissing, the `??=` won't cancel the dismiss timer and as a result the tooltip won't show. So the `??=` is now replaced by `=` to keep it consistent with the `_scheduleDismissTooltip` implementation.
2024-01-31 17:17:53 +00:00
Jude Selase Kwashie 4a6cbefe34
Fix null operator error when tapping on 'MenuItemButton' (#142230)
This PR fixes null operator error when you change focus node of a 'MenuItemButton' to null.

fixes: [issue142095](https://github.com/flutter/flutter/issues/142095)
2024-01-31 16:21:50 +00:00
Kate Lovett 42add0f8fa
Split out AppBar/SliverAppBar material tests (#142560)
While looking into resolving https://github.com/flutter/flutter/issues/117903, I found the massive test file `app_bar_test.dart` and found it unwieldy to work with. So before proposing a solution to #117903, which would touch many of these tests, I figured a clean up would be best first.

This splits up `app_bar_test.dart` with a new file `app_bar_sliver_test.dart`, and adds `app_bar_utils.dart` for shared test methods.

It basically moves all SliverAppBar tests into their own file, leaving just AppBar tests in the original file.
2024-01-31 16:13:17 +00:00
Ian Hickson 16e014e884
Add DropdownMenu.focusNode (#142516)
fixes [`DropdownMenu` doesn't have a focusNode](https://github.com/flutter/flutter/issues/142384)

### Code sample

<details>
<summary>expand to view the code sample</summary> 

```dart
import 'package:flutter/material.dart';

enum TShirtSize {
  s('S'),
  m('M'),
  l('L'),
  xl('XL'),
  xxl('XXL'),
  ;

  const TShirtSize(this.label);
  final String label;
}

void main() => runApp(const MyApp());

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final FocusNode _focusNode = FocusNode();

  @override
  void dispose() {
    _focusNode.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          title: const Text('DropdownMenu Sample'),
        ),
        body: Center(
          child: DropdownMenu<TShirtSize>(
            focusNode: _focusNode,
            initialSelection: TShirtSize.m,
            label: const Text('T-Shirt Size'),
            dropdownMenuEntries: TShirtSize.values.map((e) {
              return DropdownMenuEntry<TShirtSize>(
                value: e,
                label: e.label,
              );
            }).toList(),
          ),
        ),
        floatingActionButton: FloatingActionButton.extended(
          onPressed: () {
            _focusNode.requestFocus();
          },
          label: const Text('Request Focus on DropdownMenu'),
        ),
      ),
    );
  }
}
```

</details>
2024-01-31 06:12:20 +00:00
David Martos 20dc5cbc6c
M3 - Fix Chip icon and label colors (#140573) 2024-01-30 16:28:31 -08:00
Kohei Seino 9ed650aee5
use PDI to end the isolated scope for RLI (#141345)
will fix https://github.com/flutter/flutter/issues/141344

https://unicode.org/reports/tr9/#Explicit_Directional_Isolates
https://api.flutter.dev/flutter/foundation/Unicode/RLI-constant.html
2024-01-30 23:16:01 +00:00
Ian Hickson abebd340d7
Style correctness improvements for toStrings and related fixes (#142485)
Children should be omitted from debugFillProperties (if they really need to be included they should be in debugDescribeChildren, but in general for widgets we don't bother including them since they are eventually included anyway).

toStrings should not contain newlines (or, ideally, should use Diagnosticable).

Also some minor tweaks to match grammar and style guide conventions.
2024-01-30 22:41:15 +00:00
Renzo Olivares 1daac1b875
Fix: selection handles do not inherit color from local Theme widget (#142476)
This change uses `CapturedTheme`s to capture the themes from the context the selection handles were built in and wraps the handles with them so they can correctly inherit `Theme`s from local `Theme` widgets.

`CapturedTheme`s only captures `InheritedTheme`s, so this change also makes `_InheritedCupertinoTheme` an `InheritedTheme`. This is so we can capture themes declared under a `CupertinoTheme`, for example `primaryColor` is used as the selection handle color.

Fixes #74890
2024-01-30 18:12:18 +00:00
Aizat Azhar 75a2e5b493
Reset framesEnabled to default value at the end of each test (#141844)
Reset `framesEnabled` to `true` at the end of each test as otherwise subsequent tests may fail when pumping a widget

Fixes #141835
2024-01-30 16:04:15 +00:00
Kate Lovett e8cb029583
Fix SliverMainAxisGroup geometry cacheExtent (#142482)
Fixes https://github.com/flutter/flutter/issues/142183

This fixes a bug in the SliverGeometry of SliverMainAxisGroup. The cacheExtent represents how many pixels the sliver has consumed in the SliverConstraints.remainingCacheExtent. Since it was not set, slivers that came after a SliverMainAxisGroup that filled the whole screen did not properly lay out their own children, in some cases making lazy sliver more eager than they should be.
2024-01-30 16:04:13 +00:00
Polina Cherkasova 6dff3da31c
Organize leak tracking TODOs. (#142460) 2024-01-29 21:21:34 -08:00
Camille Simon 995e3fad7c
Revert "Reland: "Fix how Gradle resolves Android plugin" (#137115)" (#142464)
This reverts commit f5ac225c8d, i.e. https://github.com/flutter/flutter/pull/137115.

This is a continuation of https://github.com/flutter/flutter/pull/142266 that was redone based on feedback to make this easier to revert in the future. The exact steps I took to create this revert:

1. Revert commit noted above
2. Fix merge conflicts, that notably involved reverting some changes in https://github.com/flutter/flutter/pull/140744 ~and https://github.com/flutter/flutter/pull/141417~ (fixed my merge to avoid the second PR from being affected)
3. Delete `packages/flutter_tools/test/integration.shard/android_plugin_skip_unsupported_test.dart` as this was added in the commit noted above

cc @Gustl22 since I couldn't tag as a reviewer
2024-01-29 22:44:24 +00:00
Justin McCandless ade8af278f
onNavigationNotification for *App.router (#142190)
onNavigationNotification was not being passed through when using the router in MaterialApp and CupertinoApp. I believe this was just an oversight on my part when I wrote https://github.com/flutter/flutter/pull/120385. This PR passes them through.

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

@maRci0002 Would this totally fix your issue https://github.com/flutter/flutter/issues/139903?
2024-01-29 22:00:51 +00:00
Bryan Olivares 1d5c2c5118
Feat: TextField can scroll when disabled (#140922)
This PR is adding a flag parameter to the `TextField` widget. This flag controls whether the TextField ignores pointers. The flag takes priority over other TextField behaviors such as enabled, so it can be useful when trying to have a disabled TextField that can be scrolled (behavior observed using TextArea on the web).

Adding a flag parameter to `TextField` helps with more customization and flexibility to the widget which can improve user experience. I am open to other ideas.   

Fixes issue #140147 

Before: 

https://github.com/flutter/flutter/assets/66151079/293e5b4e-3126-4a00-824d-1530aeaa494b

After:

https://github.com/flutter/flutter/assets/66151079/08c1af09-3bf9-4b49-b684-dda4dd920503

Usage:
```dart
child: TextField(
  ignorePointer: false,
  enabled: false,
),
```
2024-01-29 20:22:19 +00:00
Michael Goderbauer c576f0039d
Fix InputDecorationTheme copyWith fallback for iconColor (#142462)
Same as https://github.com/flutter/flutter/pull/138914, but with a test.
2024-01-29 19:15:22 +00:00
Mohammad Bagher Fakouri fd7f45a8be
Add SingleChildScrollView for NavigationRail (#137415)
## Description
Add `SingleChildScrollView` to `NavigationRail` for scrolling.
Closes: #89167
2024-01-29 19:11:59 +00:00
Andrew Kolos 83bdde2bd3
Catch file system exceptions when trying to parse user-provided asset file paths (#142214)
Fixes #141211
2024-01-29 18:43:57 +00:00
Nate 38879daef7
Implementing switch expressions in foundation/ and material/ (#142279)
This PR is the fourth step in the journey to solve issue #136139 and make the entire Flutter repo more readable.

(previous pull requests: #139048, #139882, #141591)

This one is covering files in `packages/flutter/lib/src/foundation/` and `packages/flutter/lib/src/material/`.  
The `material/` directory is pretty big though, so for now I just did the files that start with `a`, `b`, and `c`.
2024-01-29 18:14:02 +00:00
Polina Cherkasova 96c322d6ec
Opt out test from leak tracking. (#142417) 2024-01-29 09:49:44 -08:00
Zachary Anderson 6a6874ecf9
Update Android minSdkVersion to 21 (#142267)
This PR increases Android's `minSdkVersion` to 21.

There are two changes in this PR aside from simply increasing the number
from 19 to 21 everywhere.

First, tests using `flutter_gallery` fail without updating the
lockfiles. The changes in the PR are the results of running
`dev/tools/bin/generate_gradle_lockfiles.dart` on that app.

Second, from
[here](https://developer.android.com/build/multidex#mdex-pre-l):
> if your minSdkVersion is 21 or higher, multidex is enabled by default
and you don't need the multidex library.

As a result, the `multidex` option everywhere is obsolete. This PR
removes all logic and tests related to that option that I could find.
`Google testing` and `customer_tests` pass on this PR, so it seems like
this won't be too breaking if it is at all. If needed I'll give this
some time to bake in the framework before landing the flutter/engine
PRs.

Context: https://github.com/flutter/flutter/issues/138117,
https://github.com/flutter/flutter/issues/141277, b/319373605
2024-01-29 09:49:09 -08:00
Zachary Anderson 4601341b50
Add no-shuffle to language_version_test.dart (#142378) 2024-01-27 10:57:39 -08:00
LongCatIsLooong 62037e9afd
Remove suspicious constant from input decorator layout (#142342)
Maybe fixes https://github.com/flutter/flutter/issues/124852. @justinmc do you remember what the constant 2 is for when computing the outline baseline?
2024-01-27 01:13:03 +00:00
Michael Goderbauer 671d8eaf71
Relands "Add runWidget to bootstrap a widget tree without a default View" (#142344)
Reverts flutter/flutter#142339

In the original change one of the tests included the same view twice which resulted in a different failure than the expected one. The second commit contains the fix for this. I don't understand how this wasn't caught presubmit on CI.
2024-01-26 23:05:53 +00:00
Amir Panahandeh a5ad088f7b
Fix assertion failure when reordering two dimensional children (#141504)
It fixes assertion failure due to unstable state of children list during reordering in `RenderTwoDimensionalViewport.parentDataOf`. This changes the assertion to check debug orphan list and `keepAlive` bucket in addition to children list to determine whether child belongs to this render object or not.

- Fixes #141101
2024-01-26 22:37:45 +00:00
Andrew Kolos 907bbe1bbe
refactor asset bundle code to not depend on the global Cache.flutterRoot (#142277)
Fixes https://github.com/flutter/flutter/issues/142285.

Part of work on https://github.com/flutter/flutter/pull/141194.

This is a refactor. There should be no changes in tool behavior.
2024-01-26 22:01:26 +00:00
Christopher Fujino 97fef98b47
[flutter_tools] remove await runZonedGuarded() in tests (#142336)
For context https://github.com/flutter/flutter/issues/142338
2024-01-26 21:58:03 +00:00
Daco Harkes 8bc0901076
Roll deps from dart-lang/native in templates (#142322)
Update packages from https://github.com/dart-lang/native to the last published stable versions in templates.
2024-01-26 21:42:33 +00:00
Andrew Kolos 69c98bd960
Remove duplicate global declaration of UserMessages (#142281)
Fixes https://github.com/flutter/flutter/issues/142286

This is a refactor. No code behavior changes should be observed.
2024-01-26 21:41:16 +00:00
auto-submit[bot] 114261a63a
Reverts "Add runWidget to bootstrap a widget tree without a default View" (#142339)
Reverts flutter/flutter#141484
Initiated by: eliasyishak
This change reverts the following previous change:
Original Description:
The existing `runApp` bootstraps the widget tree and renders the provided widget into the default view (which is currently the implicit View from `PlatformDispatcher.implicitView` and - in the future - may be a default-created window). Apps, that want more control over the View they are rendered in, need a new way to bootstrap the widget tree: `runWidget`. It does not make any assumptions about the View the provided widget is rendered into. Instead, it is up to the caller to include a View widget in the provided widget tree that specifies where content should be rendered. In the future, this may enable developers to create a custom window for their app instead of relying on the default-created one.
2024-01-26 21:06:27 +00:00
LongCatIsLooong 505845c5ac
Remove textScaleFactor references from flutter/flutter (#142271)
These should the the last remaining `MediaQueryData.textScaleFactor` and `TextScaler.textScaleFactor` references.
2024-01-26 19:12:24 +00:00
Michael Goderbauer 5b44596c5f
Add runWidget to bootstrap a widget tree without a default View (#141484)
The existing `runApp` bootstraps the widget tree and renders the provided widget into the default view (which is currently the implicit View from `PlatformDispatcher.implicitView` and - in the future - may be a default-created window). Apps, that want more control over the View they are rendered in, need a new way to bootstrap the widget tree: `runWidget`. It does not make any assumptions about the View the provided widget is rendered into. Instead, it is up to the caller to include a View widget in the provided widget tree that specifies where content should be rendered. In the future, this may enable developers to create a custom window for their app instead of relying on the default-created one.
2024-01-26 19:12:21 +00:00
Jenn Magder 91f0878fed
Move iOS content validation devicelab test into tool integration test (#142272)
The archiving was running in devicelab because certs are needed to codesign (see #73577).  However now the certs are available in chromium bots.  Move the archiving test into the existing tool integration test, and delete the devicelab variant.

arm64:
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8757886514651624673/+/u/run_test.dart_for_tool_host_cross_arch_tests_shard_and_subshard_None/test_stdout#L6074_4
x64:
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8757886514651624689/+/u/run_test.dart_for_tool_host_cross_arch_tests_shard_and_subshard_None/test_stdout#L6389_2

Part of https://github.com/flutter/flutter/issues/142070
2024-01-26 18:04:09 +00:00
Polina Cherkasova 0b686be36e
Fix not disposed ImageInfo in tests. (#142287) 2024-01-26 08:02:41 -08:00
Bartek Pacia 370f40e6df
flutter.groovy: update for Gradle Kotlin DSL compatibility (#142144)
This PR fixes 2 small mistakes in `FlutterExtension`:
- all fields must be `public` in order to be used in Gradle Kotlin DSL the same as in Gradle Groovy DSL
- using `logger` instead of `project.logger` throws an error when executed

This PR re-adds a subset of changes from #141541 which broke the tree and has been reverted.
2024-01-26 09:46:18 +00:00
Polina Cherkasova 15fa68ab1d
Instrument ImageInfo. (#141411) 2024-01-25 17:02:17 -08:00
Qun Cheng 7ff5f81a2e
Fix SegmentedButton default size and default tappable size (#142243)
fix https://github.com/flutter/flutter/issues/121493

`SegmentedButton` uses `TextButton` for each segments. When we have `MaterialTapTargetSize.padded` for `TextButton`, we make sure the minimum tap target size is 48.0( this value can be adjusted by visual density), even tough the actual button size is smaller. When `SegmentedButton` paints segments by using `MultiChildRenderObjectWidget`, it also includes the tap target size so the button that it actually draws always has the same height as the height of the tap target size.

To fix it, this PR firstly calculate the actual height of a text button in `SegmentedButton` class, then we can get the height delta if there is. Then the the value of (Segmented button render box height - the delta) would be the actual button size that we should see.

For now, we are not able to customize the min, max, fixed size in [`SegmentedButton` style](https://api.flutter.dev/flutter/material/SegmentedButton/style.html). So the standard button height is always 40 and can only be customized by `style.visualDensity` and `style.tapTargetSize`; `SegmentedButton` only simulates the `TextButton` behavior when `TextButton`'s height is its default value.

![Screenshot 2024-01-25 at 11 45 42 AM](https://github.com/flutter/flutter/assets/36861262/7451fa96-6d45-4cd3-a894-ca71e776c8ef)

https://github.com/flutter/flutter/assets/36861262/15ca6034-e6e0-4cc6-8fe3-808b4bd6a920
2024-01-26 00:20:21 +00:00
Pierrick Bouvier 37c3978b34
Enable native compilation for windows-arm64 (#141930)
It's now possible to natively compile a flutter app for windows-arm64. Cross-compilation is not yet implemented.

Uses arm64 artifacts now available for Dart/Flutter. Platform detection is based on Abi class, provided by Dart. Depending if Dart is an arm64 or x64 binary, the Abi is set accordingly. Initial bootstrap of dart artifacts (update_dart_sdk.ps1) is checking PROCESSOR_ARCHITECTURE environment variable, which is the way to detect host architecture on Windows.

This is available only for master channel (on other channels, it fallbacks to windows-x64).

On windows-x64, it produces an x64 app. On windows-arm64, it produces an arm64 app.
2024-01-26 00:08:20 +00:00
derdilla e342667954
fix Ink not updating on TextField newline (#140700)
Fixes a layout bug when using an EditableText and something containing an Ink widget.
2024-01-25 14:51:54 -08:00
Nate 497f912d6e
Implementing switch expressions in the cupertino/ directory (#141591)
Refactors code to use the new `switch` expressions.
2024-01-25 13:29:28 -08:00
LouiseHsu caba667ed4
Fix incorrect zh-cn translation for Look Up Label in selection controls (#142158)
Fixes https://github.com/flutter/flutter/issues/141764

Translation suggestion here:

https://tc.corp.google.com/btviewer/edittranslation?project=Flutter&msgId=8222331119728136330&language=zh-CN

## 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] All existing and new tests are passing.
2024-01-25 10:24:42 -08:00
Justin McCandless 204a8848a6
PopScope example improvements (#142163)
Attempting to help users understand how to build a confirmation dialog when exiting a route.
2024-01-25 10:14:49 -08:00
Sigurd Meldgaard a0e43d3053
Don't show legacy welcome message when analytics are disabled (#140956)
The legacy welcome message would be printed even if `CI=true` confusing
parsers of the output.

This fixes: https://github.com/flutter/flutter/issues/139737

---------

Co-authored-by: eliasyishak <42216813+eliasyishak@users.noreply.github.com>
2024-01-25 16:29:42 +01:00
Andrew Kolos 295a9a2031
provide command to FakeCommand::onRun (#142206)
Part of work on [#101077](https://github.com/flutter/flutter/pull/141194). This is done as a separate PR to avoid a massive diff.

## Context
1. The `FakeCommand` class accepts a list of patterns that's used to match a command given to its `FakeProcessManager`. Since `FakeCommand` can match a list of patterns, not just specifically strings, it can be used to match commands where the exact value of some arguments can't (easily) known ahead of time. For example, a part of the tool may invoke a command with an argument that is the path of a temporarily file that has a randomly-generated basename.
2. The `FakeCommand` class provides on `onRun` parameter, which is a callback that is run when the `FakeProcessManager` runs a command that matches the `FakeCommand` in question.

## Issue
In the event that a `FakeCommand` is constructed using patterns, the test code can't know the exact values used for arguments in the command. This PR proposes changing the type of `onRun` from `VoidCallback?` to `void Function(List<String>)?`. When run, the value `List<String>` parameter will be the full command that the `FakeCommand` matched.

Example:
```dart
FakeCommand(
  command: <Pattern>[
    artifacts.getArtifactPath(Artifact.engineDartBinary),
    'run',
    'vector_graphics_compiler',
    RegExp(r'--input=/.*\.temp'),
    RegExp(r'--output=/.*\.temp'),
  ],
  onRun: (List<String> command) {
    final outputPath = (() { 
      // code to parse `--output` from `command`
    })();
    testFileSystem.file(outputPath).createSync(recursive: true);
  },
)
```
2024-01-25 07:51:25 +00:00
David Iglesias 703e12f524
[ci] Adds test for web hot restart with const App. (#141824)
This PR adds a test that reproduces the problem described in the linked issue: hot restart on the web seems to not update if the app being run is `const`.

The new test is expected to fail, until the `const` issue with hot restart in the web is resolved.

Expected failure mode is a 15s timeout in the following test:

```
02:31 +3 ~1 -1: Hot reload (index.html: Default) (with `const MyApp()`)): newly added code executes during hot restart [E]
  TimeoutException after 0:00:15.000000: Future not completed
  dart:async  _startMicrotaskLoop
  ...
```

(And then a bunch of output that I'm not 100% sure is intended :))

## Issues

* #141588
2024-01-25 01:49:08 +00:00
Renzo Olivares eba38c4b77
Fix text selection edge scrolling when inside a horizontal scrollable (#140250)
Fixes #129590

* Consider `AxisDirection` when calculating scroll offset used in determining TextSelection during a drag/long press drag. Previously it seems that we were assuming the direction was always vertical 30cc831985/packages/flutter/lib/src/widgets/text_selection.dart (L2842-L2844) .
* SelectableText now considers RenderEditable offset changes and Scrollable offset changes when calculating the TextSelection during a long press drag.
2024-01-25 00:59:06 +00:00
Polina Cherkasova 47d8252a85
Reland "Remove hack from PageView." (#142172)
Original PR: https://github.com/flutter/flutter/pull/141533
Failure: https://fusion2.corp.google.com/presubmit/601217743/OCL:601217743:BASE:601219708:1706132224874:9a4bcab3/targets
Fix: [b/321743868](https://b.corp.google.com/321743868), http://cl/601219001 (added as g3 fix.
2024-01-24 23:44:11 +00:00
Polina Cherkasova a522b38e96
Upgrade leak_tracker. (#142162) 2024-01-24 15:33:17 -08:00
Jo Jaeyong 23385468a8
Support wireless debugging for iOS 12 or earlier (#141439)
`idevicesyslog` requires the `--network` flag to obtain logs for iOS devices when wirelessly paired. 

When running Flutter on devices with iOS 12 or earlier versions, [the `idevicesyslog` command is used.](5931b4f21d/packages/flutter_tools/lib/src/ios/devices.dart (L1269-L1277)).

Related Issue: #15072
Related PRs: #118104, #118895, #60623
2024-01-24 22:14:08 +00:00
hangyu 6adc8246e4
Update navigationBar label's maxScaleFactor to meet GAR requirement (#141998)
fixes: https://github.com/flutter/flutter/issues/141997
2024-01-24 19:45:47 +00:00
Greg Price e661ed3a00
Revise tooltip theme docs, including more cross-references (#137316)
Much of the new wording here is borrowed from [ChipTheme], [SliderTheme], or [RadioThemeData], which I think are pretty good. I believe a lot of other theme classes have similar wording too. I've also made some tweaks of my own, notably the references to [MaterialApp.theme].

This started from a desire to have clearer cross-references pointing at what to do with a FooThemeData to make it take effect:
  https://github.com/flutter/flutter/pull/135879#discussion_r1355851481
but then as I started writing I kept finding more and more small things I wanted to adjust, including a couple of bits that were extraneous or obsolete.
2024-01-24 17:26:03 +00:00
LongCatIsLooong b6e758addb
Fixes #138773, port autocomplete to OverlayPortal (#140285)
Fixes #138773, port autocomplete to OverlayPortal
2024-01-24 16:49:18 +00:00
Jesús S Guerrero b5262f0d80
Revert "[web] - Fix broken TextField in semantics mode when it's a sibling of Navigator" (#142129)
Reverts flutter/flutter#138446

b/322136071
2024-01-24 16:13:26 +00:00
yim 24e7a0be8b
Don't change the height of the Textfield's labelStyle when it focused. (#141943)
Fixes #141448
2024-01-24 04:13:50 +00:00
Polina Cherkasova be031cb908
Ignore a leak. (#141737) 2024-01-24 04:01:23 +00:00
Jackson Gardner a668aa7f99
Revert "Add abifilters to our gradle templates" (#142089)
Reverts flutter/flutter#135529

This had some failures in postsubmit:

https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20gradle_plugin_light_apk_test/17054/overview
and 

https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20gradle_plugin_fat_apk_test/17262/overview

We should revert and then investigate.
2024-01-23 19:05:20 -08:00
Gray Mackall 512335230c
Add abifilters to our gradle templates (#135529)
Fixes https://github.com/flutter/flutter/issues/135173, and could also be interpreted as fixing https://github.com/flutter/flutter/issues/83596 based on @chinmaygarde 's comment.
2024-01-23 23:19:23 +00:00
Andrew Kolos cbe0ceafe2
consolidate AssetBundle::entries and AssetBundle::entryKinds into a new type, AssetBundleEntry (#142029)
Part of work on https://github.com/flutter/flutter/pull/141194

The [`AssetBundle`](0833929c99/packages/flutter_tools/lib/src/asset.dart (L80)) class contains two members, `entries` and `entryKinds`. `entries` contains asset data indexed by asset key. `entryKinds` contains the "kinds" of these assets, again indexed by asset key.

**Change.** Rather than have two separate maps, this PR proposes combining these maps into one by wrapping the asset data and kind into a single data type `AssetBundleEntry`.

**Purpose.** In https://github.com/flutter/flutter/pull/141194, I am considering associating more information with an asset. In particular, what transformers are meant to be applied to it when copying it to the build output. Rather than adding another map member onto `AssetBundle` (e.g. `entryTransformers`), I decided to make things neater by introducing the `AssetBundleEntry` type.
2024-01-23 22:00:46 +00:00
Christopher Fujino 1cee81c40a
[flutter_tools] fix language_version_test and enable shuffle (#142009)
Part of https://github.com/flutter/flutter/issues/85160
2024-01-23 20:31:53 +00:00
Ian Hickson 574e598118
Merge flutter_goldens_client into flutter_goldens (#141900)
This is part 1 of a broken down version of the #140101 refactor.
2024-01-23 21:07:31 +01:00
Lau Ching Jun f52eaaea08
Allow overriding the native assets yaml file in the resident runner. (#142016)
This is used when the native assets are built by a separate build system.

Context: b/286799303
2024-01-23 19:49:10 +00:00
hangyu bff417ac43
Update material banner maxScaleFactor to meet GAR requirement (#142015)
fixes: https://github.com/flutter/flutter/issues/142012
2024-01-23 19:24:54 +00:00
Qun Cheng e86c1c88e2
Add tooltip for the clear button on SearchAnchor's search view (#141804)
Fixes #141347
This PR is to add a "clear text" tooltip for the clear button on `SearchAnchor`'s search view and also add a `clearButtonTooltip` entry for `material_localizations`.
2024-01-23 17:47:06 +00:00
Michael Goderbauer 930403c6c3
Remove unused clipBehavior from OverflowBar (#141976)
Fixes https://github.com/flutter/flutter/issues/141606.

OverflowBar doesn't do any clipping and therefore there's no need to specify a clip behavior.
2024-01-23 17:16:26 +00:00
Bruno Leroux bef9763008
Add Share button to the SelectableRegion toolbar on Android (#141447)
## Description

This PR adds the share button to text selection toolbar buttons on Android ~~and iOS~~ for `SelectableRegion` (and therefore `SelectionArea`).

https://github.com/flutter/flutter/pull/139479 adds this button for `EditableText` (which is used by `TextField` and `SelectableText` but not by `SelectionArea`).

**Edit**: supporting this on iOS will need more work (see https://github.com/flutter/flutter/pull/141447#issuecomment-1889942622 and https://github.com/flutter/flutter/issues/141775).

## Related Issue

Follow up for https://github.com/flutter/flutter/issues/138728

## Tests

Adds 1 test.
2024-01-23 13:25:34 +00:00
Ian Hickson 5dc3b1894f
Add a comment about how to test flutter_goldens (#141902)
This is part 2 of a broken down version of the #140101 refactor.

This particular change wasn't in that original refactor but is a note to myself so that I remember how to test each of these changes in the future.
2024-01-23 00:49:07 +00:00
Ian Hickson 15ceca93a4
Enable contextMenuBuilder in the absence of selectionControls (#141810) 2024-01-23 00:49:05 +00:00
auto-submit[bot] b258ca011e
Reverts "hello_world app: migrate to Gradle Kotlin DSL" (#142018)
Reverts flutter/flutter#141541
Initiated by: yusuf-goog
This change reverts the following previous change:
Original Description:
This PR introduces the first app in this repo that fully uses Gradle Kotlin DSL.

It also fixes a bug I found in the process – fields of `FlutterExtensions` must be `public`.
2024-01-23 00:01:17 +00:00
Justin McCandless 0f7f08d535
Floating cursor docs (#133002)
Explains what a "floating cursor" is in the docs.
2024-01-22 14:17:29 -08:00
Gustl22 a98e43a871
refactor: Rename filterPluginsByPlatform, cleanup Platform Strings (#141780)
Part of #137040 and #80374

- Rename _filterPluginsByPlatform to _createPluginMapOfPlatform
- Move method in chronological order
- Cleanup platform strings
2024-01-22 21:54:06 +00:00
Bartek Pacia e593cdfb80
hello_world app: migrate to Gradle Kotlin DSL (#141541)
This PR introduces the first app in this repo that fully uses Gradle Kotlin DSL.

It also fixes a bug I found in the process – fields of `FlutterExtensions` must be `public`.
2024-01-22 21:47:20 +00:00
Matan Lurey 3b1e96e074
Remove duplicate code as suggested by natebosch. (#141988)
See https://github.com/flutter/flutter/pull/141821/files#r1462288131.
2024-01-22 13:08:36 -08:00
Jesús S Guerrero a3cd05c6d3
Revert "Remove hack from PageView." (#141977)
Reverts flutter/flutter#141533

 b/321743868
2024-01-22 20:14:44 +00:00
Matan Lurey 0b2269447f
Do not hang on test failures of tests within flutter_tools (#141821)
Fixes https://github.com/flutter/flutter/issues/141823

Before this change, when a test would fail, the terminal would hang (by default for 30s) until killed by the test runner.

Basically, [`runZonedGuarded`](https://api.flutter.dev/flutter/dart-async/runZonedGuarded.html) _does_ document (though not clearly) that a returned future should not be awaited:

```txt
The zone will always be an error-zone ([Zone.errorZone](https://api.flutter.dev/flutter/dart-async/Zone/errorZone.html)), so returning a future created inside the zone, and waiting for it outside of the zone, will risk the future not being seen to complete.
```

For example, you can see other places in Dart and Flutter that we circumvent that problem:

- 5987563e4a/packages/flutter_tools/test/general.shard/base/async_guard_test.dart (L279-L306)
- b04c9c127f/lib/src/dartdoc.dart (L258-L264)
- d1afda52d2/lib/web_ui/dev/browser_process.dart (L20-L22)

I'm open to suggestions on how to test this :)

/cc @natebosch @jakemac53 @lrhn if you have any color commentary for us.
2024-01-22 19:49:59 +00:00
Greg Spencer 0dea82e684
Remove unneeded expectation in test (#141822)
## Description

This removes an unneeded expectation in the test for the AppLifecycleListener.  It's unneeded because the test immediately resets the state anyhow.  I'm removing it because the web implementation sets the value when initializing, so it's never initially null there.

## Related PR
 - https://github.com/flutter/engine/pull/44720#issuecomment-1898482363
2024-01-22 19:46:10 +00:00
Jonas Uekötter 174bbf254b
Add documentation which explains that debugPrint also logs in release mode (#141595)
It's confusing that `debugPrint` also prints in release mode, given that a lot (most?) other things prefixed with `debug` don't do anything in release mode. Therefore, this adds some documentation that this is indeed logging in release mode and adds an example how to disable this.

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2024-01-22 18:24:38 +00:00
Taha Tesser 5aa6cb857d
Fix RangeSlider throws a null-check error after clearSemantics is called (#141965)
fixes [Null-check operator on RangeSlider's _startSemanticsNode](https://github.com/flutter/flutter/issues/141953)
2024-01-22 18:21:31 +00:00
Hassan Toor 59e892d391
[web] - Fix broken TextField in semantics mode when it's a sibling of Navigator (#138446)
When a `TextField` is rendered before a `Navigator`, it breaks in semantics mode.  This is because the framework generates the incorrect semantics tree (excludes the TextField) and when that tree gets sent to the engine, we don't get the signal to create the corresponding `<input>` element.

This happens for a few reasons:
* `ModalBarrier` uses `BlockSemantics` to drop the semantics of routes beneath the current route in `Navigator`
* `ModalBarrier` mistakenly recognizes the widget outside of the `Navigator` to be its sibling
*  So we end up dropping the semantics node of the `TextField` rendered before it. 

The fix is to let `Navigator` generate a semantics node so that `ModalBarrier` doesn't mistakenly think widgets outside of `Navigator` are its siblings.  

`Navigator` doesn't currently do this, which causes all the nodes generated from its widget subtree to be directly attached to the parent semantics node above `Navigator` - since this is also the parent of `TextField`, it considers them siblings. 

Fixes https://github.com/flutter/flutter/issues/129324
2024-01-22 17:03:14 +00:00
Tess Strickland 7ca4b7b86b
Mark defaultTargetPlatform as constant for non-debug non-web builds. (#141105)
This PR adds the Dart VM `vm:platform-const-if` pragma introduced in
https://github.com/dart-lang/sdk/commit/57a1168875 to the
`defaultTargetPlatform` property, allowing it to be computed as if it
was a constant field in non-debug AOT builds. In particular, this means
that platform-specific code executed conditionally based on this
property can be tree-shaken in release builds. Note that this PR changes
`defaultTargetPlatform` to only allow overriding via
`debugDefaultTargetPlatformOverride` in debug builds, and makes it so
that compilation throws an error if code assigns
to`debugDefaultTargetPlatformOverride` in other build modes.

Related issue: #14233

## 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] All existing and new tests are passing.
2024-01-22 14:49:47 +01:00
Taha Tesser 9574d585e3
Fix shape and collapsedShape isn't applied to ExpansionTile's splash ink (#141777)
This updates the previous attempt https://github.com/flutter/flutter/pull/135855 and removes the complications when testing M3 ink sparkle effect. 
Thanks to this [PR](https://github.com/flutter/flutter/pull/138757) by @Piinks 

fixes [ExpansionTile InkSplash doesn't respect Shape's borderRadius](https://github.com/flutter/flutter/issues/125779)
fixes [`ExpansionTile.backgroundColor` &  `ExpansionTile.collapsedBackgroundColor` removes splash effect](https://github.com/flutter/flutter/issues/107113)

### 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 const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Example(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      body: Center(
          child: Padding(
        padding: EdgeInsets.symmetric(horizontal: 24.0),
        child: ExpansionTile(
          collapsedBackgroundColor: Color(0x25ff0000),
          backgroundColor: Color(0x250000ff),
          collapsedShape: RoundedRectangleBorder(
            borderRadius: BorderRadius.all(Radius.circular(30.0)),
            side: BorderSide(color: Colors.black, width: 2.0),
          ),
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.all(Radius.circular(30.0)),
            side: BorderSide(color: Colors.black, width: 2.0),
          ),
          clipBehavior: Clip.hardEdge,
          title: Text('Expansion Tile'),
          children: <Widget>[
            FlutterLogo(size: 50),
            FlutterLogo(size: 50),
            FlutterLogo(size: 50),
            FlutterLogo(size: 50),

          ],
        ),
      )),
    );
  }
}
```

</details>

### Before

<img width="789" alt="Screenshot 2024-01-18 at 18 16 15" src="https://github.com/flutter/flutter/assets/48603081/8c6a6f1e-6986-4acf-8dec-e223a682c0d7">

<img width="789" alt="Screenshot 2024-01-18 at 18 16 44" src="https://github.com/flutter/flutter/assets/48603081/f55f6a26-2128-48a1-b24d-3c14e4f6ecdc">

### After 
<img width="789" alt="Screenshot 2024-01-18 at 18 20 27" src="https://github.com/flutter/flutter/assets/48603081/7ec8b888-7319-460d-8488-9cd44c9246a6">

<img width="789" alt="Screenshot 2024-01-18 at 18 20 53" src="https://github.com/flutter/flutter/assets/48603081/80d66d5b-7eb2-4f47-ab4d-d7f469a731fa">
2024-01-22 11:13:31 +00:00
Daco Harkes 634b326efc
Reapply "Native assets: roll deps" (#141748) (#141864)
Fixes https://github.com/flutter/flutter/issues/141827

Reland: https://dart-review.googlesource.com/c/sdk/+/346960 has rolled into g3, so the imports should now resolve in g3 as well.

> [!CAUTION]
> _Do NOT merge if "Google Testing" bot didn't run!_

Rolls the packages from https://github.com/dart-lang/native in the native assets implementation.

Most notable we're refactoring `package:native_assets_cli` for `build.dart` use.
Therefore, all imports to that package for Flutter/Dart should be to the implementation internals that are no longer visible for `build.dart` writers. Hence all the import updates.

No behavior in Flutter apps should change.

This PR also updates the template to use the latests version of `package:native_assets_cli` which no longer exposes all the implementation details.
2024-01-22 10:42:15 +00:00
Taha Tesser 0ef4638822
Update ToggleButtons, ExpansionPanel, and ExpandIcon tests for Material 3 (#141868)
Updated unit tests for `ToggleButtons`, `ExpansionPanel`, and `ExpandIcon` to have M2 and M3 versions.

More info in #139076
2024-01-22 10:01:05 +00:00
Christopher Fujino 92094802fe
[flutter_tools] update analyze_once_test.dart to be null-safe (#141790)
Fixes https://github.com/flutter/flutter/issues/141743

I should have made this change in https://github.com/flutter/flutter/pull/124039, but it escaped my grep search.
2024-01-21 07:54:05 +00:00
林洵锋 f340d207f6
Adjust the position of require File.expand_path (#141521)
On `Podfile`:

```ruby
flutter_application_path = '../flutter_module'
load File.join(flutter_application_path, '.ios', 'Flutter', 'podhelper.rb')

target 'OCProject' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for OCProject
  # install_all_flutter_pods(flutter_application_path)
  # install_flutter_engine_pod(flutter_application_path)
  # install_flutter_application_pod(flutter_application_path)
  install_flutter_plugin_pods(flutter_application_path)

end

post_install do |installer|
  flutter_post_install(installer)
end
```
Encountering the following error after executing `pod install`:

```shell
pod install

[!] Invalid `Podfile` file: undefined method `flutter_relative_path_from_podfile' for #<Pod::Podfile:0x000000010e74c520 @defined_in_file=#<Pathname:/Users/lxf/gitHub/flutter_hybrid_bug/OCProject/Podfile>, @internal_hash={}, @root_target_definitions=[#<Pod::Podfile::TargetDefinition label=Pods>], @current_target_definition=#<Pod::Podfile::TargetDefinition label=Pods>>

  relative = flutter_relative_path_from_podfile(export_script_directory)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^.

 #  from /Users/lxf/gitHub/flutter_hybrid_bug/OCProject/Podfile:17
 #  -------------------------------------------
 #    # install_flutter_plugin_pods(flutter_application_path)
 >    install_flutter_application_pod(flutter_application_path)
 #
 #  -------------------------------------------
```

The `flutter_relative_path_from_podfile` method is in `flutter_tools/bin/podhelper.rb`, but now `flutter_tools/bin/podhelper.rb` is only required in `install_all_flutter_pods` in `podhelper.rb.tmpl`.

Sometimes we only need to use the `install_flutter_plugin_pods` method in podhelper.rb. For example, using `Shorebird` in an iOS hybird app scenario, we need to build `Flutter.xcframework` and `App.xcframework` and embed them into the iOS native project. In order to avoid unnecessary conflicts, use `install_flutter_plugin_pods` method to install Flutter plugin pods.

[Shorebird - Code Push In Hybrid Apps](https://docs.shorebird.dev/guides/hybrid-app/ios)

So I adjust the position of `require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)`.
2024-01-21 06:18:26 +00:00
LongCatIsLooong 5892a0039b
Remove more textScaleFactor references (#141816)
Remove more `textScaleFactor` references from flutter/flutter.  

- Some changes are related to label scaling: the padding EdgeInsets values of some chip subclasses scale linearly between predetermined "max" padding values and "min" padding values. Before they scale with the `textScaleFactor` scalar, now they scale with the font size and are still capped at the original "max" and "min" values.
- The rest of them are tests or size heuristics that depend on `textScaleFactor`, these are replaced by an effective text scale factor computed using a default font size (which is determined in a pretty random fashion, but it will only make a difference on Android 14+).

No API changes in this batch. There are still some references left that I intend to remove in a different batch that would introduce API changes.
2024-01-20 00:27:18 +00:00
Taha Tesser 788614d171
Fix "Delete" tooltip is shown disabled on chips with onDeleted callback (#141770)
fixes [Disabled chips with `onDeleted` callback shows "Delete" tooltip on hover](https://github.com/flutter/flutter/issues/141336)

### 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 const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Example(),
    );
  }
}

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

  @override
  State<Example> createState() => _ExampleState();
}

class _ExampleState extends State<Example> {
  bool _isEnable = false;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            RawChip(
              label: const Text('RawChip'),
              onPressed: () {},
              isEnabled: _isEnable,
              onDeleted: () {},
            ),
            FilterChip(
              label: const Text('FilterChip'),
              selected: false,
              onSelected: _isEnable ? (bool value) {} : null,
              onDeleted: () {},
            ),
            InputChip(
              label: const Text('InputChip'),
              isEnabled: _isEnable,
              onDeleted: () {},
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton.extended(
        onPressed: () {
          setState(() {
            _isEnable = !_isEnable;
          });
        },
        label: Text(_isEnable ? 'Disable' : 'Enable'),
      ),
    );
  }
}
```

</details>

### Preview

| Before | After |
| --------------- | --------------- |
| <img src="https://github.com/flutter/flutter/assets/48603081/f80ae5f7-0a6d-4041-ade3-cbc2b5c78188" height="450" /> | <img src="https://github.com/flutter/flutter/assets/48603081/04e62854-e3f1-4b65-9753-183d288f3cfe" height="450" /> |
2024-01-19 22:19:16 +00:00
Qun Cheng 05854afa9b
SearchAnchor search view clear button only shows up when text input is not empty (#141755) 2024-01-19 13:01:07 -08:00
Reid Baker 684247a3c7
Use Integer instead of int in map in flutter.groovy (#141895)
packages Roller breakage 
https://ci.chromium.org/ui/p/flutter/builders/try/Linux_android%20android_build_all_packages%20master/5504/overview
Fixes flutter/flutter/issues/141897
```
FAILURE: Build failed with an exception.

* Where:
Script '/b/s/w/ir/x/w/flutter/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy' line: 168

* What went wrong:
Could not compile script '/b/s/w/ir/x/w/flutter/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy'.
> startup failed:
  script '/b/s/w/ir/x/w/flutter/packages/flutter_tools/gradle/src/main/groovy/flutter.groovy': 168: primitive type parameters not allowed here;
     solution: use the corresponding wrapper type, such as Integer for int @ line 168, column 41.
     e static final Map<String, int> ABI_VERS
```

Covered by tests in packages.
2024-01-19 20:57:08 +00:00
Daco Harkes 2e229be2ff
Native assets: package in framework on iOS and MacOS (#140907)
Packages the native assets for iOS and MacOS in frameworks.

Issue:

* https://github.com/flutter/flutter/issues/140544
* https://github.com/flutter/flutter/issues/129757

## Details

* [x] This packages dylibs from the native assets feature in frameworks. It packages every dylib in a separate framework.
* [x] The dylib name is updated to use `@rpath` instead of `@executable_path`.
* [x] The dylibs for flutter-tester are no longer modified to change the install name. (Previously it was wrongly updating the install name to the location the dylib would have once deployed in an app.)
* [x] Use symlinking on MacOS.
2024-01-19 20:29:13 +00:00
Ian Hickson 77c3807c80
Revert "Make tests more resilient to Skia gold failures and refactor flutter_goldens for extensive technical debt removal (#140101)" (#141814)
Reverts https://github.com/flutter/flutter/pull/140101

That PR somehow made non-matching gold tests not fail at HEAD.

Fixes https://github.com/flutter/flutter/issues/141880
- Blocked by https://github.com/flutter/flutter/issues/140169
  - https://github.com/flutter/flutter/pull/141427
2024-01-19 20:29:11 +00:00
Qun Cheng ba4a11dafa
Add showDragHandle to showBottomSheet (#141754) 2024-01-19 11:17:40 -08:00
Michael Goderbauer cc544169be
Make pumpWidget's arguments named (#141728)
Much nicer calling API and simplifies evolving this API in the future.

I wish we could write a dart fix for this, but that's blocked on https://github.com/dart-lang/sdk/issues/54668.
2024-01-19 18:29:07 +00:00
fzyzcjy 9e024fdf31
Tiny fix inaccurate documentations about bindings (#140282)
The old doc says that, AutomatedTestWidgetsFlutterBinding for `flutter test` and LiveTestWidgetsFlutterBinding for `flutter run`. However, suppose we `flutter test integration_test/simple_test.dart` with the following code:

```
void main() {
  testWidgets('hi', (WidgetTester tester) async {
    print('hi ${TestWidgetsFlutterBinding.instance} ${Platform.operatingSystem}');
  });
}
```

We will see: `hi <IntegrationTestWidgetsFlutterBinding> ios`. Therefore, we see `IntegrationTestWidgetsFlutterBinding` is used in a `flutter test` command, which is contrary to the documentation.
2024-01-19 17:45:13 +00:00
Zachary Anderson d4707d12d5
Roll engine to 9a6c64de8a4694cef59a338cd33ac1a9e7d23d9d (#141870)
Includes the Engine roll from
https://github.com/flutter/flutter/pull/141841

A new version of Dart is having trouble with the tool integration test
test `passing one file with errors are detected`:
https://ci.chromium.org/ui/p/flutter/builders/try/Mac%20tool_integration_tests_2_4/31851/overview.

However the analysis server emits the expected errors when we give it
both the file without issues and the file with issues.

My guess is that the analysis server has changed it's behavior slightly
when supplied with a single malformed file.

Since the Dart roll is >20 dev versions behind, and this is the only
failing presubmit test, and it's testing something a bit weird, I
suggest we investigate the right way to test the thing that test was
attempting to cover as a follow-up.
2024-01-19 09:38:01 -08:00
Ian Hickson 8ff0af0c70
Move the requestKeyboard up to the widgets layer (#141655)
Turns out all implementations of this method made this call, so it seems like it should belong in the superclass.
2024-01-19 02:30:03 +00:00
Yegor 5987563e4a
enable more tests in web mode (#141791)
- Unskip `text_style_test` for CanvasKit.
- Remove no longer necessary `kIsWeb` checks in a few tests.

This PR depends on https://github.com/flutter/engine/pull/49786, which rolled into the framework. If the engine PR needs to be reverted, this PR will need to be reverted too.
2024-01-18 23:55:33 +00:00
David Martos 197cd4d665
Update margin between label and icon in Tab to better reflect Material specs (#140698)
This PR improves the distance between the label and the icon in the Tab widget. 
I updated the margin to 2 pixels, taken from the Figma design page for Material 3. On Material 2 I left the default value of 10 pixels.

Related to #128696 (In particular, the distance between label and icon)

Here are some screenshots for comparison. I looked a bit into the other mentioned issue of the tab height not following the M3 spec. Flutter uses 72 and the spec uses 64. But because Tab is a PreferredSizeWidget, I don't think there is an easy way to provide a different size depending on `ThemeData.useMaterial3`, because there is no `BuildContext` available.
I provide a sample image for the 64 height as well for context on the linked issue, even though it's not part of the PR changes.

The screenshots are taken side by side with the image at: https://m3.material.io/components/tabs/guidelines

## Original

![original](https://github.com/flutter/flutter/assets/22084723/f52d46bb-eaf9-4519-976e-9ea07c021e14)

## New (tab height = 72, Flutter default for 8 years)

![new_72](https://github.com/flutter/flutter/assets/22084723/8c9d3510-eaca-4b7d-92d8-0d06a7e75136)

## New (tab height = 64, M3 spec)

![new_64](https://github.com/flutter/flutter/assets/22084723/f8811b70-766f-4a4f-b069-33673b1e3744)
2024-01-18 23:04:26 +00:00
auto-submit[bot] 1901d6fa10
Reverts "Enable native compilation for windows-arm64 " (#141809)
Reverts flutter/flutter#137618
Initiated by: Jasguerrero
This change reverts the following previous change:
Original Description:
It's now possible to natively compile a flutter app for
windows-arm64. Cross-compilation is not yet implemented.

Uses arm64 artifacts now available for Dart/Flutter.
Platform detection is based on Abi class, provided by Dart. Depending if
Dart is an arm64 or x64 binary, the Abi is set accordingly.
Initial bootstrap of dart artifacts (update_dart_sdk.ps1) is checking
PROCESSOR_ARCHITECTURE environment variable, which is the way to detect
host architecture on Windows.

This is available only for master channel (on other channels, it
fallbacks to windows-x64).

On windows-x64, it produces an x64 app. On windows-arm64, it produces an
arm64 app.
2024-01-18 22:48:16 +00:00
Polina Cherkasova 2cd448574b
Reland "Remove hack from PageView." (#141533)
Fixes https://github.com/flutter/flutter/issues/141119
Original PR: https://github.com/flutter/flutter/pull/141138
Revert: https://github.com/flutter/flutter/pull/141479
Reason for revert: https://fusion2.corp.google.com/presubmit/597877179/OCL:597877179:BASE:597883748:1705084754455:88d992fc/targets
Fix: cl/599347719
2024-01-18 20:45:08 +00:00
Callum Moffat e05d0dd21f
ScaleGestureRecognizer pointerCount=2 for trackpad gestures (#140745)
Now trackpad gestures will count as pointerCount=2 instead of 1. It makes it easier for people who want to have different behaviour for single-finger drag vs two-finger pan/zoom. Also fixed up `scale_test.dart` to verify `pointerCount` in more places.

Related: https://github.com/flutter/flutter/issues/13102
Fixes https://github.com/flutter/flutter/issues/140730
2024-01-18 20:15:38 +00:00
Pierrick Bouvier 540559204e
Enable native compilation for windows-arm64 (#137618)
It's now possible to natively compile a flutter app for
windows-arm64. Cross-compilation is not yet implemented.

Uses arm64 artifacts now available for Dart/Flutter.
Platform detection is based on Abi class, provided by Dart. Depending if
Dart is an arm64 or x64 binary, the Abi is set accordingly.
Initial bootstrap of dart artifacts (update_dart_sdk.ps1) is checking
PROCESSOR_ARCHITECTURE environment variable, which is the way to detect
host architecture on Windows.

This is available only for master channel (on other channels, it
fallbacks to windows-x64).

On windows-x64, it produces an x64 app. On windows-arm64, it produces an
arm64 app.
2024-01-18 19:15:23 +00:00
Jesús S Guerrero 1997bec685
Revert "Native assets: roll deps" (#141748)
b/320767653

Reverts flutter/flutter#141684
2024-01-18 18:13:21 +00:00
Pierre-Louis ef5beeced3
Deprecate M2 curves (#134417)
These have 1:1 replacements with a new name, introduced in
https://github.com/flutter/flutter/pull/129942

Land after https://github.com/flutter/packages/pull/4898

Part of https://github.com/flutter/flutter/issues/116525

## 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] 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
2024-01-18 18:38:00 +01:00
Renzo Olivares cd06ba7ab6
Fix: TextField can inherit errorStyle from InputDecorationTheme. (#141227)
Previously `TextField`s error `cursorColor` was being derived without taking into account any `InputDecorationTheme` defaults. This change respects `InputDecorationTheme` defaults when deriving the error `cursorColor`.

Fixes #140607
2024-01-18 17:37:06 +00:00
yaakovschectman 3123d98132
Add check for Bank of Brazil security module to Windows Flutter Doctor validators (#141135)
Add a warning to Flutter Doctor if Topaz OFD is found as a process on
the system.
The protection module used by the Bank of Brazil has been identified as
causing build failures when using VS with CMake for Windows (see
https://github.com/flutter/flutter/issues/121366#issuecomment-1845703728).
Disabling the software allows the build to succeed again.

If a running process is found by `flutter doctor` whose path contains
`Topaz OFD\Warsaw\core.exe`, a warning message is generated to convey
this.

Addresses https://github.com/flutter/flutter/issues/121366

## 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].
- [ ] 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] 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

---------

Co-authored-by: Elias Yishak <42216813+eliasyishak@users.noreply.github.com>
Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com>
2024-01-18 12:32:49 -05:00
Reid Baker c479109e75
Fix gradle lints No semantic change should be present. (#141692)
Move static methods together.
Fix property uses of duplicate strings.
Add types wherever obvious
Fix format depth
Add whitespace to top and bottom of classes
Ignore line length for file
Ignore prefer single quote for file
Ignore correction for getFoo used instead of foo

Loosely related to flutter/flutter/issues/123934
2024-01-18 16:33:10 +00:00
Andrew Kolos 0833929c99
Catch UnsupportedError thrown when user provides an asset directory path containing invalid characters (#141214)
Fixes https://github.com/flutter/flutter/issues/140092
2024-01-18 08:35:59 +00:00
Yegor 00032569a1
[web] prepare layers_test.dart for https://github.com/flutter/engine/pull/49786 (#141731)
This disables the expectation for `TileMode` stringification because
https://github.com/flutter/engine/pull/49786 is about to fix it (as in,
the test would fail when the engine fix lands).
2024-01-17 18:53:33 -08:00
Qun Cheng ef794e2a28
Add headerHeight for SearchAnchor (#141223)
Fixes #140046

This PR is to add a `headerHeight` property to `SearchAnchor` and `SearchViewThemeData` so the header height on the search view can be customized.
2024-01-17 22:49:04 +00:00
Andrew Kolos 5757500931
Make test file systems/platforms used in asset_bundle_test.dart less dependent on the host platform (#141657)
Part of work on https://github.com/flutter/flutter/pull/141214. See [this discussion](https://github.com/flutter/flutter/pull/141214#discussion_r1446727495) for the inspiration for this PR.

## Issue
Many tests in [packages/flutter_tools/test/general.shard/asset_bundle_test.dart](4cd0a3252d/packages/flutter_tools/test/general.shard/asset_bundle_test.dart) aren't hermetic. When setting up fake `FileSystem` and `Platform` objects, the host OS is referenced:

f2745e97d5/packages/flutter_tools/test/general.shard/asset_bundle_test.dart (L35-L40)

f2745e97d5/packages/flutter_tools/test/general.shard/asset_bundle_test.dart (L43)

To improve hermeticity here, we could instead run each once _per_ valid combination of file system style and platform. However, it is unclear if these tests even depend on the file system style (integration tests should catch most cases where this might matter). As a result, I think it's sufficient to improve hermeticity by always assuming a Linux environment, which is generally our default (as `MemoryFileSystem` does, and most of our fakes of `Platform` do by default).

In general, if a test needs to run other kinds of environments, it should make this clear, ideally through the test name.
2024-01-17 21:23:01 +00:00
Daco Harkes f5442bf937
Native assets: roll deps (#141684)
Rolls the packages from https://github.com/dart-lang/native in the native assets implementation.

Most notable we're refactoring `package:native_assets_cli` for `build.dart` use.
Therefore, all imports to that package for Flutter/Dart should be to the implementation internals that are no longer visible for `build.dart` writers. Hence all the import updates.

No behavior in Flutter apps should change.

This PR also updates the template to use the latests version of `package:native_assets_cli` which no longer exposes all the implementation details.
2024-01-17 21:20:36 +00:00
Yegor bac4d8391b
[web] prepare for https://github.com/flutter/engine/pull/49786 (#141700)
Skip incorrect expectations in preparation for https://github.com/flutter/engine/pull/49786.

Bonus: improved error message when text style test fails
2024-01-17 19:22:19 +00:00
LongCatIsLooong da20edf0ff
Fix Tooltip show delay when mouse moves to one Tooltip from another (#141656)
Fixes https://github.com/flutter/flutter/issues/141644
2024-01-17 17:11:24 +00:00
Greg Spencer 4e3be0bf8e
Fix the --empty flag to not try working with non-app templates (#141632)
## Description

This adds a check to make sure that the `--empty` flag isn't applied to non-app templates.

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

## Tests
 - Added a test.
2024-01-17 16:51:03 +00:00
Kostia Sokolovskyi e36a868beb
TrainHoppingAnimation should dispatch creation and disposal events. (#141635) 2024-01-16 19:13:58 -08:00
Christopher Fujino 4cd0a3252d
[flutter_tools] Fix analyze size on arm64 (#141317)
Fixes https://github.com/flutter/flutter/issues/140659
2024-01-17 00:15:28 +00:00
LongCatIsLooong 212d0a64c9
Allow selection in composing region (#140516)
Fixes https://github.com/flutter/flutter/issues/68547 for macOS. Needs https://github.com/flutter/engine/pull/49314
2024-01-16 23:33:49 +00:00
Anis Alibegić e063f56832
Fixed few typos (#141543)
I continued [my mission](https://github.com/flutter/flutter/pull/141431) to find as many typos as I could. This time it's a smaller set than before.

There is no need for issues since it's a typo fix.
2024-01-16 21:40:08 +00:00
Reid Baker 2b890af939
handle rc versions of gradle in version compare (#141612)
- handle number format exceptions and strip rc information from version compare
- add test that handles rc format

part 2/n https://github.com/flutter/flutter/issues/138523

Helpfully pointed out by [asaarnak](https://github.com/asaarnak) https://github.com/flutter/flutter/pull/139325#issuecomment-1892554584
2024-01-16 19:29:26 +00:00
Bartek Pacia 2442603cfc
Delete redundant settings.ext.flutterSdkPath (#141509)
This line is a leftover. Removing it is a no-op.
2024-01-16 19:19:24 +00:00
Bartek Pacia 1e5acbcb55
Reference GitHub issue in TODO comment (#141582)
[Source](https://github.com/flutter/flutter/pull/133598#discussion_r1446033128)

For future readers.
2024-01-16 18:56:19 +00:00
Bartek Pacia e1d6f7e822
migrate {min,target,compile}SdkVersion to {min,target,compile}Sdk (#141537)
Inspired by #137621.
2024-01-16 18:39:12 +00:00
Jenn Magder 90ced90f1b
Sort Swift imports in templates (#141487)
`swift-format` alphabetizes imports.  Alphabetize them in swift template files and integration tests.

I found this as part of https://github.com/flutter/flutter/issues/41129 running `swift-import` on packages.
2024-01-16 18:07:21 +00:00
Polina Cherkasova a8e699249b
Ignore or fix leaks. (#141468) 2024-01-16 09:44:49 -08:00
Spt 3d112429cc
Solve the problem that <Flutter/Flutter.h> cannot be imported when a pod transitive depends on Flutter (#125610)
![image](https://user-images.githubusercontent.com/8318578/234780282-89b18d27-df49-4b4e-88b5-c9d17cf3334f.png)
![image](https://user-images.githubusercontent.com/8318578/234780668-901ab816-5b6b-4d87-a6f4-120b5852580c.png)
If a pod transitive depends on a pod containing a framework, cocoapods will add the path of the framework to its FRAMEWORK_SEARCH_PATHS.
So I modified the relevant logic in podhelper, hoping to be consistent with the behavior of cocoapods.

Fixes https://github.com/flutter/flutter/issues/126251.
2024-01-16 15:36:38 +00:00
Sulav Parajuli a9f9136633
Fix #141061: Add 'color' property to DrawerButton and EndDrawerButton (#141159)
## Description

This PR addresses issue #141061, which requested the addition of a 'color' property to buttons extending _ActionButton. The 'color' property has been introduced to enhance customization options for these buttons.

## Issues Fixed

- Fixes #141061
2024-01-16 10:08:27 +00:00
auto-submit[bot] 8e94423e6a
Reverts "BoxPainter should dispatch creation and disposal events." (#141545)
Reverts flutter/flutter#141526
Initiated by: CaseyHillers
This change reverts the following previous change:
Original Description:
### Description
- Adds `BoxPainter` creation and disposal events dispatching for memory leak tracking as part of https://github.com/flutter/flutter/issues/141198

### Tests
- Updates `decoration_test.dart` to test `BoxPainter` object creation and disposal events dispatching.
2024-01-15 01:53:26 +00:00
Kostia Sokolovskyi e5f62cc5a0
Private disposables should dispatch creation and disposal events. (#141535) 2024-01-14 13:24:50 -08:00
Kostia Sokolovskyi 1a2c3151fe
BoxPainter should dispatch creation and disposal events. (#141526) 2024-01-14 10:07:10 -08:00
OutdatedGuy a8cb8af857
Added newline at end of .gitignore files (#141270)
Added missing required newline at end of some `.gitignore` files. All other `.gitignore` files ends with a newline except the changed ones, hence the PR.

> *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.*

**Not listing any issues because of trivial fixes as mentioned above.**
2024-01-12 23:22:11 +00:00
Anis Alibegić 81d80c587d
Fixed a lot of typos (#141431)
Fair amount of typos spotted and fixed. Some of them are in comments, some of them are in code and some of them are in nondart files.

There is no need for issues since it's a typo fix.

I have doubts about [packages/flutter_tools/lib/src/ios/core_devices.dart](https://github.com/flutter/flutter/compare/master...anisalibegic:flutter:master#diff-fdbc1496b4bbe7e2b445a567fd385677af861c0093774e3d8cc460fdd5b794fa), I have a feeling it might broke some things on the other end, even though it's a typo.
2024-01-12 22:10:25 +00:00
auto-submit[bot] 8f797fc379
Reverts "Remove hack from PageView." (#141479)
Reverts flutter/flutter#141138
Initiated by: itsjustkevin
This change reverts the following previous change:
Original Description:
Fixes https://github.com/flutter/flutter/issues/141119

The change is breaking, because now controller is nullable.

Migration path: https://github.com/flutter/website/pull/10033

Packages to fix:
2024-01-12 21:19:18 +00:00
Christopher Fujino 9e9af67b9a
unpin web_socket_channel and roll pub packages (#141424)
Fixes https://github.com/flutter/flutter/issues/141032

We pinned to web_socket_channel v2.4.1 because v2.4.2 was retracted, however v2.4.3 is now available.
2024-01-12 19:13:08 +00:00
Bartek Pacia dbf5f04b86
FlutterExtension: make fields non-static (#141463)
There's no issue for this PR. I can create one if requested.

## Summary

This PR makes public fields of `FlutterExtension` non-static. The aim is to make migrating from Gradle Groovy DSL to Gradle Kotlin DSL easier for Flutter developers, because...

### Without this PR

**android/app/build.gradle.kts**

```kotlin
plugins {
    id "com.android.application"
    id "dev.flutter.flutter-gradle-plugin"
}

android {
    namespace = "io.flutter.examples.hello_world"
    compileSdk = FlutterExtension.compileSdkVersion

    defaultConfig {
        applicationId = "io.flutter.examples.hello_world"
        minSdk = FlutterExtension.minSdkVersion
        targetSdk = FlutterExtension.targetSdkVersion
        // ...
    }
}
// ...
```

Groovy and Java allow accessing static fields of a class through its instance, but Kotlin is being more "correct" and disallows that.

### With this PR

Thanks to this PR, the user won't have to replace `flutter` with FlutterExtension in some places, thus decreasing possible confusion.

```kotlin
plugins {
    id "com.android.application"
    id "dev.flutter.flutter-gradle-plugin"
}

android {
    namespace = "io.flutter.examples.hello_world"
    compileSdk = flutter.compileSdkVersion

    defaultConfig {
        applicationId = "io.flutter.examples.hello_world"
        minSdk = flutter.minSdkVersion
        targetSdk = flutter.targetSdkVersion
        // ...
    }
}
// ...
```
2024-01-12 18:49:21 +00:00
hangyu 4b914bd17c
[deep link] Update a gradle task to add flag check and intent filter check to the AppLinkSettings (#141231)
These check result is used in devtool deep link validation
issue: https://github.com/flutter/flutter/issues/120408

## 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].
- [ ] 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
2024-01-12 10:36:26 -08:00
Bartek Pacia fd827e3a88
Expose versionCode and versionName from local.properties in FlutterExtension (#141417)
This PR has no issue. I got this cool idea and decided to quickly try it out, and it works.

### Summary

This will allow Flutter Developers to have less code in their Android Gradle buildscripts.

```diff
 plugins {
     id "com.android.application"
     id "dev.flutter.flutter-gradle-plugin"
     id "kotlin-android"
 }

-def localProperties = new Properties()
-def localPropertiesFile = rootProject.file("local.properties")
-if (localPropertiesFile.exists()) {
-    localPropertiesFile.withReader("UTF-8") { reader ->
-        localProperties.load(reader)
-    }
-}
-
-def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
-if (flutterVersionCode == null) {
-    flutterVersionCode = "1"
-}
-
-def flutterVersionName = localProperties.getProperty("flutter.versionName")
-if (flutterVersionName == null) {
-    flutterVersionName = "1.0"
-}
-
-def keystorePropertiesFile = rootProject.file("keystore.properties")
-def keystoreProperties = new Properties()
-
 keystoreProperties.load(new FileInputStream(keystorePropertiesFile))

 android {
         applicationId "pl.baftek.discoverrudy"
         minSdk 21
         targetSdk 34
-        versionCode flutterVersionCode.toInteger()
-        versionName flutterVersionName
+        versionCode flutter.versionCode()
+        versionName flutter.versionName()
     }
```

The boilerplate that loads 'local.properties' can live in Flutter Gradle Plugin.

### Concerns

I was worried about lifecycle/ordering issues, so I tested it.

To Flutter Gradle Plugin, I added:

```diff
 class FlutterPlugin implements Plugin<Project> {
     //...

     @Override
     void apply(Project project) {
+        project.logger.quiet("Start applying FGP")
         // ...
     }
 }
```

and to my `android/app/build.gradle` I added:

```diff
 android {
+    logger.quiet("Start evaluating android block")
     namespace "pl.bartekpacia.awesomeapp"
     compileSdk 34
 
     defaultConfig {
         applicationId "pl.baftek.discoverrudy"
         minSdk 21
         targetSdk 34
         versionCode flutter.versionCode()
         versionName flutter.versionName()
     }
```

Gradle first applies the plugins (which sets versionCode and versionName on FlutterExtension), and then it executes the `android {}` extension block:

```
$ ./gradlew :app:assembleDebug

> Configure project :app
Start applying FGP
Start evaluating android block

BUILD SUCCESSFUL in 2s
383 actionable tasks: 10 executed, 373 up-to-date
```

So ordering is fine.
2024-01-12 18:18:32 +00:00
Jonah Williams f2745e97d5
When Impeller is enabled for flutter tester choose correct shader target. (#141391)
When compiling shaders for flutter tester, include Vulkan shaders when targeting Impeller.
2024-01-12 17:49:54 +00:00
Polina Cherkasova 2da87e6108
Remove hack from PageView. (#141138) 2024-01-12 09:47:34 -08:00
Mairramer f40a99ce7e
Adds support for StepStyle visual property bundle to the Step widget (#140825)
Fixes  #140770 and #103124

Adds the possibility of passing a height and width to icons. And also a margin for the distance of the lines between the icons.
2024-01-12 16:35:08 +00:00
Taha Tesser e20d34c38a
Fix FlexibleSpaceBar centered title position and title color (#140883)
fixes [Invisible SliverAppBar title in Material 3 light theme](https://github.com/flutter/flutter/issues/138296) 
fixes [`FlexibleSpaceBar` title is misaligned without the leading widget](https://github.com/flutter/flutter/issues/138608)

Previous attempt https://github.com/flutter/flutter/pull/138611

--- 

### Description

 - fixes the `FlexibleSpaceBar` centered title position when there is a leading widget.
 - fixes the `FlexibleSpaceBar` title color for Material 3.
 - Added documentation when using a long `FlexibleSpaceBar` title and update its test.
 - Improved documentation of default title padding.

### Code sample

### 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 const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Example(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      body: SafeArea(
          child: CustomScrollView(
        slivers: <Widget>[
          SliverAppBar(
            leading: Icon(Icons.favorite_rounded),
            flexibleSpace: FlexibleSpaceBar(
              title: ColoredBox(
                color: Color(0xffff0000),
                child: Text('SliverAppBar'),
              ),
            ),
          ),
        ],
      )),
    );
  }
}
```

</details>

###  Before

![Screenshot 2024-01-03 at 18 02 25](https://github.com/flutter/flutter/assets/48603081/92ae1062-c78f-4005-8e28-85af617acd60)

### After

![Screenshot 2024-01-03 at 18 02 16](https://github.com/flutter/flutter/assets/48603081/2ef97108-9b50-44f7-a303-018ff1b28db6)
2024-01-12 13:29:13 +00:00
Bartek Pacia 0a1af8a192
Add support for Gradle Kotlin DSL (#140744)
This PR resolves #140548. It's based on my work in #118067.
2024-01-12 02:20:06 +00:00
Taha Tesser 8dcae5ace4
Fix ListWheelScrollView in an AnimatedContainer with zero height throw an error (#141372)
fixes [`ListWheelScrollView` Throws Unexpected Error Inside `AnimatedContainer`](https://github.com/flutter/flutter/issues/140780)
fixes [`CupertinoDatePicker` throw exception when parent height is 0](https://github.com/flutter/flutter/issues/55630)

### 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: AnimatedContainer(
          height: 0,
          duration: Duration.zero,
          child: ListWheelScrollView(
            itemExtent: 20.0,
            children: <Widget>[
              for (int i = 0; i < 20; i++) Container(),
            ],
          ),
        ),
      ),
    );
  }
}
```

</details>
2024-01-11 18:26:04 +00:00
Andrew Kolos c355219154
make asset_test.dart tests not dependent on context (#141331)
Part of work on https://github.com/flutter/flutter/issues/141330, which is a part of work on https://github.com/flutter/flutter/issues/140092

This is a refactoring; there should be no behavioral changes in these tests.
2024-01-11 18:08:07 +00:00
Gianluca Bettega e281c39164
Expose 'enable' property to allow the user to disable the SearchBar (#137388)
This exposes the `enabled` property of the `TextField` widget to the `Searchbar` widget.

## Related Issues

https://github.com/flutter/flutter/issues/136943

Still missing tests
2024-01-11 17:58:50 +00:00
Jonah Williams 35903620c8
Add impeller key to skia gold client, Turn on a framework test shard that will run unit tests with --enable-impeller (#141341)
Redo of https://github.com/flutter/flutter/pull/140985 due to CLA issues.
2024-01-11 17:57:00 +00:00
Dan Field 9f2e681e7b
[Tool][Impeller] Make impellerc produce Vulkan and GLES shaders for Android. (#140976)
This should wait for some upstream work, just don't want to lose it locally for now. I'll switch this from draft and update the description when it's ready.
2024-01-11 17:49:59 +00:00
Kate Lovett 9785718031
Add dart fix support to flutter_driver (#141300)
Part of https://github.com/flutter/flutter/issues/139249

This adds dart fix support plus fixes for APIs that are currently deprecated in the flutter_driver package.
2024-01-11 00:07:49 +00:00
Polina Cherkasova 13684ca471
Fix a leak. (#141312) 2024-01-11 00:00:10 +00:00
Kate Lovett a94c14e063
Add covariants to reduce subclass casts in 2D APIs (#141318)
While working in https://pub.dev/packages/two_dimensional_scrollables, I found I could eliminate some casts if we added covariants here in the framework.
Much of the 2D aPI in the framework is abstract, so I think it make sense to add these and make it easier/cleaner for subclasses using the APIs.
I made a similar change in https://github.com/flutter/flutter/pull/131358, this would cover all of the cases I could find so its nice and accommodating now.
2024-01-10 23:28:48 +00:00
Justin McCandless 865825c3c1
Call onPopInvoked when pages API is used (#141221)
(Predictive Back) Fixes a bug where when using PopScope and Navigator.pages together, onPopInvoked wasn't being called.
2024-01-10 14:29:30 -08:00
Polina Cherkasova 420b15a75a
Fix mechanism to pass flag for leak tracking. (#141226) 2024-01-10 22:08:06 +00:00
Polina Cherkasova 34f1f5f19e
Improve testing for leak tracking. (#140553) 2024-01-10 11:04:28 -08:00
Christopher Fujino 0f5cd7855d
[flutter_tools] fix flutter create -t skeleton (#141233)
Fixes https://github.com/flutter/flutter/issues/139138

This had been broken since https://github.com/flutter/flutter/pull/130090 merged, however, the test happened run with flutter_tools/pubspec.yaml in the current working directory.
2024-01-10 18:50:07 +00:00
Derek Xu eff2e7dbb1
Unpin package:vm_service (#141279) 2024-01-10 12:47:25 -05:00
Igor Hnízdo 7efed85b35
NestedScrollView's outer scrollable jumping with BouncingScrollPhysics due to double precision errors (#138319)
This PR fixes scrolling issues with `NestedScrollView` using the `BouncingScrollPhysics`. In one of the steps of the calculation, we can reach a state where the position of the inner scrollable is set to a `double` value that falls within `precisionErrorTolerance` of `0` but we were using `==` with `0` rather than checking for a precision. My posts in the linked issue show the current behavior, and how I reached to conclusion (the code in this PR). This PR only addresses the "jumping" of the outer scrollable.  

Fixes #136199

I have not finished a test for this since I have never done so and therefore have 0 experience writing tests in Flutter, so any help there would be appreciated. I am also not sure how to test double precision errors in general. I did run all the nested_scroll_view_tests.dart locally and there are no failures.
2024-01-10 00:28:09 +00:00
Polina Cherkasova 0f2618ff4f
Fix or except leaks. (#141081)
Contributes to https://github.com/flutter/devtools/issues/6909.
2024-01-10 00:17:33 +00:00
Chris Bobbe 8d2aca385f
TextStyle: In copyWith, stop ignoring debugLabel when receiver has none (#141141)
Fixes #141140.

This ensures that if you call `.copyWith` and pass a `debugLabel`, the `debugLabel` won't be ignored, even if the receiver (the TextStyle you're calling `.copyWith` on) doesn't have a `debugLabel`.

The debugLabel field was added in #12552. I skimmed the discussion there and didn't find anything indicating that the param was being ignored on purpose.

I added a test case that passes with the new code and fails with the old code.
2024-01-09 23:21:24 +00:00
stuartmorgan 32fd2cbf73
Replace deprecated exists in podhelper.rb (#141169)
The recently landed https://github.com/flutter/flutter/pull/140222 accidentally used the deprecated `exists?` instead of the non-deprecated `exist?` (which other code in this file is already, correctly, using).

Fixes https://github.com/flutter/flutter/issues/141167
2024-01-09 22:25:57 +00:00
Kevin Moore 0cef3f1629
Correctly handle null case in ProcessText.queryTextActions (#141205)
Replace `as Map<Object?, Object?>` to handle nullable case
Fixes runtime issue in Wasm

*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

*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.*

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2024-01-09 22:25:54 +00:00
Michael Goderbauer 4534a24c09
Reapply "Dynamic view sizing" (#140165) (#140918)
This reverts commit
d24c01bd0c.

The original change was reverted because it caused some apps to get
stuck on the splash screen on some phones.

An investigation determined that this was due to a rounding error.
Example: The device reports a physical size of 1008.0 x 2198.0 with a
dpr of 1.912500023841858. Flutter would translate that to a logical size
of 527.0588169589221 x 1149.2810314243163 and use that as the input for
its layout algorithm. Since the constraints here are tight, the layout
algorithm would determine that the resulting logical size of the root
render object must be 527.0588169589221 x 1149.2810314243163.
Translating this back to physical pixels by applying the dpr resulted in
a physical size of 1007.9999999999999 x 2198.0 for the frame. Android
now rejected that frame because it didn't match the expected size of
1008.0 x 2198.0 and since no frame had been rendered would never take
down the splash screen.

Prior to dynamically sized views, this wasn't an issue because we would
hard-code the frame size to whatever the requested size was.

Changes in this PR over the original PR:

* The issue has been fixed now by constraining the calculated physical
size to the input physical constraints which makes sure that we always
end up with a size that is acceptable to the operating system.
* The `ViewConfiguration` was refactored to use the slightly more
convenient `BoxConstraints` over the `ViewConstraints` to represent
constraints. Both essentially represent the same thing, but
`BoxConstraints` are more powerful and we avoid a couple of translations
between the two by translating the` ViewConstraints` from the
`FlutterView` to `BoxConstraints` directly when the `ViewConfiguration`
is created.

All changes over the original PR are contained in the second commit of
this PR.

Fixes b/316813075
Part of https://github.com/flutter/flutter/issues/134501.
2024-01-09 14:10:43 -08:00
SharbelOkzan 0c40f21fc5
Introduce new Form validation method (#135578)
Introduced `validateGranually` which, apart from announcing the errors to the UI, returns a `Map<Key, bool>` providing more granular validation details: The results of calling `validate` on each `FormField` and their corresponding widget keys.

* related issue: #135363
2024-01-09 21:10:04 +00:00
Taha Tesser 536de5ed91
Update RouteObserver example and fix an error thrown (#141166)
fixes [`RouteObserver` example throws an error](https://github.com/flutter/flutter/issues/141078)

### Description
This updates the `RouteObserver` example from snippet to Dartpad example and fixes the error when running the code snippet
2024-01-09 20:48:56 +00:00
Polina Cherkasova 1f3103e50d
Upgrade leak_tracker. (#141153) 2024-01-09 12:02:35 -08:00
Polina Cherkasova 188d4d1fdf
Remove conditions that depend on order. (#141183) 2024-01-09 11:19:04 -08:00
Nishant Kumar 83cf44ed12
resolved the issue of indeterminate CircularProgressIndicator.adaptive on Darwin (#140947)
Fixes #140574

Passes the value from `CircularProgressIndicator` to the Cupertino version so that functionality is not lost on Apple devices.
2024-01-09 18:19:07 +00:00
Bruno Leroux 5f17badf41
[Android] Add custom system-wide text selection toolbar buttons for SelectableRegion (#141103)
## Description

This PR adds custom system-wide text selection toolbar buttons on Android for `SelectableRegion` and `SelectionArea`.

https://github.com/flutter/flutter/pull/139738 adds those buttons for `EditableText` (which is used by `TextField` and `SelectableText` but not by `SelectionArea`).

## Related Issue

Step 5 for https://github.com/flutter/flutter/issues/139361

## Tests

Adds 2 tests.
2024-01-09 09:49:13 +00:00
Taha Tesser f7f437ce2a
Update Chips and ChipTheme tests and for Material 3 (#141022)
Updated unit tests for `Tooltip` to have M2 and M3 versions.

More info in #139076
2024-01-09 09:05:06 +00:00
Taha Tesser 649877d2cc
Update chip_test.dart tests for Material 3 (#140964)
Updated unit tests for `Tooltip` to have M2 and M3 versions.

More info in #139076
2024-01-09 09:03:02 +00:00
Bruno Leroux 2e6aac6ee6
Fix spell check throws when text contains regex reserved characters (#140384)
## Description

This PR fixes an issue related to the spell check implementation usage of Regex (searched text should be escaped).

## Related Issue

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

## Tests

Adds 1 test.
2024-01-09 08:59:20 +00:00
Daco Harkes b2ef2802d2
Native assets support for Android Add2app (#140802)
Support for FFI calls with @Native external functions through Native assets on Android add to app. This enables bundling native code without any build-system boilerplate code.

For more info see:

*  https://github.com/flutter/flutter/issues/129757

## Implementation details for Android add2app

The `.so` files are bundled with the same mechanism that bundles `libapp.so`.
2024-01-09 08:47:53 +00:00
asci 3b7ed0006c
[docs] Add document content related to chip shape (#140015)
(#139572)  I would like to request an update to the document to resolve confusion.
I actually modified the code by applying priority as in the comment in [#139572](https://github.com/flutter/flutter/issues/139572) as shown below, but I thought that if 'OutlinedBorder' was used for 'shape', the default value of side for 'OutlinedBorder' was also the developer's intention.

```
OutlinedBorder _getShape(ThemeData theme, ChipThemeData chipTheme, ChipThemeData chipDefaults) {
  final BorderSide? resolvedSide =
      MaterialStateProperty.resolveAs<BorderSide?>(widget.side, materialStates)
          ?? MaterialStateProperty.resolveAs<BorderSide?>(chipTheme.side, materialStates);
  final BorderSide? resolvedShapeSide =
      MaterialStateProperty.resolveAs<BorderSide?>(widget.shape?.side, materialStates)
          ?? MaterialStateProperty.resolveAs<BorderSide?>(chipTheme.shape?.side, materialStates);
  final OutlinedBorder resolvedShape =
      MaterialStateProperty.resolveAs<OutlinedBorder?>(widget.shape, materialStates)
          ?? MaterialStateProperty.resolveAs<OutlinedBorder?>( chipTheme.shape, materialStates)
          ?? MaterialStateProperty.resolveAs<OutlinedBorder?>(chipDefaults.shape, materialStates)
          // TODO(tahatesser): Remove this fallback when Material 2 is deprecated.
          ?? const StadiumBorder();
  // If the side is provided, shape uses the provided side.

  if (resolvedSide != null) {
    return resolvedShape.copyWith(side: resolvedSide);
  }
  if (resolvedShapeSide != null) {
    return resolvedShape.copyWith(side: resolvedShapeSide);
  }
  // If the side is not provided
  // then the shape's side is used. Otherwise, the default side is used.
  return resolvedShape.copyWith(side: chipDefaults.side);
}
```
(in `chip.dart`)

However, (#133856)  PR seems to be intended to ignore this and use the aspect of `chipDefault.side` even if the developer specifies `shape.side` as [Border.none] without explicitly applying `side` .
This is probably because the default value of OutlinedBorder is [Border.none].
I think this is an area that can cause enough confusion, but there are a lot of things that need to be modified to reduce confusion through code changes, and the impact on existing code is likely to be significant.
I also confirmed that this is not accurately explained in the API Docs.
So rather than modifying the code, I decided to add additional explanation to the `shape` comment.
If the results are different from what you intended or the updated content is strange, please review. 🙏
2024-01-08 23:06:10 +00:00
Zachary Anderson 7859fe3b24
Disable test shuffling in widget_tester_leaks_test.dart (#141110)
Fails with `flutter test --test-randomize-ordering-seed=20240108`

https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20framework_tests_misc/15044/overview

cc @polina-c
2024-01-08 15:54:05 +00:00
Christopher Fujino 6edbce9e07
Manual pub roll pinning web socket channel (#141040)
Work around https://github.com/flutter/flutter/issues/141032

Otherwise a re-land of https://github.com/flutter/flutter/pull/140979

Fixes https://github.com/flutter/flutter/issues/137163 & https://github.com/flutter/flutter/issues/139181
2024-01-05 22:29:58 +00:00
Andrew Kolos e90e4888b8
in flutter run, throw tool exit when --flavor is provided but is not supported on the target device (#139045)
Fixes https://github.com/flutter/flutter/issues/134197
2024-01-05 21:47:58 +00:00
Andrew Kolos 8c11aa030d
add flavor-conditional asset bundling support to flutter test (#140944)
Fixes https://github.com/flutter/flutter/issues/140932
2024-01-05 21:47:55 +00:00
TabooSun e8436970e6
Gen l10n add named argument option (#138663)
Add an option to use named argument for generated method.

Fix #116308
2024-01-05 21:28:08 +00:00
Luke Hutchison 0d6927cb61
Fix refresh cancelation (#139535)
Changes drag release logic so that an armed refresh is only canceled if the user has scrolled back up beyond the point where the refresh indicator was armed. (Fixes https://github.com/flutter/flutter/issues/138848.)

This is the minimal change I found could be made to restore something like the behavior that I would expect.

This may still need a bit of work, because it only masks the second issue I mentioned, that releasing a drag can cause the scroll position to be animated back up from the release point. There is actually a bug about that: https://github.com/flutter/flutter/issues/6052. I would like to see that bug fixed too. This PR doesn't address that, but makes it harder to hit that issue.

@Piinks this is a recreation of #139015 (since I couldn't figure out some issue with a git detached branch, so I fixed the PR and I'm re-submitting it). This version includes one line that was somehow accidentally dropped from the original PR. This will hopefully fix the test failures.

However, I don't have a clue how to write a test for a Flutter UI widget. I'll try to figure that out, but also I don't have a lot of time to work on this. I would appreciate at least some user testing to verify that the new behavior is much more intuitive than the old behavior.

- [?] All existing and new tests are passing.
2024-01-05 21:28:07 +00:00
auto-submit[bot] c2286a7642
Reverts "manual pub roll to pick up dds fixes" (#141033)
Reverts flutter/flutter#140979
Initiated by: loic-sharma
This change reverts the following previous change:
Original Description:
Fixes https://github.com/flutter/flutter/issues/137163
Fixes https://github.com/flutter/flutter/issues/139181
2024-01-05 19:10:19 +00:00
Taha Tesser 88016c11b4
Fix scrollable TabBar expands to full width when the divider is removed (#140963)
fixes [TabBar Expands to full width of the screen isScrollable: true after upgrading to flutter 3.16.4](https://github.com/flutter/flutter/issues/140338)

---

## Description

Fixes the scrollable `TabBar` width when the divider is removed. (when the divider height is set to `0` or divider color is set to `Colors.transparent`)

### 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) {
    const int tabsCount = 2;

    return MaterialApp(
      home: DefaultTabController(
        initialIndex: 1,
        length: tabsCount,
        child: Scaffold(
          appBar: AppBar(
            title: const Text('TabBar Sample'),
            bottom: PreferredSize(
              preferredSize: const Size.fromHeight(48.0),
              child: ColoredBox(
                color: Theme.of(context).colorScheme.secondaryContainer,
                child:  TabBar(
                  // dividerColor: Theme.of(context).colorScheme.onSurface,
                  dividerColor: Colors.transparent, // remove divider
                  // dividerHeight: 0, // remove divider
                  isScrollable: true,
                  tabAlignment: TabAlignment.center,
                  tabs: <Widget>[
                    for (int i = 0; i < tabsCount; i++)
                      Tab(
                        text: 'Tab $i',
                      ),
                  ],
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}
```

</details>

### Before
![Simulator Screenshot - iPhone 15 Pro - 2024-01-04 at 15 16 15](https://github.com/flutter/flutter/assets/48603081/b776e7e6-e5f0-49df-8a79-55032eaad631)

### After
![Simulator Screenshot - iPhone 15 Pro - 2024-01-04 at 15 16 23](https://github.com/flutter/flutter/assets/48603081/9ad13793-43a9-4ae8-977e-7cf84cb59bb1)
2024-01-05 08:33:26 +00:00
Yegor 1fb95ba41b
[web] Fix and unskip a few more CanvasKit tests (#140821)
Fix and unskip the following CanvasKit tests:

- `test/painting/decoration_test.dart`
- `test/rendering/layers_test.dart`
- `test/widgets/app_overrides_test.dart`
2024-01-04 23:26:38 +00:00
Danny Tuppeny 2d3166b7f9
Pin package:vm_service (#140972)
vm_service 14 should not be used yet (see
https://github.com/flutter/flutter/pull/140916#issuecomment-1877383354)
but when trying to unpin pkg:test it was upgraded. This pins it to
v13.0.0.
2024-01-04 21:10:44 +00:00
Qun Cheng be8a1eac73
Add scrollbar for menus (#140941)
Fixes #140162

This PR is to add a scrollbar for MenuAnchor and DropdownMenu for all platforms when height is limited. Previously, a scrollbar only shows on desktop platforms. This PR also disabled scrollbar's overscroll for MenuAnchor and DropdownMenu.

<img src="https://github.com/flutter/flutter/assets/36861262/9ca3d4d0-415f-43bf-9d2b-df96a42db620" width="250"/><img src="https://github.com/flutter/flutter/assets/36861262/18da8d02-586b-4aa4-b647-927691542429" width="350"/>
2024-01-04 21:09:31 +00:00
Christopher Fujino e256d49117
manual pub roll to pick up dds fixes (#140979)
Fixes https://github.com/flutter/flutter/issues/137163
Fixes https://github.com/flutter/flutter/issues/139181
2024-01-04 19:43:06 +00:00
Polina Cherkasova 3ed0399663
Reland "integrate testWidgets with leak tracking" (#140521) (#140928) 2024-01-04 10:20:36 -08:00
Sharabiddin Ahmayev 2ae39c0cc0
Fix SegmentedButton states update logic (#140772)
This PR fixes: #140746

Desc: Style state update logic fix on SegmentedButton
2024-01-04 17:57:06 +00:00
Tirth 64a732740d
[Fix] Consistency in ButtonStyleButton related Tests (#140610)
[Fix] Consistency in ButtonStyleButton related Tests:
- Replaced the usage of ElevatedButton with FilledButton in FilledButton's test.
- Replaced the usage of TextButton.styleFrom with FilledButton.styleFrom in FilledButton's test.
- Replaced the usage of TextButton.styleFrom with ElevatedButton.styleFrom in ElevatedButton's test.
2024-01-04 17:03:58 +00:00
stuartmorgan 24e06232a7
Fix local engine use in macOS plugins (#140222)
Currently podhelper.rb will always point plugin builds at the cached engine artifacts, even when using `--local-engine`. In most cases this is fine, since when the final build actually runs it will be using the engine bundled into the app build, which will be the correct local engine build. When trying to test a local engine build with API additions against a local plugin modified to use those additions to ensure that they are working as expected, however, compilation will fail, because the new APIs won't be present in the plugin build.

This fixes that for macOS, and adds a TODO for iOS (which is more complicated to fix due to the host vs target build distinction).

macOS portion of https://github.com/flutter/flutter/issues/132228
2024-01-04 15:40:08 +00:00
Jenn Magder 5d4f5f77b8
Remove deprecated bitcode stripping from tooling (#140903)
Bitcode has been removed https://github.com/flutter/flutter/issues/107887, clean up the leftover commands.
2024-01-03 23:15:23 +00:00
Jenn Magder 076cb8a328
Migrate Xcode projects last version checks to Xcode 15.1 (#140256)
Change the following in the `flutter create` templates.  I didn't make any auto-migrations for existing apps because none seem that critical:
1. Turn on `ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS` in iOS and macOS.
1. Turn on `BuildIndependentTargetsInParallel` in macOS template.  https://github.com/flutter/flutter/pull/125827/files#r1181817619 
1. Turn on `DEAD_CODE_STRIPPING` in macOS template. 
1. Set `ENABLE_USER_SCRIPT_SANDBOXING=NO` in iOS and macOS template.  `flutter` scripts don't work with this on.  This might require a migration in the future to explicitly turn this one off. However at least for now if the setting isn't present it defaults to `NO`.

Add migration for `LastUpgradeVersion` so users won't see these validation issues in Xcode.

Run migrator on all the example apps.  A few aren't Flutter apps so I edited them in Xcode.

Fixes https://github.com/flutter/flutter/issues/140253
See also https://github.com/flutter/flutter/issues/125817 and https://github.com/flutter/flutter/pull/90304.
2024-01-03 23:05:46 +00:00
Michael Goderbauer ae4fb0ca7c
fix typo and reflow (#140925)
Fixes "differenet" => "different" and reflows the doc to 80 char line length.
2024-01-03 23:01:57 +00:00
auto-submit[bot] 253dc6f847
Reverts "Re-land integrate testWidgets with leak tracking." (#140926)
Reverts flutter/flutter#140521
Initiated by: zanderso
This change reverts the following previous change:
Original Description:
Original PR: https://github.com/flutter/flutter/pull/138057
Revert: https://github.com/flutter/flutter/pull/140502
Issue: https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_android%20flutter_test_performance/12787/overview
Exception: flutter test rendered unexpected output (1 bad lines)
Explanation: leak tracker adds tear down even when there is no leak tracking, because at the moment of adding tear down it is unclear if leak tracking will be used for some tests.
Fix: add enabling flag for leak tracker and make creation of tear down conditional.
Prerequisites:
2024-01-03 22:36:17 +00:00
yim 0d4eb5eaa0
Changes the regular cursor to a floating cursor when a long press occurs. (#138479)
This PR changes the regular cursor to a floating cursor when a long press occurs.

This is a new feature. Fixes  #89228
2024-01-03 21:45:07 +00:00
Furkan Acar 83ac76050d
Add SegmentedButton.styleFrom (#137542)
fixes https://github.com/flutter/flutter/issues/138289

---

SegmentedButtom.styleFrom has been added to the segment button, so there is no longer any need to the button style from the beginning. It works like ElevatedButton.styleFrom only I added selectedForegroundColor, selectedBackgroundColor. In this way, the user will be able to change the color first without checking the MaterialState states. I added tests of the same controls.

#129215 I opened this problem myself, but I was rejected because I handled too many items in a PR. For now, I wrote a structure that only handles MaterialStates instead of users.

old (still avaliable)
<img width="626" alt="image" src="https://github.com/flutter/flutter/assets/65075121/9446b13b-c355-4d20-bda2-c47a23d42d4f">

new (just an option for developer)
<img width="483" alt="image" src="https://github.com/flutter/flutter/assets/65075121/0a645257-4c83-4029-9484-bd746c02265f">

### Code sample

<details>
<summary>expand to view the code sample</summary> 

```dart
import 'package:flutter/material.dart';

/// Flutter code sample for [SegmentedButton].

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 = Calendar.day;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(useMaterial3: true),
      home: Scaffold(
        body: Center(
          child: SegmentedButton<Calendar>(
            style: SegmentedButton.styleFrom(
              foregroundColor: Colors.amber,
              visualDensity: VisualDensity.comfortable,
            ),
            // style: const ButtonStyle(
            //   foregroundColor: MaterialStatePropertyAll<Color>(Colors.deepPurple),
            //   visualDensity: VisualDensity.comfortable,
            // ),
            segments: const <ButtonSegment<Calendar>>[
              ButtonSegment<Calendar>(
                  value: Calendar.day,
                  label: Text('Day'),
                  icon: Icon(Icons.calendar_view_day)),
              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},
            onSelectionChanged: (Set<Calendar> newSelection) {
              setState(() {
                calendarView = newSelection.first;
              });
            },
          ),
        ),
      ),
    );
  }
}

```

</details>
2024-01-03 21:26:02 +00:00
Polina Cherkasova baf6ba134f
Re-land integrate testWidgets with leak tracking. (#140521) 2024-01-03 12:21:08 -08:00
Jonah Williams 0d378ed5ab
[flutter_tools] add support for --enable-impeller to test device. (#140899)
This allows unit tests to use the impeller backend, which can be useful for Scubas/golden tests.
2024-01-03 19:14:49 +00:00
Ann Marie Mossman 743cdd68b7
Handle KEYCODE_DPAD_CENTER and KEYCODE_ENTER (#140808)
https://github.com/flutter/flutter/issues/1670

Note: This PR replaces the the original PR (https://github.com/flutter/flutter/pull/138240) that got into a state where a rebase was not possible and made it difficult to determine what was causing unrelated test failures.
2024-01-03 18:37:23 +00:00
Elliott Brooks 55ba27d3bc
Link to wiki page about updating dependencies in each pubspec.yaml file (#140826)
Added a minimal wiki page about how to use the `update-packages` tool: https://github.com/flutter/flutter/wiki/Updating-dependencies-in-Flutter

This PR adds a link to that wiki page at the top of each pubspec.yaml file
2024-01-03 18:28:52 +00:00
Jack Gibbons f4cb3d215d
Add key to BottomNavigationBarItem (#139617)
Pass key into _BottomNavigationTile

Adding a optional key parameter to BottomNavigationBarItem to be passed through to _BottomNavigationTile.
This will allow easier testing in some scenarios, and fix the splash appearing on the wrong tile.

https://github.com/flutter/flutter/issues/139615
https://github.com/flutter/flutter/issues/34833
2024-01-03 15:58:21 +00:00
Satsrag c033b08df7
fix: cannot input new line using custom input control (#140356)
For https://github.com/flutter/flutter/issues/125875 and https://github.com/flutter/engine/pull/45522

According to [this discussion](https://github.com/flutter/flutter/pull/139446#discussion_r1424776370), Just added `forceMultiline` to JSON on `_configurationToJson`. @LongCatIsLooong @Renzo-Olivares
2024-01-03 01:58:24 +00:00
Jenn Magder b08fc60024
Set template and migrate apps to iOS 12 minimum (#140823)
Reland https://github.com/flutter/flutter/pull/140478 with `ios_content_validation_test` test fix.
```
[ios_content_validation_test] Process terminated with exit code 0.
Task result:
{
  "success": true,
  "data": null,
  "detailFiles": [],
  "benchmarkScoreKeys": [],
  "reason": "success"
}

```

__________

1. Change templates to `IPHONEOS_DEPLOYMENT_TARGET`, `MinimumOSVersion`, and Podfile `platform :ios` to 12.0.
2. Add migrator for Podfile part to migrate `platform :ios, '11.0'` -> `platform :ios, '12.0'`
3. Compile with `-miphoneos-version-min=12.0`
4. Run the migrator on all example apps and integration tests.

See also https://github.com/flutter/flutter/pull/62902 and https://github.com/flutter/flutter/pull/85174 and https://github.com/flutter/flutter/pull/101963

Fixes https://github.com/flutter/flutter/issues/136060
2024-01-03 00:47:40 +00:00
David Iglesias 6b4f0d5753
[flutter] Allow ViewCollection to start empty. (#140532)
This enables multi-view apps to start with zero views.
2024-01-03 00:22:52 +00:00
Andrew Kolos 3ac2dba58d
Fix setup race in asset bundle tests (#140832)
Fixes https://github.com/flutter/flutter/issues/140665 by replacing use of `setUpAll` and `teardownAll` with `setUp` and `teardown` respectively.

My theory has to how this issue happened (and how this PR fixes it) is that `setUpAll` is not guaranteed to run after any `setUp` in any parent test groups. However, `setUp` is guaranteed to run after any set-up callbacks in parent groups. From the [documentation](https://api.flutter.dev/flutter/flutter_test/setUp.html): 

> If this is called within a test group, it applies only to tests in that group. The body will be run after any set-up callbacks in parent groups or at the top level.

Meanwhile, [`setUpAll`](https://api.flutter.dev/flutter/flutter_test/setUpAll.html) has a weaker documented guarantee that applies only to other `setUpAll` calls:

> If this is called within a test group, The body will run before all tests in that group. It will be run after any [setUpAll](https://api.flutter.dev/flutter/flutter_test/setUpAll.html) callbacks in parent groups or at the top level. It won't be run if none of the tests in the group are run.
2024-01-03 00:15:51 +00:00
LongCatIsLooong f3b6505f14
Fix 139196 selection OOB (#140300)
Fixes #139196
2024-01-03 00:11:18 +00:00
Polina Cherkasova 45c611f040
Upgrade leak_tracker. (#140758) 2024-01-02 20:58:16 +00:00
auto-submit[bot] bd634f3298
Reverts "Set template and migrate apps to iOS 12 minimum" (#140822)
Reverts flutter/flutter#140478
Initiated by: loic-sharma
This change reverts the following previous change:
Original Description:
1. Change templates to `IPHONEOS_DEPLOYMENT_TARGET`, `MinimumOSVersion`, and Podfile `platform :ios` to 12.0.
2. Add migrator for Podfile part to migrate `platform :ios, '11.0'` -> `platform :ios, '12.0'`
3. Compile with `-miphoneos-version-min=12.0`
4. Run the migrator on all example apps and integration tests.

See also https://github.com/flutter/flutter/pull/62902 and https://github.com/flutter/flutter/pull/85174 and https://github.com/flutter/flutter/pull/101963

Fixes https://github.com/flutter/flutter/issues/136060
2024-01-02 20:49:19 +00:00
LongCatIsLooong 5883a6ca10
Reland "Make TextSpan hit testing precise." (#140468) (#140621)
Fixes https://github.com/flutter/flutter/issues/131435, https://github.com/flutter/flutter/issues/104594, https://github.com/flutter/flutter/issues/43400

Currently the method we use for text span hit testing `TextPainter.getPositionForOffset` always returns the closest `TextPosition`, even when the given offset is far away from the text.

The new TextPaintes method tells you the layout bounds `(width =  letterspacing / 2 + x_advance + letterspacing / 2, height = font ascent + font descent)` of a character, the PR changes the hit testing implementation such that a TextSpan is only considered hit if the point-down event landed in one of its character's layout bounds.

Potential issues:

In theory since the text is baseline aligned, we should use the max ascent and max descent of each character to calculate the height of the text span's hit-test region, in case some characters in the span have to fall back to a different font, but that will be slower and it typically doesn't make a huge difference.
This is a breaking change.
2024-01-02 20:26:12 +00:00
Elliott Brooks cb07292f57
Update dependencies with flutter update-packages --force-upgrade (#140810) 2024-01-02 12:10:10 -08:00
Jenn Magder acdbcadb9e
Set template and migrate apps to iOS 12 minimum (#140478)
1. Change templates to `IPHONEOS_DEPLOYMENT_TARGET`, `MinimumOSVersion`, and Podfile `platform :ios` to 12.0.
2. Add migrator for Podfile part to migrate `platform :ios, '11.0'` -> `platform :ios, '12.0'`
3. Compile with `-miphoneos-version-min=12.0`
4. Run the migrator on all example apps and integration tests.

See also https://github.com/flutter/flutter/pull/62902 and https://github.com/flutter/flutter/pull/85174 and https://github.com/flutter/flutter/pull/101963

Fixes https://github.com/flutter/flutter/issues/136060
2024-01-02 19:42:13 +00:00
shirne 7249d9ec6d
improve comment doc in tabs.dart (#140568)
*Replace this paragraph with a description of what this PR is changing or adding, and why. Consider including before/after screenshots.*

*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.*

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2024-01-02 19:03:10 +00:00
Dan Field bfdc32fcd0
Revert "[Impeller] Plumb through the impeller-force-gl flag." (#140535)
Reverts flutter/flutter#123828

Fixes https://github.com/flutter/flutter/issues/140523
2024-01-02 18:28:04 +00:00
Polina Cherkasova f667376cc8
Rename MemoryAllocations to FlutterMemoryAllocations. (#140623)
Contributes to https://github.com/flutter/flutter/issues/140622
2024-01-02 09:56:30 -08:00
Polina Cherkasova 59242b75c5
Add command line parameter that turns on leak tracking. (#138653) 2024-01-02 09:20:12 -08:00
Daniel Chevalier 186659dc35
Show width and height in inspector overlay (#140709)
![](https://media.giphy.com/media/SX71qs3TDxVkvbLJ4o/giphy-downsized.gif)

Fixes https://github.com/flutter/devtools/issues/6871

Add the width and height to the inspector overlay. 1 decimal precision is used since that matches the way Devtools displays the values.

## Examples
<img width="442" alt="Screenshot 2023-12-28 at 2 39 49 PM" src="https://github.com/flutter/flutter/assets/1386322/2de40092-de15-4ada-a954-e911e6bef217">

<img width="645" alt="Screenshot 2023-12-28 at 2 39 42 PM" src="https://github.com/flutter/flutter/assets/1386322/8f53dad5-1aba-43d9-9419-ca93cd894624">
<img width="149" alt="Screenshot 2023-12-28 at 2 39 37 PM" src="https://github.com/flutter/flutter/assets/1386322/bbed74b7-c962-4c20-80d8-48e5eaa14de6">
2023-12-29 01:34:40 +00:00
hhh b0b0e423d6
expose didExceedMaxLines from RenderParagraph (#139962)
I want to build a widget that adds some extra functionality when the inner text overflow. So the problem occurred, I can't find an elegant way to determine if the text is overflowing. 
So i expose `didExceedMaxLines` from `RenderParagraph`, I think it can make sense. Have there some advice?
2023-12-28 01:38:38 +00:00
Harry Terkelsen 13feba5852
[web] Re-enable text field test now that fix has landed in engine (#140678)
Re-enables skipped flaky test now that the underlying cause of flakiness (GPU memory leak) has been fixed in the engine and the fix has rolled into the framework.

The fix is here: https://github.com/flutter/engine/pull/49336

Fixes https://github.com/flutter/flutter/issues/137669
2023-12-27 21:45:18 +00:00
Zachary Anderson ddb8d1f670
Makes the flutter tool retry on a bad gateway network error from gradle (#140670)
Seen in https://github.com/flutter/flutter/issues/140643
2023-12-27 20:13:36 +00:00
Bruno Leroux 89f0c69e49
Add custom system-wide text selection toolbar buttons on Android (#139738)
## Description

This PR adds custom system-wide text selection toolbar buttons on Android.
~~This is a WIP until https://github.com/flutter/flutter/pull/139479 is merged (potential conflicts).~~

## Related Issue

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

## Tests

Adds 5 tests.
2023-12-27 19:03:29 +00:00
Zachary Anderson 6664dfec2f
Disable random test order in asset_bundle_test.dart (#140666)
For https://github.com/flutter/flutter/issues/140665
2023-12-27 18:06:31 +00:00
Reid Baker 48ae5ff6f6
Use double quotes over single quotes in gradle build files (#140512)
Following https://developer.android.com/build/migrate-to-kotlin-dsl
2/n Use double quotes instead of single quotes. 

Should be a no-op change. If you see a behavioral change please flag it.
2023-12-22 16:25:06 +00:00
flutter-pub-roller-bot 9c2a756009
Roll pub packages (#140525)
This PR was generated by `flutter update-packages --force-upgrade`.
2023-12-21 22:13:24 +00:00
Ian Hickson 62f1594908
Make tests more resilient to Skia gold failures and refactor flutter_goldens for extensive technical debt removal (#140101)
Originally landed in https://github.com/flutter/flutter/pull/139549
Originally reverted in https://github.com/flutter/flutter/pull/140085

- Remove all use of global variables.
- Always pass in all dependencies, only create them in main or in tests.
- Pass in the "print" primitive.
- Make all network traffic retry (except when run locally, when it just auto-passes).
- Enable tests to be run in random order.
- Better error messages
2023-12-21 21:35:07 +00:00
Andrew Kolos 9e104eb7c8
Fix flavor conditional asset bundling for macos (#140433)
Fixes https://github.com/flutter/flutter/issues/140430
Fixes https://github.com/flutter/flutter/issues/140432 while we are at it
2023-12-21 20:30:21 +00:00
Christopher Fujino 674fbd26bc
[flutter_tools] Ensure flutter daemon clients can detect preview device (#140112)
Part of https://github.com/flutter/flutter/issues/130277
2023-12-21 19:01:16 +00:00
Non Vachara 90badf7050
Add send_text_input_action case to deserialization_factory to allow sendTextInputAction usages through flutter_driver. (#139197)
**As a follow up to https://github.com/flutter/flutter/pull/131776.**

**Summary:**
Previously in https://github.com/flutter/flutter/pull/106561, SendTextInputAction was added to Flutter Driver.
But it still cannot be used from flutter_driver tests. This PR intends to resolve that issue.

**Issue:**
An `DriverError: Unsupported command kind send_text_input_action` would be thrown from `flutter_driver/lib/src/common/deserialization_factory.dart` when a call to `driver.sendTextInputAction(TextInputAction.done);` was made despite the method `sendTextInputAction` is available for use since https://github.com/flutter/flutter/pull/106561.

Previous works has been done in https://github.com/flutter/flutter/pull/131776, I merely added tests.

Best regards.
2023-12-21 17:48:16 +00:00
auto-submit[bot] cb50d4a804
Reverts "[web] Re-enable test now that source of flakiness is fixed" (#140515)
Reverts flutter/flutter#140462
Initiated by: cbracken
This change reverts the following previous change:
Original Description:
The test was flaky before due to overflowing GPU memory during the test. The memory leak was fixed here https://github.com/flutter/engine/pull/49214

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

As a side effect of the fix, this test also runs much faster, from about 3 minutes on my Macbook down to about 25 seconds.
2023-12-21 17:46:16 +00:00
Gustl22 f5ac225c8d
Reland: "Fix how Gradle resolves Android plugin" (#137115)
Relands #97823

When the tool migrated to `.flutter-plugins-dependencies`, the Gradle plugin was never changed.
Until now, the plugin had the heuristic that a plugin with a `android/build.gradle` file supported the Android platform.

Also applies schema of `getPluginDependencies` to `getPluginList` which uses a `List` of Object instead of `Properties`.

Fixes #97729
Cause of the error: 5f105a6ca7/packages/flutter_tools/gradle/flutter.gradle (L421C25-L421C25)

Fixes #98048
The deprecated line `include ":$name"` in `settings.gradle` (pluginEach) in old projects causes the `project.rootProject.findProject` to also find the plugin "project", so it is not failing on the `afterEvaluate` method. But the plugin shouldn't be included in the first place as it fails with `Could not find method implementation() for arguments` error in special cases.

Related to #48918, see [_writeFlutterPluginsListLegacy](27bc1cf61a/packages/flutter_tools/lib/src/flutter_plugins.dart (L248)).

Co-authored-by: Emmanuel Garcia <egarciad@google.com>
2023-12-21 16:55:04 +00:00
Jim Graham 8407dd2d0e
Revert "Integrate testWidgets with leak tracking. (#138057)" (#140502)
The PR is breaking the `flutter_test_performance` test and making the
tree red.
2023-12-21 12:44:58 +01:00
Polina Cherkasova d746007fcd
Integrate testWidgets with leak tracking. (#138057)
Contributes to: https://github.com/flutter/flutter/issues/135856

TODO:
2023-12-21 00:19:59 +00:00
Qun Cheng c0acd8c45f
Fix import pattern (#140425)
This PR is just to fix the import pattern to follow the convention.
2023-12-21 00:18:09 +00:00
flutter-pub-roller-bot 2d75f76b44
Roll pub packages (#140472)
This PR was generated by `flutter update-packages --force-upgrade`.
2023-12-20 22:57:21 +00:00
Michael Goderbauer 68e346e41c
Remove outdated ignores from tool (#140467)
These were not ignoring anything (anymore).
2023-12-20 22:14:32 +00:00
Michael Goderbauer c4fda23393
Remove outdated ignores from framework (#140465)
These were not ignoring anything (anymore).
2023-12-20 22:05:29 +00:00
LongCatIsLooong e2e8bcb1bc
Reland find.textRange.ofSubstring changes (#140469)
Extracted from https://github.com/flutter/flutter/pull/139717 as-is. Landing this change first so we can avoid doing a g3fix.
2023-12-20 22:00:55 +00:00
Reid Baker d6e435a7ac
Part 1/n migration steps for kotlin migration (#140452)
Following https://developer.android.com/build/migrate-to-kotlin-dsl
1/n Add parentheses to method calls 

Should be a no-op change. If you see a behavioral change please flag it.
2023-12-20 20:40:17 +00:00
auto-submit[bot] 9003f13803
Reverts "Make TextSpan hit testing precise." (#140468)
Reverts flutter/flutter#139717
Initiated by: LongCatIsLooong
This change reverts the following previous change:
Original Description:
Fixes https://github.com/flutter/flutter/issues/131435, #104594, #43400
Needs https://github.com/flutter/engine/pull/48774 (to fix the web test failure).

Currently the method we use for text span hit testing `TextPainter.getPositionForOffset` always returns the closest `TextPosition`, even when the given offset is far away from the text. 

The new TextPaintes method tells you the layout bounds (`width =  letterspacing / 2 + x_advance + letterspacing / 2`, `height = font ascent + font descent`) of a character, the PR changes the hit testing implementation such that a TextSpan is only considered hit if the point-down event landed in one of it's character's layout bounds.

Potential issues:

1. In theory since the text is baseline aligned, we should use the max ascent and max descent of each character to calculate the height of the text span's hit-test region, in case some characters in the span have to fall back to a different font, but that will be slower and it typically doesn't make a huge difference. 

This is a breaking change. It also introduces a new finder and a new method `WidgetTester.tapOnText`: `await tester.tapOnText('string to match')` for ease of migration.
2023-12-20 19:32:10 +00:00
Harry Terkelsen 11bfb3c46a
[web] Re-enable test now that source of flakiness is fixed (#140462)
The test was flaky before due to overflowing GPU memory during the test.
The memory leak was fixed here
https://github.com/flutter/engine/pull/49214

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

As a side effect of the fix, this test also runs much faster, from about
3 minutes on my Macbook down to about 25 seconds.

## 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] 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-12-20 11:11:56 -08:00
Bruno Leroux 0d90014bae
_TabBarViewState should not recreate page controller (#135500)
## Description

This PR replaces the unconditional instantiation of `PageController` in `_TabBarViewState.didChangeDependencies` as suggested in https://github.com/flutter/flutter/pull/134091#discussion_r1319177744.

## Related Issue

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

## Tests

Adds 1 test.
2023-12-20 17:04:29 +00:00
Gustl22 da0cd69659
Revert automated changes made to deprecated settings.gradle (plugins.each) (#140037)
Restore testing deprecated settings.gradle (plugins.each).

Updated presumably by accident in #83067

Split from #137115
See also https://github.com/flutter/flutter/pull/137115#issuecomment-1781909865
2023-12-20 15:45:08 +00:00