21267 Commits

Author SHA1 Message Date
Masatoshi Tsushima
0da8012cc7
Fix: Closing bottom sheet and removing FAB cause assertion failure (#128566)
Fixes #128562
2023-06-22 17:00:58 +00:00
Taha Tesser
2e05371c88
Add InputDecorationTheme.merge (#129011)
fixes [[Proposal] `InputDecorationTheme.merge()`](https://github.com/flutter/flutter/issues/125471)
2023-06-22 16:02:08 +00:00
Elias Yishak
18b94b7f57
Prevent crashes on range errors when selecting device (#129290)
Prevent the cli from crashing when a user selects a number that is not valid for `flutter run` device selection

Fixes issue:
- https://github.com/flutter/flutter/issues/129191

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2023-06-22 15:52:25 +00:00
Yegor
07772a3d23
[framework,web] add FlutterTimeline and semantics benchmarks that use it (#128366)
## FlutterTimeline

Add a new class `FlutterTimeline` that's a drop-in replacement for `Timeline` from `dart:developer`. In addition to forwarding invocations of `startSync`, `finishSync`, `timeSync`, and `instantSync` to `dart:developer`, provides the following extra methods that make is easy to collect timings for code blocks on a frame-by-frame basis:

* `debugCollect()` - aggregates timings since the last reset, or since the app launched.
* `debugReset()` - forgets all data collected since the previous reset, or since the app launched. This allows clearing data from previous frames so timings can be attributed to the current frame.
* `now` - this was enhanced so that it works on the web by calling `window.performance.now` (in `Timeline` this is a noop in Dart web compilers).
* `collectionEnabled` - a field that controls whether `FlutterTimeline` stores timings in memory. By default this is disabled to avoid unexpected overhead (although the class is designed for minimal and predictable overhead). Specific benchmarks can enable collection to report to Skia Perf.

## Semantics benchmarks

Add `BenchMaterial3Semantics` that benchmarks the cost of semantics when constructing a screen full of Material 3 widgets from nothing. It is expected that semantics will have non-trivial cost in this case, but we should strive to keep it much lower than the rendering cost. This is the case already. This benchmark shows that the cost of semantics is <10%.

Add `BenchMaterial3ScrollSemantics` that benchmarks the cost of scrolling a previously constructed screen full of Material 3 widgets. The expectation should be that semantics will have trivial cost, since we're just shifting some widgets around. As of today, the numbers are not great, with semantics taking >50% of frame time, which is what prompted this PR in the first place. As we optimize this, we want to see this number improve.
2023-06-21 21:37:02 +00:00
Pierre-Louis
28ca523ac2
Remove incorrect non-nullable assumption from ShapeDecoration.lerp (#129298)
Fixes https://github.com/flutter/flutter/issues/129299
2023-06-21 21:34:58 +00:00
Justin McCandless
16eb4f2c08
Gracefully handle negative position in getWordAtOffset (#128464)
Should fix an unreproducible crash in text editing and track it with an assertion.
2023-06-21 14:22:04 -07:00
Christopher Fujino
5cef69dd49
[flutter_tools] add a gradle error handler for could not open cache directory (#129222)
Works around part of https://github.com/flutter/flutter/issues/128866
2023-06-21 20:13:40 +00:00
Renzo Olivares
b36ef583fb
Selection area right click behavior should match native (#128224)
This change updates `SelectableRegion`s right-click gesture to match native platform behavior.

Before: Right-click gesture selects word at position and opens context menu (All Platforms)
After: 
- Linux, toggles context menu on/off, and collapses selection when click was not on an active selection (uncollapsed).
- Windows, Android, Fuchsia, shows context menu at right-clicked position (unless the click is at an active selection).
- macOS, toggles the context menu if right click was at the same position as the previous / or selects word at position and opens context menu.
- iOS, selects word at position and opens context menu.

This change also prevents the `copy` menu button from being shown when there is a collapsed selection (nothing to copy).

Fixes #117561
2023-06-21 19:32:04 +00:00
Elias Yishak
5d8cc978b9
Refactor Analytics global getter to point to context only (#129196)
Refactor the globals getter for `Analytics` to be in the context instead of having a default fallback. The current state of the tool creates a new instance every time `globals.analytics` was called

Addresses issue:
- https://github.com/flutter/flutter/issues/128535
2023-06-21 15:27:32 +00:00
LongCatIsLooong
04ff86f020
Relax OverlayPortal asserts (#129053)
Fixes https://github.com/flutter/flutter/issues/129025

Also 
- simplifies OverlayPortal code a bit and adds an assert.
-  `Tooltip` shouldn't rebuild when hiding/showing the tooltip
2023-06-21 02:40:48 +00:00
Andrew Kolos
e1e45ca37a
update resolution-aware asset docs links (#128769)
Updates some doc comment links.

Fixes https://github.com/flutter/flutter/issues/128139
2023-06-20 23:45:52 +00:00
Justin McCandless
40b4bc996c
Fix: Magnifier appears and won't dismiss (#128545)
Fixes a bug when tapping near certain TextFields.
2023-06-20 16:36:45 -07:00
Tae Hyung Kim
541fdd60d3
DecoratedSliver (#127823)
This is a second attempt to merge #107269. Currently I've fixed two of the issues:
1. Fixed horizontal scrollview by using a switch statement to consider vertical/horizontal case.
2. Fixed issue of `paintExtent` not being the right extent for painting. Rather using a `scrollExtent` for the main axis length of the decoration box and painting it offsetted by the `scrollOffset`.
3. If the sliver child has inifinite scrollExtent, then we only draw the decoration down to the bottom of the `cacheExtent`. The developer is expected to ensure that the border does not creep up above the cache area.

This PR includes a test that checks that the correct rectangle is drawn at a certain scrollOffset for both the horizontal and vertical case which should be sufficient for checking that `SliverDecoration` works properly now.

Fixes https://github.com/flutter/flutter/issues/107498.
2023-06-20 23:35:42 +00:00
Md. Yeasin Sheikh
b733901de1
fixed PreferredSize constuctor invocations (#128181)
This PR changes the `PreferredSize` constructor parameter positioning to cover the constructor invocations. It helps on auto-complete and suggestion. 

*List which issues are fixed by this PR. You must list at least one issue.*
Fixes #128178
2023-06-20 22:21:12 +00:00
Victoria Ashworth
25e98b54d7
Fix duplicate devices from xcdevice with iOS 17 (#128802)
This PR fixes issue of duplicate entries from `xcdevice list` cause devices to not show in `flutter devices`, `flutter run`, etc.

When a duplicate entry is found, use the entry without errors as the authority. If both have errors, use the one with the higher SDK as the authority.

Fixes https://github.com/flutter/flutter/issues/128719.
2023-06-20 18:16:27 +00:00
Chris Yang
fadcaee842
iOS info.plist template: make UIViewControllerBasedStatusBar to be true (#128970)
Now that we support UIViewControllerBasedStatusBar by default (after engine roll: c7167765d7), we should make this value to be true.

Part of https://github.com/flutter/flutter/issues/128969
2023-06-20 18:11:18 +00:00
Lau Ching Jun
3291750082
Use the new getIsolatePauseEvent method from VM service to check for pause event. (#128834)
The `getIsolate` method returns the full list of libraries which can be huge for large apps. Using the more speficic API to only fetch what we need improves hot reload performance.

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

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2023-06-20 16:42:28 +00:00
Swaroop S
80935ad984
Adding ScrollController support for Stepper widget (#128814)
This PR is to add **controller** property to the **Stepper** widget, so
that user has the flexibility to control the scroll offset for various
purposes(especially in case of scroll animations)!

Fixes #61207 

Co-authored-by: Taha Tesser <tessertaha@gmail.com>
2023-06-20 09:04:41 -07:00
Tae Hyung Kim
48ba9c4193
Refactor generate_localizations_test.dart (#128974)
The file was becoming harder to deal with as it manually sets up a /lib/l10n directory with a `MemoryFileSystem` in every single test. This PR wraps this process in a helper function `setupLocalizations` and also provides a helper function `getGeneratedFileContent` which helps fetch the respective output file given the locale string.
2023-06-20 15:42:22 +00:00
Leigha Jarett
b2c993cad3
Add to API docs to explain what Assist and Suggestion chips are (#129034)
Fixes https://github.com/flutter/flutter/issues/128028. 

It seems pretty straightforward so don't think it warrants the effort to add more samples.
2023-06-20 09:03:21 +00:00
Taha Tesser
467c970bfb
Introduce MaterialState color property for chips (#128584)
fixes https://github.com/flutter/flutter/issues/115827
fixes https://github.com/flutter/flutter/issues/101325

### Description
1. This PR adds a new MaterialState `color` property to all the chips (this makes it possible to customize chips in all states from the M3 specs).
2. Updated defaults to use the new  MaterialState `color` property.
3. Updated and added new tests to all the chip test classes.

<details> 
<summary>code sample</summary> 

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

const Color disabledColor = Colors.black26;
const Color backgroundColor = Colors.cyan;
final Color disabledSelectedColor = Colors.red.shade100;
const Color selectedColor = Colors.amber;
final MaterialStateProperty<Color> color =
    MaterialStateProperty.resolveWith((Set<MaterialState> states) {
  if (states.contains(MaterialState.disabled) &&
      states.contains(MaterialState.selected)) {
    return disabledSelectedColor;
  }
  if (states.contains(MaterialState.disabled)) {
    return disabledColor;
  }
  if (states.contains(MaterialState.selected)) {
    return selectedColor;
  }
  return backgroundColor;
});

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        useMaterial3: true,
        // chipTheme: ChipThemeData(color: color),
      ),
      home: const Example(),
    );
  }
}

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

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

class _ExampleState extends State<Example> {
  bool enabled = false;
  bool selected = true;

  @override
  Widget build(BuildContext context) {
    const Widget verticalSpace = SizedBox(height: 20);

    return Scaffold(
      body: Center(
        child: Column(
          children: <Widget>[
            const SizedBox(height: 25),
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: <Widget>[
                const Card(
                  elevation: 0.0,
                  color: disabledColor,
                  child: Padding(
                    padding: EdgeInsets.all(8.0),
                    child: Text('disabledColor'),
                  ),
                ),
                const Card(
                  elevation: 0.0,
                  color: backgroundColor,
                  child: Padding(
                    padding: EdgeInsets.all(8.0),
                    child: Text('backgroundColor'),
                  ),
                ),
                Card(
                  elevation: 0.0,
                  color: disabledSelectedColor,
                  child: const Padding(
                    padding: EdgeInsets.all(8.0),
                    child: Text('disabledSelectedColor'),
                  ),
                ),
                const Card(
                  elevation: 0.0,
                  color: selectedColor,
                  child: Padding(
                    padding: EdgeInsets.all(8.0),
                    child: Text('selectedColor'),
                  ),
                ),
              ],
            ),
            const Spacer(),
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceEvenly,
              children: <Widget>[
                Column(
                  mainAxisSize: MainAxisSize.min,
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    RawChip(
                      selected: selected,
                      selectedColor: selectedColor,
                      color: color,
                      label: const Text('RawChip'),
                      isEnabled: enabled,
                      onSelected: enabled ? (bool value) {} : null,
                    ),
                    verticalSpace,
                    InputChip(
                      isEnabled: enabled,
                      selected: selected,
                      selectedColor: selectedColor,
                      color: color,
                      label: const Text('InputChip'),
                      onSelected: enabled ? (bool value) {} : null,
                    ),
                  ],
                ),
                Column(
                  mainAxisSize: MainAxisSize.min,
                  children: <Widget>[
                    FilterChip(
                      selected: selected,
                      selectedColor: selectedColor,
                      color: color,
                      label: const Text('FilterChip'),
                      onSelected: enabled ? (bool value) {} : null,
                    ),
                    verticalSpace,
                    FilterChip.elevated(
                      selected: selected,
                      selectedColor: selectedColor,
                      color: color,
                      label: const Text('FilterChip.elevated'),
                      onSelected: enabled ? (bool value) {} : null,
                    ),
                  ],
                ),
                Column(
                  mainAxisSize: MainAxisSize.min,
                  children: <Widget>[
                    ChoiceChip(
                      selected: selected,
                      selectedColor: selectedColor,
                      color: color,
                      label: const Text('ChoiceChip'),
                      onSelected: enabled ? (bool value) {} : null,
                    ),
                    verticalSpace,
                    ChoiceChip.elevated(
                      selected: selected,
                      selectedColor: selectedColor,
                      color: color,
                      label: const Text('ChoiceChip.elevated'),
                      onSelected: enabled ? (bool value) {} : null,
                    ),
                  ],
                ),
              ],
            ),
            const Spacer(),
            Row(
              children: <Widget>[
                Flexible(
                  child: SwitchListTile(
                    title: const Text('Enabled'),
                    value: enabled,
                    onChanged: (bool value) {
                      setState(() => enabled = value);
                    },
                  ),
                ),
                Flexible(
                  child: SwitchListTile(
                    title: const Text('Selected'),
                    value: selected,
                    onChanged: (bool value) {
                      setState(() => selected = value);
                    },
                  ),
                ),
              ],
            )
          ],
        ),
      ),
    );
  }
}

``` 
	
</details>

### Before (not possible to customize disabled and selected chips)

![Screenshot 2023-06-13 at 16 27 13](https://github.com/flutter/flutter/assets/48603081/633f09f7-16a1-469e-b326-b9cc0ed59242)

### After (using disabled and selected chips using the new  MaterialState `color` property)

![Screenshot 2023-06-13 at 16 26 53](https://github.com/flutter/flutter/assets/48603081/7f5dffb7-4074-4268-87c0-c059c2da67a8)
2023-06-19 22:03:26 +00:00
Jason Simmons
03d50d1f8a
Fix an ordering dependency in the flutter_tools upgrade test (#129131)
Cache.flutterRoot is set within testUsingContext and will be
uninitialized the first time test suite setup is invoked.
2023-06-19 11:18:16 -07:00
Taha Tesser
165d237792
Fix InputDecoration.applyDefaults ignoring some properties (#129010)
fixes [`InputDecoration.applyDefaults` ignores some properties](https://github.com/flutter/flutter/issues/127330)

<details> 
<summary>code sample</summary> 

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(useMaterial3: true),
      home: const Example(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    const TextStyle textStyle = TextStyle(color: Color(0xFF00FFFF));
    const Color color = Color(0xFF00FF00);
    const InputBorder inputBorder = OutlineInputBorder(
      borderSide: BorderSide(
        color: Color(0xFF0000FF),
      ),
    );

    final InputDecoration appliedDefaults =
        const InputDecoration().applyDefaults(
      const InputDecorationTheme(
        labelStyle: textStyle,
        floatingLabelStyle: textStyle,
        helperStyle: textStyle,
        helperMaxLines: 2,
        hintStyle: textStyle,
        errorStyle: textStyle,
        errorMaxLines: 2,
        floatingLabelBehavior: FloatingLabelBehavior.never,
        floatingLabelAlignment: FloatingLabelAlignment.center,
        isDense: true,
        contentPadding: EdgeInsets.all(1.0),
        iconColor: color,
        prefixStyle: textStyle,
        prefixIconColor: color,
        suffixStyle: textStyle,
        suffixIconColor: color,
        counterStyle: textStyle,
        filled: true,
        fillColor: color,
        focusColor: color,
        hoverColor: color,
        errorBorder: inputBorder,
        focusedBorder: inputBorder,
        focusedErrorBorder: inputBorder,
        disabledBorder: inputBorder,
        enabledBorder: inputBorder,
        border: InputBorder.none,
        alignLabelWithHint: true,
        constraints: BoxConstraints(
            minWidth: 10, maxWidth: 20, minHeight: 30, maxHeight: 40),
      ),
    );

    return Scaffold(
      appBar: AppBar(
        title: const Text('InputDecoration().applyDefaults'),
      ),
      // Centered FilledButton.
      body: Center(
        child: SingleChildScrollView(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              ColoredBox(
                color: appliedDefaults.labelStyle.toString().contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.labelStyle.toString()),
              ),
              ColoredBox(
                color: appliedDefaults.floatingLabelStyle
                        .toString()
                        .contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.floatingLabelStyle.toString()),
              ),
              ColoredBox(
                color: appliedDefaults.helperStyle.toString().contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.helperStyle.toString()),
              ),
              ColoredBox(
                color: appliedDefaults.hintStyle.toString().contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.hintStyle.toString()),
              ),
              ColoredBox(
                color: appliedDefaults.errorStyle.toString().contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.errorStyle.toString()),
              ),
              ColoredBox(
                color: appliedDefaults.iconColor.toString().contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.iconColor.toString()),
              ),
              ColoredBox(
                color: appliedDefaults.prefixStyle.toString().contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.prefixStyle.toString()),
              ),
              ColoredBox(
                color:
                    appliedDefaults.prefixIconColor.toString().contains('null')
                        ? Colors.red
                        : Colors.green,
                child: Text(appliedDefaults.prefixIconColor.toString()),
              ),
              ColoredBox(
                color: appliedDefaults.suffixStyle.toString().contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.suffixStyle.toString()),
              ),
              ColoredBox(
                color:
                    appliedDefaults.suffixIconColor.toString().contains('null')
                        ? Colors.red
                        : Colors.green,
                child: Text(appliedDefaults.suffixIconColor.toString()),
              ),
              ColoredBox(
                color: appliedDefaults.counterStyle.toString().contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.counterStyle.toString()),
              ),
              ColoredBox(
                color: appliedDefaults.fillColor.toString().contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.fillColor.toString()),
              ),
              ColoredBox(
                color: appliedDefaults.focusColor.toString().contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.focusColor.toString()),
              ),
              ColoredBox(
                color: appliedDefaults.hoverColor.toString().contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.hoverColor.toString()),
              ),
              ColoredBox(
                color: appliedDefaults.errorBorder.toString().contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.errorBorder.toString()),
              ),
              ColoredBox(
                color: appliedDefaults.focusedBorder.toString().contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.focusedBorder.toString()),
              ),
              ColoredBox(
                color: appliedDefaults.focusedErrorBorder
                        .toString()
                        .contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.focusedErrorBorder.toString()),
              ),
              ColoredBox(
                color:
                    appliedDefaults.disabledBorder.toString().contains('null')
                        ? Colors.red
                        : Colors.green,
                child: Text(appliedDefaults.disabledBorder.toString()),
              ),
              ColoredBox(
                color: appliedDefaults.enabledBorder.toString().contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.enabledBorder.toString()),
              ),
              ColoredBox(
                color: appliedDefaults.border.toString().contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.border.toString()),
              ),
              ColoredBox(
                color: appliedDefaults.constraints.toString().contains('null')
                    ? Colors.red
                    : Colors.green,
                child: Text(appliedDefaults.constraints.toString()),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
``` 
	
</details>

### Before

![before screenshot](https://github.com/flutter/flutter/assets/48603081/ae564e15-4029-4feb-810f-e46b9312a257)

### After
![after screenshot](https://github.com/flutter/flutter/assets/48603081/8924a1d8-ffde-494b-bf44-66dab4d28845)
2023-06-19 07:06:19 +00:00
Polina Cherkasova
9690394772
Update objectToDiagnosticsNode to stop failing. (#129027)
Prerequisite for https://github.com/flutter/devtools/pull/5918
2023-06-16 19:39:54 +00:00
Christopher Fujino
3f68b25b46
[flutter_tools] fix cast error when dart-defines-json file includes null (#128909)
Fixes https://github.com/flutter/flutter/issues/128787
2023-06-16 18:12:22 +00:00
Danny Tuppeny
dc4541fa05
[flutter_tools] Add support for vmServiceFileInfo when attaching (#128503)
When building the new SDK DAPs, this functionality was missed from the Flutter adapter (but added to the Dart CLI adapter).

As well as passing a VM Service URI directly, we support passing a file that can be polled for it.

This uses the same mechanism we use to obtain the VM Service URI from a Dart debug session (we run `dart --write-service-info=foo.json my_file.dart` and then poll that file which the VM will write) and is useful for users that have their own mechanism for launching an app (for example using custom Flutter embedders - see https://github.com/Dart-Code/Dart-Code/issues/3353) to provide a VM Service URI once the app is up and running.

Fixes https://github.com/Dart-Code/Dart-Code/issues/4577.
2023-06-16 18:00:21 +00:00
Polina Cherkasova
7214cb28be
Accept Diagnosticable as input in inspector API. (#128962) 2023-06-16 10:45:34 -07:00
Michael Goderbauer
5ab5d82a39
Remove AbstractNode from RenderObject and deprecate it (#128973)
It's time to say good bye to an old friend. 
It has outlived its usefulness.
Farewell, AbstractNode! 🫡
2023-06-16 16:16:36 +00:00
Mouad Debbar
fc8856eb80
[web] Don't crash on const HtmlElementView() (#128965)
Previously, when the code contained `const HtmlElementView()` it would break even if it's guarded by `if (kIsWeb)`.

This PR makes it such that `const HtmlElementView()` is allowed but it still throws if it gets inserted into the widget tree by mistake on non-web platforms.

One improvement we can make in the future is to have a conditional import:
- `_html_element_view_web.dart` that contains the real `HtmlElementView` that can only be instantiated on web.
- `_html_element_view_io.dart` that contains a stub with an unimplemented `build()` method.

Fixes https://github.com/flutter/flutter/issues/43532
2023-06-16 13:53:05 +00:00
Polina Cherkasova
dd4a8150a8
Update getProperties to handle Diagnosticable as input. (#128897) 2023-06-15 17:04:46 -07:00
Dery Rahman Ahaddienata
6b5766d41e
Fix dart pub cache clean command on pub.dart (#128171)
Command instruction for clearing dart pub cache is somewhat wrong. Instead of `clear`, `clean` is the correct one. Ref: https://dart.dev/tools/pub/cmd/pub-cache

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

(Edited by @andrewkolos. Changed "related to" issue to "fixes" to link this PR to the issue).
2023-06-15 20:38:04 +00:00
Christopher Fujino
cc83f03822
[flutter_tools] Migrate more integration tests to process result matcher (#128737)
Part of https://github.com/flutter/flutter/issues/127135
2023-06-15 13:25:32 -07:00
Christopher Fujino
735fc29622
[flutter_tools] refactor license collector (#128748)
Improve debugging for https://github.com/flutter/flutter/issues/128680

In the linked issue, I cannot explain how we are getting a type error. However, this refactor eliminates the null check operator (by iterating over `MapEntries` rather than the keys) in hopes that there will be a more descriptive error in the future. The correctness of this change is verified by the existing tests in https://github.com/flutter/flutter/blob/master/packages/flutter_tools/test/general.shard/license_collector_test.dart
2023-06-15 20:25:19 +00:00
Qun Cheng
f8e8d89b85
Set Semantics.button to true for date widget (#128824)
Fixes #127863

This PR is to set `Semantics.button` to true for date widget in `DatePicker`.

https://github.com/flutter/flutter/assets/36861262/b366f25a-6bf3-4e3f-b944-ab71197b73e5
2023-06-15 20:13:07 +00:00
Qun Cheng
c3b2175a40
Update golden tests (#128914) 2023-06-15 13:09:43 -07:00
Ian Hickson
8c5a70f367
flutter update-packages --cherry-pick-package (#128917)
Fixes https://github.com/flutter/flutter/issues/101525
2023-06-15 19:26:53 +00:00
Mouad Debbar
a162d7546a
flutter update-packages --force-upgrade (#128908)
- Bumps `vm_service` from `11.6.0` to `11.7.1`
- Bumps `web` from `0.1.3-beta` to `0.1.4-beta` and adds it everywhere.
- Moves `js` from `dependencies` to `dev_dependencies`
2023-06-15 18:17:09 +00:00
Mouad Debbar
b0188cd182
[web] Pass creation params to the platform view factory (#128146)
This concludes step 1 of the `HtmlElementView` improvements. It's now possible to pass creation params to platform view factories directly from `HtmlElementView`.

Here's a sample app using a single factory to render platform views in different colors:

<details>
  <summary>Code sample</summary>
  
  ```dart
import 'dart:js_interop';
import 'dart:ui_web' as ui_web;
import 'package:flutter/material.dart';
import 'package:web/web.dart' as web;

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Platform View Demo',
      home: Scaffold(
        appBar: AppBar(
          title: Text('Platform View Demo'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: [
              BoxWrapper('red'),
              BoxWrapper(null),
              BoxWrapper('blue'),
            ],
          ),
        ),
      ),
    );
  }
}

bool isRegistered = false;

class BoxWrapper extends StatelessWidget {
  const BoxWrapper(this.cssColor);

  final String? cssColor;

  void register() {
    if (isRegistered) return;
    isRegistered = true;

    ui_web.platformViewRegistry.registerViewFactory('my-platform-view', (
      id, {
      Object? params,
    }) {
      params as String?;

      final element = web.document.createElement('div'.toJS) as web.HTMLElement;
      element.textContent = 'Platform View'.toJS;
      element.style
        ..lineHeight = '100px'.toJS
        ..fontSize = '24px'.toJS
        ..backgroundColor = (params ?? 'pink').toJS
        ..textAlign = 'center'.toJS;
      return element;
    });
  }

  @override
  Widget build(BuildContext context) {
    register();
    return SizedBox(
      width: 200,
      height: 100,
      child: Card(
        child: HtmlElementView(
          viewType: 'my-platform-view',
          creationParams: cssColor,
        ),
      ),
    );
  }
}
  ```
</details>

![image](https://github.com/flutter/flutter/assets/1278212/4b62ed8b-2314-49d6-9b4a-5da849bf2a48)

Depends on https://github.com/flutter/engine/pull/42255

Part of https://github.com/flutter/flutter/issues/127030
2023-06-15 18:00:25 +00:00
Christopher Fujino
3246808cd2
[flutter_tools] cache flutter sdk version to disk (#124558)
Fixes https://github.com/flutter/flutter/issues/112833

Most of the actual changes here are in [packages/flutter_tools/lib/src/version.dart](https://github.com/flutter/flutter/pull/124558/files#diff-092e00109d9e1589fbc7c6de750e29a6ae512b2dd44e85d60028953561201605), while the rest is largely just addressing changes to the constructor of `FlutterVersion` which now has different dependencies.

This change makes `FlutterVersion` an interface with two concrete implementations:

1. `_FlutterVersionGit` which is mostly the previous implementation, and
2. `_FlutterVersionFromFile` which will read a new `.version.json` file from the root of the repo

The [`FlutterVersion` constructor](https://github.com/flutter/flutter/pull/124558/files#diff-092e00109d9e1589fbc7c6de750e29a6ae512b2dd44e85d60028953561201605R70) is now a factory that first checks if `.version.json` exists, and if so returns an instance of `_FlutterVersionFromGit` else it returns the fallback `_FlutterVersionGit` which will end up writing `.version.json` so that we don't need to re-calculate the version on the next invocation.

`.version.json` will be deleted in the bash/batch entrypoints any time we need to rebuild he tool (this will usually be because the user did `flutter upgrade` or `flutter channel`, or manually changed the commit with git).
2023-06-15 00:20:30 +00:00
Arne Molland
6d2b5ea30e
Fix inconsistently suffixed macOS flavored bundle directory (#127997)
The current implementation of macOS flavor support (#119564) assumes a bundle directory that differs from both the iOS implementation and the official documentation. The [documentation](https://docs.flutter.dev/deployment/flavors) instructs developers to suffix their Xcode build configurations with `-<flavor>`, but the implementation assumes a space:

5fd9ef4240/packages/flutter_tools/lib/src/macos/application_package.dart (L174-L178)

Whereas the iOS implementation, which is the reference for the docs, assumes a `-<flavor>` suffix:

a257efc284/packages/flutter_tools/lib/src/ios/xcodeproj.dart (L482-L488)

This change replaces the empty space with the `-` character which is in line with the documentation and iOS implementation, as well as removing the sentence-casing applied to the flavor name; every bundle built with a flavor keeps the original flavor name in its filename.

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

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2023-06-14 23:43:17 +00:00
Qun Cheng
7d950864a1
Update golden tests for material (#128839) 2023-06-14 16:09:27 -07:00
Polina Cherkasova
ed3d46305c
Update getChildrenSummaryTree to handle Diagnosticable as input. (#128833) 2023-06-14 23:01:22 +00:00
Ian Hickson
d64332a0aa
Improve the error message for non-normalized constraints (#127906)
We probably added RenderBox.layout after this error was created and of course we weren't writing tests back then...
2023-06-14 22:50:33 +00:00
Ian Hickson
34f39a208e
ContextAction.isEnabled needs a context (#127721)
...and lots of things that fall out from that
2023-06-14 22:47:06 +00:00
LouiseHsu
4effd9c46f
Remove temporary default case for PointerSignalKind (#128900)
This PR cleans up some prep that was added as part of
https://github.com/flutter/flutter/pull/120731 which was done to unblock
https://github.com/flutter/engine/pull/39637
Since the work done in that PR was reverted, this should be removed.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.
2023-06-14 14:50:37 -07:00
Polina Cherkasova
d520b64c8c
Respect allowlisted count of leaks. (#128823)
Contributes to https://github.com/dart-lang/leak_tracker/issues/59
2023-06-14 14:34:56 -07:00
gmackall
944d6c8fef
Unpin flutter_plugin_android_lifecycle (#128898)
Unpins flutter_plugin_android_lifecycle where it is pinned. I then 
1. ran `flutter update-packages --force-upgrade` (but only committed the changes within `dev/integration_tests/gradle_deprecated_settings/`, which is where it had been pinned) 
2. followed by `./gradlew :generateLockfiles` from `dev/integration_tests/gradle_deprecated_settings/android/` (the lockfile was what was causing the CI dependency resolution failure, so this second step is the fix for that).

See the reason it was pinned: https://github.com/flutter/flutter/pull/121847#discussion_r1124797112 followed by the PR that pinned it: https://github.com/flutter/flutter/pull/122043

Fixes https://github.com/flutter/flutter/issues/122039
2023-06-14 20:58:37 +00:00
Mouad Debbar
95be76ab7e
[web] Migrate framework away from dart:html and package:js (#128580)
Use `package:web` and `dart:js_interop` instead.

Part of https://github.com/flutter/flutter/issues/127030
2023-06-14 17:43:39 +00:00
cruiser-baxter
52c4db8d33
Fixed slider value indicator not disappearing after a bit on desktop platform when slider is clicked not dragged (#128137)
In slider.dart within the _startInteraction method and within the below conditional.

"if (!_active && !hasFocus &&
_state.valueIndicatorController.status == AnimationStatus.completed)"

**Changed to:**

"f (!_active &&
_state.valueIndicatorController.status == AnimationStatus.completed)"
This allows the value indicator to disappear after a bit when clicked instead of dragged on Desktop platform. 

I also added a test in slider_test.dart to detect the bug if it ever returns.

Fixes https://github.com/flutter/flutter/issues/123313
2023-06-14 17:11:08 +00:00
Michael Goderbauer
16e6be8b39
Inline AbstractNode into SemanticsNode and Layer (#128467) 2023-06-14 09:36:41 -07:00