23639 Commits

Author SHA1 Message Date
Jenn Magder
f33ffc00ea
Use Xcode build setting PRODUCT_NAME to find app and archive paths (#140242)
1. Instead of getting the `FULL_PRODUCT_NAME` Xcode build setting (`Runner.app`) instead use `PRODUCT_NAME` since most places really want the product name, and the extension stripping wasn't correct when the name contained periods.
2. Don't instruct the user to open the `xcarchive` in Xcode if it doesn't exist.

Fixes https://github.com/flutter/flutter/issues/140212
2024-07-22 23:54:24 +00:00
Andrew Kolos
ebe53d570a
Fix asset transformation in the presence of resolution-aware asset variants (#151932)
For the necessary background knowledge, see the flutter.dev content on [Resolution-aware image assets](https://docs.flutter.dev/ui/assets/assets-and-images#resolution-aware) and [Conditional bundling of assets based on app flavor](https://docs.flutter.dev/ui/assets/assets-and-images#conditional-bundling-of-assets-based-on-app-flavor) if you don't have a basic understanding of these features.

Fixes https://github.com/flutter/flutter/issues/151813 by using unique temporary directories, per asset file, for transformations. Currently, only a single directory is used and the name of the temporary files was based only on the basename of files. This means that `assets/image.png` and `assets/2x/image.png` would share an output path (`<temp dir path>/image.png`), causing a race. If this quick and rough explanation is a bit confusing, the original issue—#151813—provides a full repro and correct identification of the exact cause of the failure that can occur in the asset transformation process.
2024-07-22 23:46:19 +00:00
LongCatIsLooong
da0b9d55bb
material docImports (#152060)
https://github.com/flutter/flutter/issues/150800. I skipped files that contain generated code because the script isn't smart enough, and I did not fix some dubious comment refs. Those will be addressed in a different PR.
2024-07-22 20:50:50 +00:00
Sam Rawlins
f806a2ac64
Sort doc-imports according to the directives_ordering rule (#152058)
We're going to enforce sorting doc-imports with the same lint rule as
imports and exports: `directives_ordering`. These three locations need
sorting.

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-07-22 13:01:18 -07:00
Justin McCandless
bb8f6b04d5
Will pop scope on home route (#152057)
Fixes a bug where WillPopScope no longer worked on the home route.

With this PR, Android's predictive back feature will be explicitly disabled when a WillPopScope widget is in the widget tree. To get the same behavior and still support predictive back, use PopScope.
2024-07-22 10:06:55 -07:00
Polina Cherkasova
c9ee9ad616
Clean up leaky test. (#152094) 2024-07-22 09:53:40 -07:00
weasdown
76fcf3a33f
Fix missing close bracket in NestedScrollView class docs (#152022)
The [NestedScrollView class docs](https://api.flutter.dev/flutter/widgets/NestedScrollView-class.html) are currently missing a close bracket in the second paragraph (emphasis below is mine):
> The most common use case for this widget is a scrollable view with a flexible [SliverAppBar](https://api.flutter.dev/flutter/material/SliverAppBar-class.html) containing a [TabBar](https://api.flutter.dev/flutter/material/TabBar-class.html) in the header **(built by [headerSliverBuilder](https://api.flutter.dev/flutter/widgets/NestedScrollView/headerSliverBuilder.html)**, and with a [TabBarView](https://api.flutter.dev/flutter/material/TabBarView-class.html) in the [body](https://api.flutter.dev/flutter/widgets/NestedScrollView/body.html), such that the scrollable view's contents vary based on which tab is visible.

I've simply added the close bracket after "(built by [headerSliverBuilder](https://api.flutter.dev/flutter/widgets/NestedScrollView/headerSliverBuilder.html)" so the paragraph becomes:

> The most common use case for this widget is a scrollable view with a flexible [SliverAppBar](https://api.flutter.dev/flutter/material/SliverAppBar-class.html) containing a [TabBar](https://api.flutter.dev/flutter/material/TabBar-class.html) in the header (built by [headerSliverBuilder](https://api.flutter.dev/flutter/widgets/NestedScrollView/headerSliverBuilder.html)), and with a [TabBarView](https://api.flutter.dev/flutter/material/TabBarView-class.html) in the [body](https://api.flutter.dev/flutter/widgets/NestedScrollView/body.html), such that the scrollable view's contents vary based on which tab is visible.
2024-07-19 22:21:16 +00:00
Victor Sanni
5ef969a24f
Make CupertinoRadio's mouseCursor a WidgetStateProperty (#151910)
https://github.com/flutter/flutter/pull/149681 introduced `mouseCursor `to `CupertinoRadio` as a `MouseCursor` instead of a `WidgetStateProperty` to match Material Radio's `mouseCursor` property for `.adaptive`.

This PR changes `mouseCursor` to be of type `WidgetStateProperty<MouseCursor>` as per review comments in https://github.com/flutter/flutter/pull/151788#discussion_r1680538286.

PR bringing `mouseCursor` into `CupertinoRadio`: https://github.com/flutter/flutter/pull/149681.

Part of https://github.com/flutter/flutter/issues/58192
2024-07-19 21:01:10 +00:00
Jason Simmons
49a315284d
Handle a WebSocketException that may be thrown when closing the WebKit inspection protocol connection to Chrome (#151997)
Noticed this happening on macOS when the tool tries to shut down Chrome after all tabs have already been closed.
2024-07-19 17:58:26 +00:00
Michael Goderbauer
94de6fd6a8
docimports for rendering library (#151958)
Part of https://github.com/flutter/flutter/issues/150800.
2024-07-19 07:55:21 +00:00
Kevin Moore
74d6bd99b6
painting: drop deprecated (exported) hashList and hashValues functions (#151677)
These have been deprecated for over a year
Will remove from the engine once this PR lands

Towards https://github.com/flutter/flutter/issues/151679
2024-07-19 01:15:43 +00:00
n7484443
665d9e6e86
chore: fix test name & add description of tests (#151959)
https://github.com/flutter/flutter/pull/151364
I realized I made a mistake with my PR.
There are two missed description about test, one wrong test name.
So I correted that tests.
2024-07-18 23:23:05 +00:00
Renzo Olivares
93fd29455d
Fix SelectionArea scrolling conflicts (#151138)
Fixes #150897
2024-07-18 21:50:20 +00:00
Renzo Olivares
6e877226bf
Fix: BaseTapAndDragGestureRecognizer should reset drag state after losing gesture arena (#151989)
This PR properly resets the drag state when losing the gesture arena or when the recognizer stops tracking the current pointer. The _dragState enum was reset properly, but I had forgotten to also reset the `_start`, this caused an issue when the recognizer won the gesture arena the next time, as it tries to detect a drag given the old `_start` in `acceptGesture`, but the `_dragState` has been reset causing an assertion to trigger.
2024-07-18 21:01:25 +00:00
flutter-pub-roller-bot
a08d1bbdb8
Roll pub packages (#151975)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-07-18 20:15:21 +00:00
croro613
4590600365
Fix WidgetStateTextStyle's doc (#151935)
Fixes #151710
2024-07-18 19:43:05 +00:00
Nate Wilson
db80f4e713
WidgetState mapping (#146043)
This pull request implements [enhanced enum](https://dart.dev/language/enums#declaring-enhanced-enums) features for the new `WidgetState` enum, in order to improve the developer experience when creating and using `WidgetStateProperty` objects.

`WidgetState` now has a `.matchesSet()` method:

```dart
// identical to "states.contains(WidgetState.error)"
final bool hasError = WidgetState.error.isSatisfiedBy(states);
```

This addition allows for wide variety of `WidgetStateProperty` objects to be constructed in a simple manner.

<br><br>

```dart
// before
final style = MaterialStateTextStyle.resolveWith((states) {
  if (states.contains(MaterialState.error)) {
    return TextStyle(color: Colors.red);
  } else if (states.contains(MaterialState.focused)) {
    return TextStyle(color: Colors.blue);
  }
  return TextStyle(color: Colors.black);
});

// after
final style = WidgetStateTextStyle.fromMap({
  WidgetState.error:   TextStyle(color: Colors.red),
  WidgetState.focused: TextStyle(color: Colors.blue),
  WidgetState.any:     TextStyle(color: Colors.black), // "any" is a static const member, not an enum value
});
```

```dart
// before
final color = MaterialStateProperty.resolveWith((states) {
  if (states.contains(MaterialState.focused)) {
    return Colors.blue;
  } else if (!states.contains(MaterialState.disabled)) {
    return Colors.black;
  }
  return null;
});

// after
final color = WidgetStateProperty<Color?>.fromMap({
  WidgetState.focused:   Colors.blue,
  ~WidgetState.disabled: Colors.black,
});
```

```dart
// before
const activeStates = [MaterialState.selected, MaterialState.focused, MaterialState.scrolledUnder];

final color = MaterialStateColor.resolveWith((states) {
  if (activeStates.any(states.contains)) {
    if (states.contains(MaterialState.hovered) {
      return Colors.blueAccent;
    }
    return Colors.blue;
  }
  return Colors.black;
});

// after
final active = WidgetState.selected | WidgetState.focused | WidgetState.scrolledUnder;

final color = WidgetStateColor.fromMap({
  active & WidgetState.hovered: Colors.blueAccent,
  active:  Colors.blue,
  ~active: Colors.black,
});
```

<br>

(fixes #146042, and also fixes #143488)
2024-07-18 16:48:06 +00:00
Greg Price
af0e01c370
Fix AppBar doc to keep diagram next to its description (#151937)
Also swap two paragraphs to keep related content together.
2024-07-18 16:22:18 +00:00
Greg Price
caaff4b9b7
Small fixes to Image docs: NNBD, and add a cross-reference (#151938)
In particular, without this cross-reference it's easy for a reader
looking at [Image.frameBuilder] to think that the meanings of these
parameters just aren't properly documented.  (I had that thought for
a minute, before thinking *surely* they're documented, and then
trying the link to the typedef.)
2024-07-18 16:22:16 +00:00
flutter-pub-roller-bot
8c17a747c9
Roll pub packages (#151946)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-07-18 10:57:41 +00:00
Bruno Leroux
3acb13b911
Reland fix InputDecorator hint default text style on M3 (#150835)
## Description

This PR is a partial reland of https://github.com/flutter/flutter/pull/148944 which was reverted in https://github.com/flutter/flutter/pull/149448.
It makes the `InputDecoration.hintText` font style compliant with the M3 spec.

(First part of the reland was merged in https://github.com/flutter/flutter/pull/150278)

## Related Issue

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

## Tests

Updates several tests.
2024-07-17 21:48:29 +00:00
Victor Sanni
4d9c1682e4
Constrain CupertinoContextMenu animation to safe area (#151860)
## Before

https://github.com/user-attachments/assets/84b86117-3820-4ac6-a204-81b123e5e543

## After

https://github.com/user-attachments/assets/f3374e69-ea7a-4bbf-9c92-669d0520c922

Fixes https://github.com/flutter/flutter/issues/122951.
2024-07-17 21:28:06 +00:00
Qun Cheng
844eb2fe76
Create CarouselView widget - Part 2 (#149775)
This PR is to create `Carousel.weighted` so the size of each carousel item is based on a list of weights. While scrolling, item sizes are changing dynamically based on the scrolling progress.

https://github.com/flutter/flutter/assets/36861262/181472b0-6f8b-48e7-b191-ab5f7c88c0c8
2024-07-17 19:56:01 +00:00
LongCatIsLooong
1f489de409
Make CupertinoSlidingSegmentedControl type parameter non-null (#151803)
`null` is reserved for when there is no selected segment.
2024-07-17 17:55:13 +00:00
hgraceb
46cb56d313
Remove redundant assignment of geometry (#151821)
Remove redundant assignment of geometry.
2024-07-17 16:34:53 +00:00
flyboy
0a1d550e5f
Add ListTileControlAffinity to ListTileTheme (#150695)
fixes https://github.com/flutter/flutter/issues/146414

--- 

I saw @abikko submitted a PR https://github.com/flutter/flutter/pull/146630, but it was not completed due to CLA and lack of test cases.
I am willing to complete this PR in combination with @abikko's code (I don't know if this is allowed) 

 This PR adds contorlAffinity to ListTileTheme so that [CheckboxListTile], [RadioListTile], [SwitchListTile], and [ExpansionTile] can read and use it 

 For example: If ListTileTheme in Theme sets contorlAffinity, then [CheckboxListTile] can directly use contorlAffinity in ListTileTheme. Of course, if contorlAffinity is also set in [CheckboxListTile], the property in [CheckboxListTile] will be used first.
2024-07-17 14:06:13 +00:00
Sam Rawlins
e497ed7db0
Remove unnecessary parens in test (#151846)
In order to address [a bug in `unnecessary_parenthesis`](https://github.com/dart-lang/linter/issues/3046), we are reporting a few more cases in `unnecessary_parenthesis`. `a = (b = c)` is one such case. This change is being made in https://dart-review.googlesource.com/c/sdk/+/366891.
2024-07-17 09:54:34 +00:00
flutter-pub-roller-bot
38cad013e0
Roll pub packages (#151864)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-07-17 09:50:09 +00:00
Tong Mu
de04c13fdb
[CupertinoActionSheet] Support legacy buttons (#151136)
Fixes https://github.com/flutter/flutter/issues/150980

This PR allows buttons implemented with `GestureDetector.onTap` to be selected in the action sheet.
2024-07-17 05:09:24 +00:00
Tong Mu
f50feec5be
[CupertinoActionSheet] Add haptic feedback (#151420)
This PR implements the behavior of native action sheets that produces haptic feedback when the user slides into a button.
2024-07-17 04:57:26 +00:00
Kevin Moore
83bfab5376
flutter_tool: DRY up arg helpers, use new typed arg functions (#151784) 2024-07-17 04:01:28 +00:00
Gray Mackall
8c5fbb4021
Remove conditionality in templates that was for AGP <= 4.2 support (#151845)
Not needed after https://github.com/flutter/flutter/pull/149204 (as long as nothing has changed since the comment was made 🙂).

Fixes https://github.com/flutter/flutter/issues/145105.
2024-07-16 22:33:24 +00:00
n7484443
6e189a7452
chore: fix typo korean, cutButtonLabel (#151364)
[Wikipeidia](https://ko.wikipedia.org/wiki/%EC%9E%98%EB%9D%BC%EB%82%B4%EA%B8%B0,_%EB%B3%B5%EC%82%AC,_%EB%B6%99%EC%97%AC%EB%84%A3%EA%B8%B0)
In korea, we use '잘라내기', '복사', '붙여넣기', not '잘라냄', '복사', '붙여넣기'.

![image](https://github.com/flutter/flutter/assets/7384324/34845c96-4e7a-4f95-a44c-19f9917f4a6c)
e.g.) korean translation site, papago 

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [x] All existing and new tests are passing.
2024-07-16 15:29:43 -07:00
John Stef
aed548992a
Add borderRadius property to PopupMenuButton (#151228)
This PR is adding borderRadius property to PopupMenuButton. PopupMenuButton has a child wrapped in an InkWell widget where as of right now you can't customize it's border radius resulting in wrong splash effect when the child has border radius.

Fixes: #151227 

https://github.com/flutter/flutter/assets/20647774/93feb0a4-c4ff-4059-bde2-e59c4d35e2b6
2024-07-16 20:27:11 +00:00
Taha Tesser
e1cd7b11f6
Introduce Switch.padding (#149884)
fixes [Switch has some padding that leads to uncentered UI](https://github.com/flutter/flutter/issues/148498)

### Code sample

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

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              ColoredBox(
                color: Colors.amber,
                child: Switch(
                  padding: EdgeInsets.zero,
                  value: true,
                  materialTapTargetSize: MaterialTapTargetSize.padded,
                  onChanged: (bool value) {},
                ),
              ),
              const SizedBox(height: 16),
              ColoredBox(
                color: Colors.amber,
                child: Switch(
                  value: true,
                  materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
                  onChanged: (bool value) {},
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
```

</details>

### Default Switch size

<img width="476" alt="Screenshot 2024-07-11 at 13 25 05" src="https://github.com/flutter/flutter/assets/48603081/f9f3f6c6-443d-4bd5-81d4-5e314554b032">

### Update Switch size using the new `Switch.padding` to address  [Switch has some padding that leads to uncentered UI](https://github.com/flutter/flutter/issues/148498)

<img width="476" alt="Screenshot 2024-07-11 at 13 24 40" src="https://github.com/flutter/flutter/assets/48603081/aea0717b-e852-4b8d-b703-c8c4999d4863">
2024-07-16 20:25:09 +00:00
Victor Sanni
b9e4416ad3
Add semanticLabel to CupertinoCheckbox (#151789) 2024-07-16 17:47:18 +00:00
Victor Sanni
cb4ba2fddc
Add example for CupertinoCheckbox (#151779) 2024-07-16 16:54:02 +00:00
flutter-pub-roller-bot
bed034add2
Roll pub packages (#151816)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-07-16 12:34:24 +00:00
arbaker2
30bf2888b9
Add support for inverting CircularNotchedRectangle to optionally be drawn on the bottom of a path (#151386)
This PR allows for an optional argument [inverted[ to be passed to the [getOuterPath] method of a CircularNotchedRectangle object in order to invert the notch for situations where it is desired to draw the notch on the bottom of the path. This allows both of the below paths in the below screenshot to be drawn and changes no default behavior. 

![Simulator Screenshot - iPhone 15 - 2024-07-07 at 11 46 12](https://github.com/flutter/flutter/assets/71237742/57c1370d-19dd-4f65-aa85-f15723a4843b)

*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.*
This add a feature similar to the one discussed in #49973, original feature proposal #151381

*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-07-15 22:08:21 +00:00
auto-submit[bot]
7cdc23b3e1
Reverts "Launch DDS from Dart SDK and prepare to serve DevTools from DDS (#146593)" (#151781)
Reverts: flutter/flutter#146593
Initiated by: zanderso
Reason for reverting: Consistently failing `Windows_android native_assets_android` as in https://ci.chromium.org/ui/p/flutter/builders/prod/Windows_android%20native_assets_android/2533/overview 
Original PR Author: bkonyi

Reviewed By: {christopherfujino, kenzieschmoll}

This change reverts the following previous change:
This change is a major step towards moving away from shipping DDS via Pub.

The first component of this PR is the move away from importing package:dds to launch DDS. Instead, DDS is launched out of process using the `dart development-service` command shipped with the Dart SDK. This makes Flutter's handling of DDS consistent with the standalone Dart VM.

The second component of this PR is the initial work to prepare for the removal of instances of DevTools being served manually by the flutter_tool, instead relying on DDS to serve DevTools. This will be consistent with how the standalone Dart VM serves DevTools, tying the DevTools lifecycle to a live DDS instance. This will allow for the removal of much of the logic needed to properly manage the lifecycle of the DevTools server in a future PR. Also, by serving DevTools from DDS, users will no longer need to forward a secondary port in remote workflows as DevTools will be available on the DDS port.

There's two remaining circumstances that will prevent us from removing DevtoolsRunner completely:

 - The daemon's `devtools.serve` endpoint
 - `flutter drive`'s `--profile-memory` flag used for recording memory profiles

This PR also includes some refactoring around `DebuggingOptions` to reduce the number of debugging related arguments being passed as parameters adjacent to a `DebuggingOptions` instance.
2024-07-15 19:55:18 +00:00
Ben Konyi
f023430859
Launch DDS from Dart SDK and prepare to serve DevTools from DDS (#146593)
This change is a major step towards moving away from shipping DDS via
Pub.

The first component of this PR is the move away from importing
package:dds to launch DDS. Instead, DDS is launched out of process using
the `dart development-service` command shipped with the Dart SDK. This
makes Flutter's handling of DDS consistent with the standalone Dart VM.

The second component of this PR is the initial work to prepare for the
removal of instances of DevTools being served manually by the
flutter_tool, instead relying on DDS to serve DevTools. This will be
consistent with how the standalone Dart VM serves DevTools, tying the
DevTools lifecycle to a live DDS instance. This will allow for the
removal of much of the logic needed to properly manage the lifecycle of
the DevTools server in a future PR. Also, by serving DevTools from DDS,
users will no longer need to forward a secondary port in remote
workflows as DevTools will be available on the DDS port. This code is currently 
commented out and will be enabled in a future PR.

There's two remaining circumstances that will prevent us from removing
DevtoolsRunner completely:

 - The daemon's `devtools.serve` endpoint
- `flutter drive`'s `--profile-memory` flag used for recording memory
profiles

This PR also includes some refactoring around `DebuggingOptions` to
reduce the number of debugging related arguments being passed as
parameters adjacent to a `DebuggingOptions` instance.
2024-07-15 14:08:31 -04:00
Kevin Moore
ec16c86972
tool/build/web: move source-maps CLI flag to "general" web section (#151722)
...now that wasm supports source maps (see https://github.com/flutter/flutter/pull/151643)
2024-07-15 14:17:39 +00:00
Taha Tesser
9e88446f89
Fix Slider thumb doesn't align with divisions, thumb padding, and rounded corners (#149594)
fixes [[Slider] Thumb's center doesn't align with division's center](https://github.com/flutter/flutter/issues/62567)
fixes [Slider thumb doesn't respect round slider track shape](https://github.com/flutter/flutter/issues/149591)
fixes [`RoundedRectSliderTrackShape` corners are not rendered correctly](https://github.com/flutter/flutter/issues/149589)

(Verified these behaviors with Android components implementation)

### Code sample

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

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

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

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

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

class _MyAppState extends State<MyApp> {
  double _value = 5.0;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        sliderTheme: const SliderThemeData(
          trackHeight: 32,
          thumbColor: Colors.green,
          activeTrackColor: Colors.deepPurple,
          inactiveTrackColor: Colors.amber,
        ),
      ),
      home: Scaffold(
        body: Slider(
          value: _value,
          // divisions: 10,
          // ignore: avoid_redundant_argument_values
          min: 0,
          max: 10,
          onChanged: (double value) {
            setState(() {
              _value = value;
            });
          },
        ),
      ),
    );
  }
}
```

</details>

### Description
This PR fixes several core `Sliders` issues which are apparent in https://github.com/flutter/flutter/pull/147783. As a result, fixing the these bugs will unblock it.

### 1. Fixes the thumb doesn't align with `Slider` divisions.

![Group 8](https://github.com/flutter/flutter/assets/48603081/9aa138ae-9525-4af4-8fc7-3cea0692a6d7)

![Group 9](https://github.com/flutter/flutter/assets/48603081/e97940ae-a1c8-4b8b-9971-1cf417d32e40)

### 2.  Fixes `RoundedRectSliderTrackShape` corners are not rendered correctly.

![Group 10](https://github.com/flutter/flutter/assets/48603081/ed20a6bb-d5c9-486b-a020-2c9ca7de55da)

### 3.  Fixes round track shape corners when the thumb is at the start or end of the round track shape.

![Group 4](https://github.com/flutter/flutter/assets/48603081/37a2e820-402d-4964-a206-717ccf1c5c02)

![Group 3](https://github.com/flutter/flutter/assets/48603081/5d36d523-5fb7-466f-9d53-b6928963fcab)

![Group 7](https://github.com/flutter/flutter/assets/48603081/8f3b4c48-f04d-4681-a62f-a7ea5a3e19fa)
2024-07-15 07:09:09 +00:00
Martin Kustermann
ee7e5ec275
Emit source maps for wasm in flutter build web --wasm (#151643)
This will make

* `flutter run` have source maps enabled by default
* `flutter build` have source maps disabled by default

which mirrors what happens already today with the js compilers.

For local development this works quite well - even better than with
dart2js (see dart2js issues in [0]).
We do have some follow-up items for source maps in dart2wasm compiler,
see [1]

[0]
[flutter/flutter/issues/151641](https://github.com/flutter/flutter/issues/151641)
[1]
[dart-lang/sdk/issues/56232](https://github.com/dart-lang/sdk/issues/56232)
2024-07-13 10:24:16 +02:00
Daco Harkes
da48b34f50
[native_assets] Roll deps (#151662)
Roll deps to address:

* https://github.com/dart-lang/native/issues/1256

Cross-linking Dart standalone CL: https://dart-review.googlesource.com/c/sdk/+/375461 (no breaking API changes)
2024-07-13 05:37:24 +00:00
Daco Harkes
607190448b
[native_assets] Don't auto-roll deps (#151636)
Stop trying to roll the dependencies for native assets automatically.

They are under active development (pre 1.0.0), and have frequent breaking changes. I'll be rolling these manually.
(We have the same setup in the Dart SDK, not auto-rolling dart-lang/native via DEPS.)

Related comment:

* https://github.com/flutter/flutter/pull/151539#issuecomment-2221134824
2024-07-12 18:55:57 +00:00
Chris Bracken
68f375fe38
[macOS] support secure restorable state by default (#151605)
By default, Flutter apps only do default AppKit app serialisation of
Window location etc. and by default, state serialisation in AppKit apps
is compatible with `NSSecureCoding`. AppKit apps generated since Xcode
13.2 include this method in the app delegate generated by the default
app template.

Background
==========

This method was added to opt into having [de]serialization require a
coder implementing the `NSSecureCoding` protocol. Apple wasn't able to
force this across the board, because `NSSecureCoding` limits certain
behaviours during deserialisation, which some third-party apps have have
previously relied on.

Specific background on the sorts of vulnerabilities that
`NSSecureCoding` was designed to prevent are described in the
`NSSecureCoding` documentation:

https://developer.apple.com/documentation/foundation/nssecurecoding?language=objc

A demonstration of a root privilege escalation and SIP bypass
vulnerability is described in the following blog post:
https://sector7.computest.nl/post/2022-08-process-injection-breaking-all-macos-security-layers-with-a-single-vulnerability/

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

## Pre-launch Checklist

- [X] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [X] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [X] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [X] I signed the [CLA].
- [X] I listed at least one issue that this PR fixes in the description
above.
- [X] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [X] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [X] All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel
on [Discord].

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview
[Tree Hygiene]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md
[test-exempt]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes
[Discord]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md
[Data Driven Fixes]:
https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
2024-07-12 11:08:26 -07:00
Bruno Leroux
bf6c455d4a
Update obsolete comment in InputDecorator test (#151651)
Update one comment which is obsolete since https://github.com/flutter/flutter/pull/146754
2024-07-12 13:23:03 +00:00
Taha Tesser
de2dbf4eae
Fix TabBar tab indicator stretch effect (#150868)
fixes [[Material3] TabBar indicator stretch effect behaving weirdly with long tabs](https://github.com/flutter/flutter/issues/149662)

This PR fixes the tab indicator stretch effect, it currently stretches from both sides.  After the fix, tab indicator stretches depending on next size of the indicator and direction of the scroll.

The fix is based on Android Components implementation of the elastic/stretch effect.

20f92dfb51/lib/java/com/google/android/material/tabs/ElasticTabIndicatorInterpolator.java (L46-L78)

### Code sample

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

```dart
import 'package:flutter/gestures.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(
      home: ScrollConfiguration(
        behavior: ScrollConfiguration.of(context)
            .copyWith(dragDevices: <PointerDeviceKind>{
          PointerDeviceKind.touch,
          PointerDeviceKind.mouse,
        }),
        child: DefaultTabController(
          length: 8,
          child: Scaffold(
            appBar: AppBar(
              bottom: const TabBar(
                isScrollable: true,
                tabAlignment: TabAlignment.start,
                tabs: <Widget>[
                  Tab(text: 'Home'),
                  Tab(text: 'Search'),
                  Tab(text: 'Add'),
                  Tab(text: 'Favorite'),
                  Tab(text: 'The longest text...'),
                  Tab(text: 'Short'),
                  Tab(text: 'Longer text...'),
                  Tab(text: 'Profile'),
                ],
              ),
            ),
            body: const TabBarView(
              children: <Widget>[
                Center(child: Text('Page')),
                Center(child: Text('Page')),
                Center(child: Text('Page')),
                Center(child: Text('Page')),
                Center(child: Text('Page')),
                Center(child: Text('Page')),
                Center(child: Text('Page')),
                Center(child: Text('Page')),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
```

</details>

### Before

https://github.com/flutter/flutter/assets/48603081/618d0ba9-40a5-458f-9fdc-5330505a6711

### After

https://github.com/flutter/flutter/assets/48603081/b7fa851e-e7a6-4b66-b77d-f88c7f4381da
2024-07-12 09:37:29 +00:00
Martin Kustermann
0c21fbc582
Remove workaround for a bug in dart2wasm (#151603)
The bug in dart2wasm that required this workaround should be fixed now.

Issue https://github.com/dart-lang/sdk/issues/56129
2024-07-12 08:54:23 +02:00