10931 Commits

Author SHA1 Message Date
Shanmugam
af61c6c73f
Support for dismissDirection property in SnackBarTheme (#139068)
This PR introduces a new feature that allows users to configure the 'dismissDirection' in SnackBarTheme. This enhancement provides users with the flexibility to set the 'dismissDirection' property in the ThemeData, rather than having to apply it each time when initializing a snack bar. This streamlines the process and makes it more convenient for users to manage and customize the behavior of snack bars within their applications.

Fixes #139012
2023-12-05 19:30:15 +00:00
Kate Lovett
404057061a
Removed deprecated NavigatorState.focusScopeNode (#139260)
Part of https://github.com/flutter/flutter/issues/139243

Deprecated in https://github.com/flutter/flutter/pull/109702

The replacement for focusScopeNode is focusNode.enclosingScope
2023-12-05 17:33:59 +00:00
Ian Hickson
12aa19873c
Remove stray print (#139550)
It's making the tests have a lot of logspam.
2023-12-05 17:26:56 +00:00
Greg Spencer
8ec4c59e55
Fix DropdownMenu throwing TextEditingController disposed error on select (#139385)
## Description

When a DropdownMenu exists within another menu and a MenuItem is selected, the `TextEditingController` of the DropdownMenu is used after it has been disposed.

This PR manages the local `TextController` instance better, making sure that the one used when building is the current one, and handling the case where the `controller` is set on the widget after initial creation.

Also, places where we were setting the text and selection separately were converted to use `TextEditingValue` and set the value atomically.

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

## Tests
 - Added tests (Created by @josh-burton  in https://github.com/flutter/flutter/pull/139268 - Thanks Josh!)
2023-12-05 01:39:29 +00:00
Greg Spencer
909e529e33
Convert some usage of RawKeyEvent, et al to KeyEvent (#139329)
## Description

This converts some uses of `RawKeyEvent` to `KeyEvent` in preparation for deprecating `RawKeyEvent`.

## Related Issues
 - https://github.com/flutter/flutter/issues/136419
2023-12-04 21:49:48 +00:00
hgraceb
5530c106a7
Optimize the display of the Overlay on the Slider (#139021)
## Description

Automatic focus request on Slider value change prevents Overlay from correctly handling hover events.

Fixes #139281

### Before

![slider3](https://github.com/flutter/flutter/assets/38378650/815e12a4-ccaf-4b99-8480-6cbdc97a91bd)

### After

![slider4](https://github.com/flutter/flutter/assets/38378650/473eca22-0308-4964-8368-b0c158ae30eb)
2023-12-04 21:30:07 +00:00
Anindya Chatterjee
3f1f0aa592
Enable TapRegion to detect all mouse button click (#136799)
With this PR, TapRegion would be able to detect any kind of mouse button
events. Earlier, TapRegion used to detect only left mouse button event.

Fixes #136706

## Pre-launch Checklist

- [x] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [x] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [x] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [x] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [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-04 12:32:21 -08:00
Bruno Leroux
b6fa041808
[l10n] Update Material shareButtonLabel (#138899)
## Description

This PR updates the Material label for the share option, currently it is "**Share...**" (the expected label on iOS), on Android it should be "**Share**".

Native Android TextField screenshot:

![Capture d’écran du 2023-11-20 17-19-02](https://github.com/flutter/flutter/assets/840911/6004b900-0ba4-441e-a814-4afd0c0e2fe2)

## Related Issue

Step 2 for https://github.com/flutter/flutter/issues/138728

## Tests

Adds 1 test.
2023-12-01 23:32:57 +00:00
Renzo Olivares
75011b252d
Add undoStackModifier to UndoHistory (#138674)
This change adds a feature to `UndoHistory` that allows the user to modify the value being pushed onto the undo stack.

This is used by the framework to ignore the composing region when pushing history entries to the Undo stack on Android. This is so an undo does not trigger an input connection restart by the Android TextInputPlugin, which occurs when the framework changes the composing region. This is also the native platform behavior observed in Google Keep app on Android, where doing an undo during composing reverts to the previous state but with composing inactive and a subsequent redo does not bring back the composing region.

Fixes #130881
Partial fix for #134398
2023-11-30 21:41:26 +00:00
xubaolin
d49dcaa697
Introduce multi-touch drag strategies for DragGestureRecognizer (#136708)
Fixes #11884

As #38926 pointed out, the current Flutter implementation of multi-finger drag behavior is different from iOS and Android.
This change introduces the `MultitouchDragStrategy` attribute, which implements the Android behavior and can be controlled through `ScrollBehavior`, while retaining the ability to extend iOS behavior in the future.
2023-11-30 09:22:19 +00:00
Taha Tesser
4648f54430
Fix chips onDeleted callback don't show the delete button when disabled (#137685)
fixes [Chips with `onDeleted` callback should show the delete button in the `disabled` state](https://github.com/flutter/flutter/issues/136638)

### 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> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            RawChip(
              avatar: const Icon(Icons.favorite_rounded),
              label: const Text('RawChip'),
              onSelected: null,
              isEnabled: false,
              onDeleted: () {},
            ),
            InputChip(
              avatar: const Icon(Icons.favorite_rounded),
              label: const Text('InputChip'),
              isEnabled: false,
              onPressed: null,
              onDeleted: () {},
            ),
            FilterChip(
              avatar: const Icon(Icons.favorite_rounded),
              label: const Text('FilterChip'),
              onSelected: null,
              onDeleted: () {},
            ),
          ],
        ),
      ),
    );
  }
}
```

</details>

| Before | After |
| --------------- | --------------- |
| <img src="https://github.com/flutter/flutter/assets/48603081/8bd458de-cfd2-44f0-a0dd-a8298938c61f" /> | <img src="https://github.com/flutter/flutter/assets/48603081/afca0684-b061-416b-b029-5316588c6888" /> |
2023-11-29 23:57:05 +00:00
Mitchell Goodwin
e84f1296ac
Refactor to use Apple system fonts (#137275)
Addresses #63507, and is a follow up to the engine PR https://github.com/flutter/engine/pull/46857

Changes the font family string when attempting to use Apple system fonts to the new proxies added by the engine. For the "Text" font this will be more secure in the future against possible changes to Apple's API. For the "Display" font, this will now work correctly when it didn't before.

I checked the letter spacing values against a native app for all font sizes between 17-28. I made a few adjustments to better match native, but especially for the "Text" font we were either really close, or close enough to not make a large breaking change to default fonts worth it.

| Before  | After |
| ------------- | ------------- |
| <img width="466" alt="Screenshot 2023-11-02 at 11 45 12 AM" src="https://github.com/flutter/flutter/assets/58190796/627ed8ac-d848-4f71-aa62-a467b8aac62d"> | <img width="383" alt="Screenshot 2023-11-02 at 11 46 25 AM" src="https://github.com/flutter/flutter/assets/58190796/9a502021-7d2b-4e14-98f1-86971b3830a5"> |

The smaller text in both the before and after should be the same. The large system font that Flutter used before was incorrect, which caused it to look more spread out. Now we use the correct font.
2023-11-29 21:03:32 +00:00
Michael Goderbauer
4f8a99147a
Dynamic view sizing (#138648)
Towards https://github.com/flutter/flutter/issues/134501.

This change is based on https://github.com/flutter/engine/pull/48090. It changes the `RenderView` to be dynamically sized based on its content if the `FlutterView` it is configured with allows it (i.e. the `FlutterView` has loose `FlutterView.physicalConstraints`). For that, it uses those `physicalConstraints` as input to the layout algorithm by passing them on to its child (after translating them to logical constraints via the device pixel ratio). The resulting `Size` that the `RenderView` would like to be is then communicated back to the engine by passing it to the `FlutterView.render` call.

Tests will fail until https://github.com/flutter/engine/pull/48090 has rolled into the framework.
2023-11-29 20:45:18 +00:00
yakagami
443d8617f7
add sourceTimeStamp to ScaleUpdateDetails (#135936)
This PR adds the ability to get the `sourceTimeStamp` from `ScaleUpdateDetails` in a `GestureScaleUpdateCallback` like so:

```dart
onScaleUpdate: (ScaleUpdateDetails details){
  print(details.sourceTimeStamp);
}
```

`sourceTimeStamp` is necessary when tracking velocity eg.

```dart
VelocityTracker tracker = VelocityTracker.withKind(PointerDeviceKind.touch);
///...
onScaleUpdate: (ScaleUpdateDetails details){
  tracker.addPosition(details.sourceTimeStamp!, details.focalPoint);
}
```

The docs say:

>Having both a pan gesture recognizer and a scale gesture recognizer is redundant; scale is a superset of pan. Just use the scale gesture recognizer.

Currently this is not entirely accurate, and should be fixed, as noted in https://github.com/flutter/flutter/issues/43833#issuecomment-548133779. This PR does not add `sourceTimeStamp` to `ScaleStartDetails` because it is more involved. Specifically, `ScaleStartDetails` can be created in `acceptGesture` which does not have access to the `PointerEvent` to get the `event.timeStamp` (54fa255432/packages/flutter/lib/src/gestures/scale.dart (L730C5-L730C5)).

fixes https://github.com/flutter/flutter/issues/135873. See also https://github.com/flutter/flutter/issues/43833 which added delta and https://github.com/flutter/flutter/issues/49025 which added `numPointers` to `ScaleUpdateDetails` for the reason given above. `sourceTimeStamp` should probably be added to `ScaleStartDetails` as well because it exists in `DragStartDetails` and therefore in `onPanStart`.

I am not sure how to add tests for this, any input about this PR would be appreciated.

- [] All existing and new tests are passing.
2023-11-29 20:09:21 +00:00
Greg Spencer
6295289163
Remove deprecated PlatformMenuBar.body (#138509)
Part of https://github.com/flutter/flutter/issues/139243

## Description

This removes the `PlatformMenuBar.body` attribute and constructor parameter, since its deprecation period has elapsed.

## Tests
 - No tests were using the deprecated attribute, so no tests were removed.

#FlutterDeprecations
2023-11-29 18:13:50 +00:00
Kate Lovett
8ba459ce9f
Update VelocityTracker (4) (#139166)
This updates the implementation to use the stopwatch from the Clock object and pipes it through to the TestWidgetsFlutterBinding so it will be kept in sync with FakeAsync.

Relands https://github.com/flutter/flutter/pull/138843 attempted to reland https://github.com/flutter/flutter/pull/137381 which attempted to reland #132291
Fixes https://github.com/flutter/flutter/issues/97761

1. The original change was reverted due to flakiness it introduced in tests that use fling gestures.
  * Using a mocked clock through the test binding fixes this now
2. It was reverted a second time because a change at tip of tree broke it, exposing memory leaks, but it was not rebased before landing. 
  * These leaks are now fixed
3. It was reverted a third time, because we were so excellently quick to revert those other times, that we did not notice the broken benchmark that only runs in postsubmit.
  * The benchmark is now fixed
2023-11-29 14:59:13 +00:00
Kate Lovett
133711ba9a
Analyze against using Stopwatches in the framework (#138507) 2023-11-29 08:49:35 -06:00
Fré Dumazy
1d4d002592
Improve documentation of CardTheme.shape (#139096)
The previous documentation did not point out the difference between the default corner radius for Material 2 and Material 3.

Fixes: https://github.com/flutter/flutter/issues/139093
2023-11-29 09:54:59 +00:00
Veli Bacik
c5328650f1
implemented leadingWidth and automaticallyImplyLeading options (#136165)
Before:
![Screenshot 2023-10-09 at 01 32 33](https://github.com/flutter/flutter/assets/17102578/cb90423c-8d8d-40d5-afd0-5aab23b9930b)

After:

![Screenshot 2023-10-09 at 01 33 01](https://github.com/flutter/flutter/assets/17102578/3ba84243-42b8-4e02-b064-70618e21a305)

![Screenshot 2023-10-09 at 01 32 49](https://github.com/flutter/flutter/assets/17102578/4f311d74-f6a8-4f32-9974-109bd7f55812)

Fixed #136164
2023-11-29 08:29:06 +00:00
Renzo Olivares
178130b169
TextField and TextFormField can use a MaterialStatesController (#133977)
This change adds support for a `MaterialStatesController` in `TextField` and `TextFormField`. With this change a user can listen to `MaterialState` changes in an input field by passing a `MaterialStatesController` to `TextField` or `TextFormField`.

Fixes #133273
2023-11-29 08:25:20 +00:00
Mateus Felipe C. C. Pinto
49632fc374
Provide parameter to Icon and IconThemeData for they to consider the context's text scaler (#135708)
Provide a parameter `applyTextScaling` to both `Icon` and `IconDataTheme`. When `true`, the context's `TextScaler` will apply it's `scale` method to the icon size.

Fixes #115466
2023-11-29 07:44:21 +00:00
LongCatIsLooong
075b9f763f
Update ButtonStyleButton.scaledPadding documentation. Migrate callers in flutter/flutter (#139014)
Fixes https://github.com/flutter/flutter/issues/138547. 

It makes more sense to me for the default padding values to use the scaled font sizes instead of the `textScaleFactor`.
2023-11-29 07:05:42 +00:00
Gregor Zurowski
352a06018f
Fix comment (#138973)
A documentation tiny fix of the comment for `WidgetsBindingObserver`.
2023-11-28 23:27:40 +00:00
yim
f3c84ce20f
Added some documentation for OverlayPortal (#138934)
Fixes: #138836 

Adds some comments to OverlayPortal to clarify its behavior.
2023-11-28 23:22:24 +00:00
Gabriel Tavares
66935a82e8
feature(table-widget): Added intrinsicHeight to TableCellVerticalAlignment enum. (#130264)
**What has been done?**
----------------------
Added new enumeration in `TableCellVerticalAlignment`, which sets the cell size to the same as the topmost cell. There are no noticeable problems in using it in all cells together, as there are in `TableCellVerticalAlignment.fill` which is made not to be used in all cells together because it has another purpose.

**Explanation of the logic**
----------------------
An assignment was made (which already existed in `TableCellVerticalAlignment.top; middle and bottom`) that assigns `rowHeight` the maximum double between the initialized height and the height of its child.

![image](https://github.com/flutter/flutter/assets/69699209/0fc9c168-5638-494b-aa0c-c579d0494c5e)

Basically, defining a minimum cell height based on its child, and letting each table row have its own height stipulated from the largest element, creating an `IntrinsicHeight` for TableCell automatically.

![image](https://github.com/flutter/flutter/assets/69699209/488b258a-3d25-4655-a9a0-381680468dec)

As the `TableCellVerticalAlignment` logic already provides for the use of the height of the largest cell in the row, it was possible to reuse this logic, and just not make the break statement that exists to fill in the calculation for `intrinsicHeight`.

Real example in an Android application after added enumeration
----------------------
![image](https://github.com/flutter/flutter/assets/69699209/51dce88d-f0f5-4644-942a-11ad218ffca0)

Opened issue
----------------------
FIX: #130261
2023-11-28 23:13:09 +00:00
LongCatIsLooong
f2b74725c5
Ensure Icon vertically centers its icon glyph. (#138937)
Fixes https://github.com/flutter/flutter/issues/138592. 

In an `Icon` widget if the icon font's body (ascender + descender) is larger than the font's units per em, the icon height reported by the text layout library will be larger than the specified font size. When that happens the icon glyph gets pushed towards the bottom because the `Icon` widget is wrapped in a fontSize x fontSize SizedBox and thus has a fixed height of fontSize px. This wasn't a problem for material icons because its UPEM == body.
2023-11-28 21:24:28 +00:00
Tirth
18b239fbde
Added keyboardType & textInputAction props to SearchBar, SearchAnchor & SearchAnchor.bar (#138553)
Added `keyboardType` & `textInputAction` props to `SearchBar`, `SearchAnchor` & `SearchAnchor.bar`

Fixes #138483
2023-11-28 18:38:55 +00:00
Jim Kalafut
89edac4041
Fix header formatting typo in PopupMenuButton docs (#139084)
I believe this was intended (in #128351) to be a heading, but currently in the [published docs](https://api.flutter.dev/flutter/material/PopupMenuButton-class.html) it is rendered as:

 ```
/// ## Updating to MenuAnchor
```
2023-11-28 18:01:07 +00:00
Kate Lovett
92ad558e25
Fix turbulence seed for all tests with ink sparkles (#138757)
Fixes https://github.com/flutter/flutter/issues/138753

This makes sure that InkSparkles are always fixed for testing rather than random.
2023-11-28 17:59:19 +00:00
Bruno Leroux
a28f4e3a6c
Fix textScalerOf and maybeTextScalerOf documentations (#139123)
## Description

This PR fixes an inversion on `MediaQuery.textScalerOf` and  `MediaQuery.maybeTextScalerOf `documentation.

## Related Issue

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

## Tests

Documentation only
2023-11-28 08:57:04 +00:00
neko-andrew
ad62645fce
Fix intrinsic width of input decorator (#138074)
Fix min intrinsic width of input decorator by removing left or right padding when `prefixIcon` or `suffixIcon` are used.

Fixes #137937.
2023-11-28 05:20:07 +00:00
hangyu
8d42987771
Record focus in route entry to move a11y focus to the last focused item (#135771)
issue: #97747 
engine pr:https://github.com/flutter/engine/pull/47114
2023-11-27 23:54:50 +00:00
Kallen Tu
4727627b49
Bump DartDoc to 8.0.0 (#139088)
Bumping DartDoc to 8.0.0. https://pub.dev/packages/dartdoc/changelog

Will be also removing the `@hideConstantImplementations` directive since
the behaviour is default now.
See issue https://github.com/dart-lang/dartdoc/issues/3564.

## Pre-launch Checklist

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

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat
2023-11-27 15:33:07 -08:00
Taha Tesser
397fd25be1
Add ability to customize NavigationBar indicator overlay and fix indicator shape for the overlay (#138901)
fixes [Provide ability to override `NavigationBar` indicator ink response overlay](https://github.com/flutter/flutter/issues/138850)
fixes [`NavigationBar.indicatorShape` is ignored, `NavigationBarThemeData.indicatorShape` is applied to the indicator inkwell](https://github.com/flutter/flutter/issues/138900)

### 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: Scaffold(
        bottomNavigationBar: NavigationBarExample(),
      ),
    );
  }
}

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

  @override
  State<NavigationBarExample> createState() => _NavigationBarExampleState();
}

class _NavigationBarExampleState extends State<NavigationBarExample> {
  int index = 0;

  @override
  Widget build(BuildContext context) {
    return NavigationBar(
      elevation: 0,
      overlayColor: const MaterialStatePropertyAll<Color>(Colors.transparent),
      // indicatorShape: RoundedRectangleBorder(
      //   borderRadius: BorderRadius.circular(4.0),
      // ),
      indicatorColor: Colors.transparent,
      selectedIndex: index,
      onDestinationSelected: (int index) {
        setState(() {
          this.index = index;
        });
      },
      destinations: const <Widget>[
        NavigationDestination(
          selectedIcon: Icon(Icons.home_filled),
          icon: Icon(Icons.home_outlined),
          label: 'Home',
        ),
        NavigationDestination(
          selectedIcon: Icon(Icons.favorite),
          icon: Icon(Icons.favorite_outline),
          label: 'Favorites',
        ),
      ],
    );
  }
}

```

</details>

### Before

#### Cannot override `NavigationBar` Indicator ink well overlay

![Screenshot 2023-11-22 at 18 22 48](https://github.com/flutter/flutter/assets/48603081/06f54335-71ee-4882-afb0-53b614933c38)

#### Indicator shape is ignored for the indicator overlay

![Screenshot 2023-11-22 at 15 29 52](https://github.com/flutter/flutter/assets/48603081/913e0f77-48f4-4c6e-87f3-52c81b78f3d9)

### After

#### Can use `NavigationBar.overlayColor` or `NavigationBarThemeData.NavigationBar` to override default indicator overlay

`overlayColor: MaterialStatePropertyAll<Color>(Colors.red.withOpacity(0.33)),`

![Screenshot 2023-11-22 at 18 22 08](https://github.com/flutter/flutter/assets/48603081/28badae4-a7c7-4bf0-8bcc-278a1f84729d)

`overlayColor: MaterialStatePropertyAll<Color>(Colors.transparent),`

![Screenshot 2023-11-22 at 18 22 25](https://github.com/flutter/flutter/assets/48603081/674b48b1-f66a-4d91-9f10-ad307416ac32)

#### Indicator shape is respected for the indicator overlay

![Screenshot 2023-11-22 at 15 30 36](https://github.com/flutter/flutter/assets/48603081/ae9a3627-787e-45ac-9319-2ea8ea1e6ae6)
2023-11-27 21:02:35 +00:00
chunhtai
d92d2c12b2
Fix SliverGrid garbage collection issue (#138915)
The code doesn't consider indices of children may not be continuous after rebuild.

fixes https://github.com/flutter/flutter/issues/138749
2023-11-23 19:47:36 +00:00
Qun Cheng
c7d4b32fdd
Update the default outline color for OutlinedButton (#138768)
Fix b/311343182

This is to update the default outline for `OutlinedButton`. When the button is focused, the outline color should be primary color.
2023-11-22 20:16:37 +00:00
Jackson Gardner
b186c69684
Revert "Reland VelocityTracker update (again)" (#138863)
Reverts flutter/flutter#138843

This has broken the Mac_ios microbenchmarks_ios. Example failure:
https://ci.chromium.org/ui/p/flutter/builders/prod/Mac_ios%20microbenchmarks_ios/9339/overview
2023-11-21 19:17:46 -08:00
Kate Lovett
3e4e280914
Reland VelocityTracker update (again) (#138843)
This updates the implementation to use the stopwatch from the Clock object and piping it through to the TestWidgetsFlutterBinding so it will be kept in sync with FakeAsync.

Relands https://github.com/flutter/flutter/pull/137381 which attempted to reland #132291
Fixes https://github.com/flutter/flutter/issues/97761

The original change was reverted due to flakiness it introduced in tests that use fling gestures.
* https://github.com/flutter/flutter/issues/135728

It was reverted again due to a change in the leak tracking tests that broke it.
2023-11-21 22:21:22 +00:00
Taha Tesser
ccc3622e17
Fix M3 Tabs Specs links (#138808)
fixes [Material 3 Tab Specs links are broken/outdated ](https://github.com/flutter/flutter/issues/138805)
2023-11-21 21:46:07 +00:00
Taha Tesser
e6d43ac6d4
Fix Chips with Tooltip throw an assertion when enabling or disabling (#138799)
fixes [Enabling or disabling a `Chip`/`RawChip` with a tooltip throws an exception](https://github.com/flutter/flutter/issues/138287) 

### 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) {
    bool isEnabled = true;

    return MaterialApp(
      home: Material(
        child: Center(
          child: StatefulBuilder(
              builder: (BuildContext context, StateSetter setState) {
            return Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                RawChip(
                  tooltip: 'This is a tooltip',
                  isEnabled: isEnabled,
                  label: const Text('RawChip'),
                  onPressed: isEnabled ? () {} : null,
                ),
                const SizedBox(height: 20),
                ElevatedButton(
                  onPressed: () {
                    setState(() {
                      isEnabled = !isEnabled;
                    });
                  },
                  child: Text('${isEnabled ? 'Disable' : 'Enable'} Chip'),
                )
              ],
            );
          }),
        ),
      ),
    );
  }
}
```

</details>
2023-11-21 17:00:06 +00:00
Mahdi Bagheri
1dafa400af
Added Features requested in #137530 (#137532)
This PR will add new parameters to `ExpansionTile` widget to manage `dense`, `visualDensity` and `enableFeedback` of the main ListTile.

Solves #137530 

It is not a breaking change.
2023-11-20 23:50:49 +00:00
Taha Tesser
fc917c7184
[Reland] Introduce AnimationStyle (#138721)
This PR introduces `AnimationStyle`, it is used to override default
animation curves and durations in several widgets.

fixes [Add the ability to customize MaterialApp theme animation
duration](https://github.com/flutter/flutter/issues/78372)
fixes [Allow customization of showMenu transition animation curves and
duration](https://github.com/flutter/flutter/issues/135638)
fixes [`AnimationStyle.noAnimation` needs to replace `AnimatedTheme`
with just `Theme` in the
`MaterialApp`](https://github.com/flutter/flutter/issues/138618)

Here is an example where popup menu curve and transition duration is
overridden:

```dart
          popUpAnimationStyle: AnimationStyle(
            curve: Easing.emphasizedAccelerate,
            duration: Durations.medium4,
          ),
```

Set `AnimationStyle.noAnimation` to disable animation.
```dart
    return MaterialApp(
      themeAnimationStyle: AnimationStyle.noAnimation,
```

## 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-11-20 15:24:41 -08:00
Bruno Leroux
1a9e866f69
Reland update bottom navigation bar test for m3 (#137998)
This is a reland of https://github.com/flutter/flutter/pull/136624 which was reverted because one new M3 golden test failed. The failure was related to the ink sparkle animation.

Ink sparkle is the M3 default animation, it does not play well with golden because it introduces an element of randomness.
One way to avoid this randomness is to use the `InkSparkle.constantTurbulenceSeedSplashFactory`.

This PR has two commits:
- the first one is the original PR (https://github.com/flutter/flutter/pull/136624).
- the second one updates the failing test using `InkSparkle.constantTurbulenceSeedSplashFactory`.
2023-11-20 22:18:38 +00:00
林洵锋
3c80df5040
Fix NoSplash not being disposed (#138542)
Fix https://github.com/flutter/flutter/issues/136441
2023-11-17 18:50:33 +00:00
auto-submit[bot]
0135a3310a
Reverts "Introduce AnimationStyle" (#138628)
Reverts flutter/flutter#137945
Initiated by: HansMuller
This change reverts the following previous change:
Original Description:
This PR introduces `AnimationStyle`, it is used to override default animation curves and durations in several widgets.

fixes  [Add the ability to customize MaterialApp theme animation duration](https://github.com/flutter/flutter/issues/78372)
fixes [Allow customization of showMenu transition animation curves and duration](https://github.com/flutter/flutter/issues/135638)

Here is an example where popup menu curve and transition duration is overriden:

```dart
          popUpAnimationStyle: AnimationStyle(
            curve: Easing.emphasizedAccelerate,
            duration: Durations.medium4,
          ),
```

Set `AnimationStyle.noAnimation` to disable animation.
```dart
    return MaterialApp(
      themeAnimationStyle: AnimationStyle.noAnimation,
```
2023-11-17 16:59:19 +00:00
Jason Simmons
d859865e34
Enable the silent flag for invalid string exceptions when building a TextSpan (#138564)
This error can occur in a release app (for example, if the text comes from user input that is not valid UTF-16).  In that case, TextSpan will replace the invalid text with a placeholder character.
2023-11-16 21:55:26 +00:00
Fedor Blagodyr
27394f6052
Fix sliver persistent header expand animation (#137913)
Added animation status check at showOnScreen method to prevent broken animation of expanding SliverAppBar when focusing EditableText

close #137901
2023-11-16 21:13:14 +00:00
Taha Tesser
19e284f88f
Introduce AnimationStyle (#137945)
This PR introduces `AnimationStyle`, it is used to override default animation curves and durations in several widgets.

fixes  [Add the ability to customize MaterialApp theme animation duration](https://github.com/flutter/flutter/issues/78372)
fixes [Allow customization of showMenu transition animation curves and duration](https://github.com/flutter/flutter/issues/135638)

Here is an example where popup menu curve and transition duration is overriden:

```dart
          popUpAnimationStyle: AnimationStyle(
            curve: Easing.emphasizedAccelerate,
            duration: Durations.medium4,
          ),
```

Set `AnimationStyle.noAnimation` to disable animation.
```dart
    return MaterialApp(
      themeAnimationStyle: AnimationStyle.noAnimation,
```
2023-11-16 18:33:20 +00:00
Bruno Leroux
dcdf72a670
[flutter_tools] - Add queries section to Android manifest file (#137207)
## Description

This PR adds a new section to the Android manifest file.
This section is required for https://github.com/flutter/engine/pull/44579 (because it uses `PackageManager.queryIntentActivities` API ), see:

1. https://developer.android.com/training/package-visibility?hl=en
2. https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT
3. https://developer.android.com/reference/android/content/pm/PackageManager?hl=en#queryIntentActivities(android.content.Intent,%20android.content.pm.PackageManager.ResolveInfoFlags)

## Related Issue

Android manifest update for https://github.com/flutter/flutter/issues/107603

## Tests

This PR updates the integration tests and examples Android manifest files, this will help catch error or warning related to this change.
2023-11-16 08:57:20 +00:00
Bernardo Ferrari
2afec776c9
Make UnderlineInputBorder consistent (#124153)
This was easy to implement. I like the result, I think `borderRadius.zero` -> `borderRadius.circular` makes a nice transition, and many places (like macOS) use an effect similar to this PR, while Google doesn't use anywhere (yet). I'm curious if it is going to break goldens or google testing.

<img width="954" alt="ttt" src="https://user-images.githubusercontent.com/351125/229918871-9f2ab851-6b41-44f5-80b9-c7928a8c0014.png">

What do you think? cc @HansMuller @gspencergoog. Is this something you want, should I ask the community, or do you prefer the current one?

Side effects:
- This makes strokeAlign work with `UnderlineInputBorder` (TODO: fix `drawLine` when borderRadius is zero).
- This is faster than the current implementation (clip is slow on Skia). 🚀 
- We could just call `BoxBorder._paintNonUniformBorder` (if it weren't private). Single LOC implementation.
- Web does this by default:
![image](https://user-images.githubusercontent.com/351125/233448671-90ce62ff-be91-40ca-8007-e82b57f3272e.png)
- Apparently no tests fail and most usages around (via code search) seem to be without a borderRadius.
2023-11-15 23:06:57 +00:00