14260 Commits

Author SHA1 Message Date
LongCatIsLooong
2d3697216b
Turn brieflyShowPassword back on on iOS (#157466)
Fixes https://github.com/flutter/flutter/issues/115359

This patch should restore the `brieflyShowPassword` behavior on iOS before https://github.com/flutter/flutter/pull/104335.

On iOS new characters are still temporarily revealed if the user is entering using the software keyboard (potentially because it's easy to fat finger using on screen keyboards?).
2024-10-23 23:22:15 +00:00
Elliott Brooks
802bae0111
Allow requesting a reduced widget tree with getRootWidgetTree service extension (#157309) 2024-10-23 12:30:55 -07:00
Bruno Leroux
b9c889d7d0
Reland "Fix TextField selects all content after the application is resumed" (#157399)
## Description

Relands https://github.com/flutter/flutter/pull/156968 wich was reverted in https://github.com/flutter/flutter/pull/157378 

This PR makes `EditableText` aware of the lifecycle 'resumed' state to let the current selection unchanged when the application is resumed (on web and desktop, 'resumed' means the Flutter app window regained focus).

Before this PR, on web and desktop, the whole content of a `TextField` was selected whenever a `TextField` gained focus. This is the correct behavior when tabbing between fields but it is not when a field regains focus after the application is resumed 

## Related Issue

Fixes [When switching to another browser tab or window and then going back, all text on TextField is selected automatically](https://github.com/flutter/flutter/issues/156078).

## Tests

Adds 1 test.
2024-10-23 15:13:35 +00:00
Polina Cherkasova
9441f8f6c8
Upgrade leak tracker. (#157369) 2024-10-23 00:42:28 +00:00
Nate Wilson
ea0fda51ef
WidgetStateInputBorder (#157190)
**Changes**
- Add `WidgetStateInputBorder` class, with `.resolveWith()` and `.fromMap()` constructors
- Deprecate `MaterialStateOutlineInputBorder` and `MaterialStateUnderlineInputBorder` and provide data-driven fixes

<br>

**Other changes** based on https://github.com/flutter/flutter/pull/154972#pullrequestreview-2344092821
- Fix documentation copy-paste typo ("OutlinedBorder" → "InputBorder")
- Add test to ensure borders are painted correctly
- Add DartPad sample & relevant test
2024-10-22 23:45:41 +00:00
Loïc Sharma
b2026572db
Add example to Directionality docs (#157230) 2024-10-22 22:20:02 +00:00
Loïc Sharma
bfdb366b50
Add example to ClipOval docs (#157227) 2024-10-22 22:20:00 +00:00
Loïc Sharma
945067ae91
Remove duplicated widget of the week video embed (#157299)
The `ScaffoldMessenger` widget embeds its widget of the week video twice: https://main-api.flutter.dev/flutter/material/ScaffoldMessenger-class.html
2024-10-22 20:34:24 +00:00
auto-submit[bot]
60d4c9b741
Reverts "Fix TextField selects all content after the application is resumed (#156968)" (#157378)
Reverts: flutter/flutter#156968
Initiated by: jacobsimionato
Reason for reverting: Google3 roll failing - see b/375019489
Original PR Author: bleroux

Reviewed By: {justinmc, gspencergoog}

This change reverts the following previous change:
## Description

This PR makes `EditableText` aware of the lifecycle 'resumed' state to let the current selection unchanged when the application is resumed (on web and desktop, 'resumed' means the Flutter app window regained focus).

Before this PR, on web and desktop, the whole content of a `TextField` was selected whenever a `TextField` gained focus. This is the correct behavior when tabbing between fields but it is not when a field regains focus after the application is resumed 

## Related Issue

Fixes [When switching to another browser tab or window and then going back, all text on TextField is selected automatically](https://github.com/flutter/flutter/issues/156078).

## Tests

Adds 1 test.
2024-10-22 19:59:22 +00:00
João Victor Schramm
1d5087eb30
fix: CupertinoDatePicker.DateAndTime using showDayOfWeek (#155260)
As mentioned in the issue https://github.com/flutter/flutter/issues/153576, even if we declare the 'showDayOfWeek' value as false, when using the mode CupertinoDatePickerMode.dateAndTime, the days of week still shows in the screen.

This PR is about making an assert that prevent developers from using `DateTimePicker.DateAndTime` with `showDayOfWeek` as false (because it only works on date mode) as suggested by @Piinks.
2024-10-22 19:37:19 +00:00
romain.gyh
21814805c1
fix: Considers strokeAlign to compute border dimensions (#155495)
Fixes #155491 

## 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] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.

There are 3 golden tests that don't pass on my computer, but they were
already not passing before my changes.

<!-- 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

---------

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
2024-10-22 12:02:02 -07:00
Bruno Leroux
260bee4d08
Fix MenuController.isOpen throws when unattached (#157331)
## Description

This PR change `MenuController.isOpen` to return false when the `MenuController` is not attached.
Previously `MenuController.isOpen` thrown an assert error when the menu controller was unattached.
With this PR, it is now possible to have some widgets outside the `MenuAnchor` body depending on the menu controller state.

## Related Issue

Fixes [Querying isOpen state for a menu controller that was never attached throws an assertion error](https://github.com/flutter/flutter/issues/157329).

## Tests

Adds 1 test.
2024-10-22 18:49:15 +00:00
Mouad Debbar
e9fb545c05
[web] Allow control of hitTestBehavior of Platform Views (#157189)
Hit testing behavior is currently hardcoded to `opaque`  in `HtmlElementView` which causes the platform view to swallow pointer events when it's a descendant of a `GestureDetector` (see this [example](https://dartpad.dev/?id=5348fbf82be5eeb7d995f953437f0ce6)).

In order to fix this, we need to make `hitTestBehavior` configurable in `HtmlElementView`. This way users can decide to make their platform views `transparent` for hit testing purposes.

**_Note_**: this specific case isn't fixable by `PointerInterceptor` because the framework is already receiving the pointer events, so there's nothing that `PointerInterceptor` can do. This issue is all happening on the framework side since it treats the rectangle occupied by the platform view as an opaque rectangle for hit testing.

**_Workaround_**: in the meantime, users can work around this limitation by surrounding the `HtmlElementView` with an `IgnorePointer` widget.
2024-10-22 17:53:17 +00:00
Jiten Patel
5fa5a64842
[#155269] Platform adaptive showAboutDialog and AboutDialog feature c… (#155377)
This PR introduces a new `showAdaptiveAboutDialog` function, ensuring that the About dialog matches the platform’s design (Material for Android, Fuchsia, Linux, Windows, and, Cupertino for iOS & macOS), providing a more consistent user experience across platforms.

Fixes #155269 

- [] I followed the [breaking change policy] and added [Data Driven Fixes] where supported.
2024-10-22 17:32:05 +00:00
Polina Cherkasova
9edd1ae008
Fix leaks in some image tests and explain hackyness of opted-out. (#154481) 2024-10-22 10:22:01 -07:00
Jiten Patel
3e9901dac9
Fix: showDatePicker should have a simple example in the docs (#156196)
This PR introduces a basic example of how to use the `showDatePicker` function. The purpose of this PR is to simplify the onboarding process for new Flutter developers by providing a straightforward demonstration of handling the asynchronous Future returned by the showDatePicker. This will help users unfamiliar with the intricacies of asynchronous operations in Flutter.

Fixes #156157
2024-10-22 17:04:23 +00:00
Bruno Leroux
383a221cf3
Fix TextField selects all content after the application is resumed (#156968)
## Description

This PR makes `EditableText` aware of the lifecycle 'resumed' state to let the current selection unchanged when the application is resumed (on web and desktop, 'resumed' means the Flutter app window regained focus).

Before this PR, on web and desktop, the whole content of a `TextField` was selected whenever a `TextField` gained focus. This is the correct behavior when tabbing between fields but it is not when a field regains focus after the application is resumed 

## Related Issue

Fixes to [When switching to another browser tab or window and then going back, all text on TextField is selected automatically](https://github.com/flutter/flutter/issues/156078).

## Tests

To be done
2024-10-22 04:41:31 +00:00
Polina Cherkasova
4b169a81ea
Fix some leaky tests. (#157294) 2024-10-21 21:29:05 +00:00
Parker Lougheed
2336329baf
Resolve pupup menu test TODO (#157251)
Flutter no longer supports versions of Dart that will output the non-reified version.
2024-10-21 19:52:30 +00:00
Parker Lougheed
a0a82f2821
Fix a few typos in framework code and doc comments (#157248) 2024-10-21 19:25:52 +00:00
Polina Cherkasova
6d3167e025
Dispose temporarily created CurvedAnimation [prod-leak-fix] (#157233) 2024-10-21 11:04:04 -07:00
Taha Tesser
2665a72559
Fix unattached MenuController throws assertion error when calling MenuController.close() (#156588)
Fixes [Closing a menu controller that was never attached throws an assertion error](https://github.com/flutter/flutter/issues/156572)

### 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(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(),
    );
  }
}

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

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ElevatedButton(
          onPressed: () => Navigator.of(context).push(
            MaterialPageRoute(
              builder: (context) => const MenuControllerPage(),
            ),
          ),
          child: const Text('Press Me'),
        ),
      ),
    );
  }
}

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

  @override
  State<MenuControllerPage> createState() => _MenuControllerPageState();
}

class _MenuControllerPageState extends State<MenuControllerPage> {
  // This menu controller is intentionally left as not attached to a MenuAnchor.
  final MenuController _menuController = MenuController();

  @override
  void dispose() {
    // Close the menu when the page is popped.
    _menuController.close();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: ElevatedButton(
          child: const Text('Go back'),
          onPressed: () => Navigator.of(context).pop(),
        ),
      ),
    );
  }
}
```

</details>
2024-10-21 17:26:09 +00:00
Hannes Hultergård
8621694fdf
Add callbacks for detecting tap up events to TapRegion (#156110)
Adds `onTapUpOutside` and `onTapUpInside` callbacks to `TapRegion`, and `onTapUpOutside` to `EditableText` text fields. This allows users to detect `PointerUpEvent`s, which in turn can be used to differentiate between a tap and pan / scroll gesture (for example by comparing the distance between the down and up events).

Fixes #140271 and potentially  #138190
2024-10-21 16:59:16 +00:00
Yegor
cd0aa2b537
all selectable widgets set the hasSelectedState flag (#157191)
Set the `hasSelectedState` flag in all selectable widgets. This happens automatically because only selectable widgets have `Semantics.selected` set to a non-null value. When the value is propagated to `SemanticsConfiguration.isSelected`, it sets both `hasSelectedState` to true and `isSelected` as appropriate.

More progress towards https://github.com/flutter/flutter/issues/66673
2024-10-18 22:37:51 +00:00
flutter-pub-roller-bot
0549bd8888
Roll pub packages (#156925)
This PR was generated by `flutter update-packages --force-upgrade`.
2024-10-18 20:17:18 +00:00
Victor Sanni
83a0b85e43
Snap CupertinoSliverNavigationBar large title and bottom widget (#156381)
## Flutter (with this PR):

https://github.com/user-attachments/assets/b0177c06-e4b5-4981-8ec3-62171a4f2547

## Native:

https://github.com/user-attachments/assets/6efa0825-d26c-4c20-81cc-c9fada6e15fc

Fixes https://github.com/flutter/flutter/issues/126028
Fixes https://github.com/flutter/flutter/issues/23321
2024-10-18 19:18:08 +00:00
Ramon Farizel
73da3b53bd
Update Snackbar actionOverflowThreshold Documentation (#156926)
This PR addresses an inconsistency in the snackbar widget documentation regarding the percentage threshold for action overflow. The current documentation states that setting the threshold to 0 will prevent the action from overflowing to a new line. However, this behavior is incorrect, as the action still wraps when the threshold is set to 0.

To resolve this, we propose updating the documentation to clarify that the threshold should be set to 1 to ensure the action remains on the same line as the content.

#156817
2024-10-18 19:09:13 +00:00
FMorschel
c40f418c05
Removing unnecessary parenthesis (#156928)
This is simply removing unnecessary parenthesis from various places. This change is because of a change to the unnecessary_parentesis lint that will trigger there. Here is the CL https://dart-review.googlesource.com/c/sdk/+/390161.

- https://github.com/dart-lang/linter/issues/4996

If anything else is needed please let me know. 

I'd like to ask for this PR to wait a bit until the bots are run again on that CL so that I can be sure nothing else will trigger, I will come back here and update this whenever everything is complete. Thanks!
2024-10-17 23:46:25 +00:00
Emmanuel Bonke
77f88ff78a
add dividerThickness in PaginatedDataTable (#156442)
Transitioned from `DataTable` to `PaginatedDataTable` and noted that the latter is missing the `dividerThickness`,  hence this PR adds `dividerThickness` to `PaginatedDataTable`.
2024-10-17 19:43:20 +00:00
Nate Wilson
6b1bc456f4
Arrow syntax for getters (#156483)
This egotistical PR aims to draw attention to a [style guideline](https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#use--for-getters-and-callbacks-that-just-return-literals-or-switch-expressions) that I changed:

> #### Use `=>` for getters and callbacks that just return literals or switch expressions

<br>

There was an opportunity for valuable discussion in #154753 about how this structure affects readability, but I shut it down pretty quick since there was a lot of other stuff going on there.

Interested to hear thoughts from @Piinks and others.
2024-10-17 19:25:14 +00:00
Mairramer
6acc5915b4
Fixes TreeSliver collapsing not working (#153438)
This change addresses bug #153418 by ensuring that nodes are handled correctly when closing their children.

Fixes #153418
2024-10-17 18:12:18 +00:00
Lurchfresser
5ce3ae0241
builder gets executed with AnimationStyle.noAnimation (#156982)
Changed the if-statement nesting, so builder gets executed with AnimationStyle.noAnimation.

Pre-launch Checklist

Issue: https://github.com/flutter/flutter/issues/156959

[✅ ] I read the [Contributor Guide](https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview) and followed the process outlined there for submitting PRs.
[ ✅] I read the [Tree Hygiene](https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md) wiki page, which explains my responsibilities.
[ ✅] I read and followed the [Flutter Style Guide](https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md), including [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).
[ ✅] I signed the [CLA](https://cla.developers.google.com/).
[ ✅] 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](https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests).
I followed the [breaking change policy](https://github.com/flutter/flutter/blob/main/docs/contributing/Treehygiene.md#handling-breaking-changes) and added [Data Driven Fixes](https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md) where supported.
[✅ ] All existing and new tests are passing.
2024-10-17 17:04:07 +00:00
Crafti
0ce5285051
Implement actionsPadding for AppBar (#155632)
This pull requests adds a new `actionsPadding` property to AppBar, which controls the padding of the actions row's end. By default, no padding is added.

As it was already discussed in the linked issue below (https://github.com/flutter/flutter/issues/115349#issuecomment-1315582192), it is not feasible to change defaults. This PR is an interim solution to allow developers to change layout across the app, until that change/transition can be made (see: the new TODO line). 

Different to the original code from 2018, this PR only adds padding to the actual actions row, instead of the entire `NavigationToolbar`.

Fixes #155747
2024-10-17 13:03:22 +00:00
Yegor
54bf532305
Temporarily skip CustomPainter SemanticsFlag test to allow new flag to roll in (#157061)
Same as https://github.com/flutter/flutter/pull/157017, but for `CustomPainter`.
2024-10-16 22:35:23 +00:00
Yegor
4a57ce7932
Temporarily skip SemanticsFlag test to allow new flag to roll in (#157017)
This test relies on the enumeration of all engine flags, and it will fail when https://github.com/flutter/engine/pull/55780 adds `SemanticsFlag.hasSelectedState`. So temporarily skip the test to allow the new flag to be added. I will later unskip the test and change it to check for the new flag as well.

A step towards https://github.com/flutter/flutter/issues/66673
2024-10-16 20:46:16 +00:00
Nate Wilson
8d1ea1e9c5
Monomorphic Mapper (#154972)
This class looks like it _should_ give valid equality checks:

```dart
class _WidgetStateColorMapper extends _WidgetStateColorTransparent {
  const _WidgetStateColorMapper(this.map);

  final WidgetStateMap<Color> map;

  _WidgetStateMapper<Color> get _mapper => _WidgetStateMapper<Color>(map);

  @override
  Color resolve(Set<WidgetState> states) => _mapper.resolve(states);

  @override
  bool operator ==(Object other) {
    return other is _WidgetStateColorMapper && other.map == map;
  }

  @override
  int get hashCode => map.hashCode;
}
```

But I made a mistake: I should have used `other._mapper == _mapper` and `_mapper.hashCode`.

<br>

It'd be pretty nice if no copy-pasting was needed in the first place:

```dart
class _WidgetStateColorMapper extends WidgetStateMapper<Color> implements WidgetStateColor {
  const _WidgetStateColorMapper(super.map);
}
```

<br><br>

This PR makes `WidgetStateMapper` a public class, similar to `WidgetStatePropertyAll`. The new API, when used incorrectly, will `throw` with a detailed error message, rather than silently returning irrelevant values.
2024-10-16 20:18:28 +00:00
Victor Sanni
f9eebe0319
Add bottom to CupertinoNavigationBar to allow for a double-row nav bar (#155959)
Fixes [Support segmented controls in nav bars and double row nav bars](https://github.com/flutter/flutter/issues/10469)

<img width="270" height="600"  alt="Screenshot 2024-09-30 at 3 09 04 PM" src="https://github.com/user-attachments/assets/4003116f-69dd-4f8f-a185-6ca151b74d2d">
2024-10-16 19:36:55 +00:00
Victor Sanni
293ae2e5ab
Add bottom to CupertinoSliverNavigationBar (#155841)
Fixes [Support search box inside large title nav bar](https://github.com/flutter/flutter/issues/18103)
Part of [Support segmented controls in nav bars and double row nav bars](https://github.com/flutter/flutter/issues/10469)

## None mode (Current default)

https://github.com/user-attachments/assets/d798314e-940f-4311-9a9a-fe999c65f280

## Always mode

https://github.com/user-attachments/assets/950a85aa-8ca2-42ea-bf8b-3cb8f95e616e

## Automatic mode

https://github.com/user-attachments/assets/c7c7240b-d493-4036-a987-30f61d02bac3

## With CupertinoSlidingSegmentedControl

https://github.com/user-attachments/assets/59f4aec4-8d9c-4223-915b-97b73cb25dc8

<details>
<summary>Sample Code</summary>

```dart
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/cupertino.dart';

/// Flutter code sample for [CupertinoSliverNavigationBar].

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

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

  @override
  Widget build(BuildContext context) {
    return const CupertinoApp(
      theme: CupertinoThemeData(brightness: Brightness.light),
      home: SliverNavBarExample(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return const CupertinoPageScaffold(
      // A ScrollView that creates custom scroll effects using slivers.
      child: SafeArea(
        child: CustomScrollView(
          // A list of sliver widgets.
          slivers: <Widget>[
            CupertinoSliverNavigationBar(
              leading: SizedBox(
                width: 100,
                child: Row(
                  children: [
                    Icon(CupertinoIcons.back),
                    Text(
                      'Lists',
                      style: TextStyle(color: CupertinoColors.activeBlue),
                    ),
                  ],
                ),
              ),
              trailing: Icon(CupertinoIcons.plus),
              largeTitle: Text('iPhone'),
              // Change to desired mode.
              drawerMode: NavigationDrawerMode.none,
              drawer: Padding(
                padding: EdgeInsets.fromLTRB(8.0, 0.0, 8.0, 16.0),
                child: CupertinoSearchTextField(),
              ),
            ),
            SliverFillRemaining(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                children: <Widget>[
                  Text('Drag me up', textAlign: TextAlign.center),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }
}
```

</details>
2024-10-16 18:25:06 +00:00
Jakub Bogacki
279d30a44f
Add TapOutsideConfiguration widget (#150125)
This PR adds `TapOutsideConfiguration` where you can define a custom default logic for `onTapOutside`.

```dart
TapOutsideConfiguration(
  behavior: AlwaysUnfocusTapOutsideBehavior(),
  // behavior: const NeverUnfocusTapOutsideBehavior(),
  // behavior: const CustomTapOutsideBehavior(),
  child: Column(
    children: [
      // This TextField will use onTapOutside from TapOutsideConfiguration
      TextField(),
      // Of course you can still define onTapOutside
      TextField(onTapOutside: (event) => print('Tapped outside')),
    ],
  ),
)
```

Custom logic can be define like this:

```dart
class CustomTapOutsideBehavior extends TapOutsideBehavior {
  const CustomTapOutsideBehavior();

  @override
  void defaultOnTapOutside(PointerDownEvent event, FocusNode focusNode) {
    // any custom logic here
  }
}
```

This PR implements also two simple `AlwaysUnfocusTapOutsideBehavior` and `NeverUnfocusTapOutsideBehavior`.

Resolves #150123
2024-10-16 13:25:34 +00:00
Bruno Leroux
2430f00a01
fix DropdownMenu keyboard navigation is broken when expandedInsets is set (#156803)
## Description

This PR fixes keyboard navigation when `DropdownMenu.expandedInsets` is used.
Before this PR the Shortcuts widget defining the navigation intents was only added when `DropdownMenu.expandedInsets` was null.
After this PR, the Shortcuts widget is always added.

## Related Issue

Fixes [DropdownMenu keyboard navigation is broken when expandedInsets is set](https://github.com/flutter/flutter/issues/156712).

## Tests

Adds 2 tests.
Replaces several unneeded 'pumpAndSettle'.
2024-10-16 07:30:34 +00:00
Jason Simmons
4f2211b550
Determine the scroll gesture axis based on the effectiveScrollController (#156190)
Fixes https://github.com/flutter/flutter/issues/154520
2024-10-15 20:58:51 +00:00
Rexios
e96aaab5e0
Add padding options to SearchAnchor (#152508)
Cherry-picked padding changes from https://github.com/flutter/flutter/pull/148856

Adds padding configuration options to `SearchAnchor`. This PR adds the following:
- `viewBarPadding`: The padding for items inside the `SearchBar` in the `SearchAnchor` view
- `viewPadding`: The padding to use around the entire `SearchAnchor` view

Working towards https://github.com/flutter/flutter/issues/148852
2024-10-15 20:24:48 +00:00
Victor Sanni
915985ad52
Implement CupertinoSearchTextField opacity fade on scroll (#155025)
## Before:

https://github.com/user-attachments/assets/38cabba1-d002-4a5d-b80b-fd0955b2aad5

## After:

https://github.com/user-attachments/assets/3e73f863-c353-43f3-90b8-fd322b42b5d3

## Native iOS:

https://github.com/user-attachments/assets/daab345e-09ae-44dc-a1a0-461757c13542

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

Needed for https://github.com/flutter/flutter/issues/18103
2024-10-15 17:03:25 +00:00
Taha Tesser
8ea38a7921
Fix AppBar back button doesn't navigate back when using TooltipTriggerMode.tap in the TooltipTheme (#155822)
Fixes [AppBar BackButton Tooltip interferes with clicking button when TooltipThemeData set to TooltipTriggerMode.tap](https://github.com/flutter/flutter/issues/152315)

### Description
`TooltipTheme` with `triggerMode: TooltipTriggerMode.tap` prevents user from navigating back when tapping on the back button. `triggerMode: TooltipTriggerMode.tap` shouldn't interrupted the back button navigation back callback.

### Code sample

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

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        tooltipTheme:
            const TooltipThemeData(triggerMode: TooltipTriggerMode.tap),
      ),
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Sample'),
        ),
        body: Builder(builder: (context) {
          return Center(
            child: ElevatedButton(
              onPressed: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => const SecondScreen(),
                  ),
                );
              },
              child: const Text('Go to Second Screen'),
            ),
          );
        }),
      ),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Second Screen'),
      ),
      body: const Center(
        child: Tooltip(
          message: 'This is the second screen',
          child: Text('Tap to show tooltip'),
        ),
      ),
    );
  }
}
```

</details>

### Before

https://github.com/user-attachments/assets/ed2020f0-aef8-40f9-be05-55ff80e42e5d

### After

https://github.com/user-attachments/assets/8d65f9f8-d15d-453f-955f-e5d92f8a04e8
2024-10-15 12:30:28 +00:00
Hannah Jin
75d93e1c44
Update dropdown menu semantics to fix its a11y issues (#156709)
fixes https://github.com/flutter/flutter/issues/133742 

because the _initialMenu is invisible, we should not add semantics nodes
to it

## Pre-launch Checklist

- [ ] I read the [Contributor Guide] and followed the process outlined
there for submitting PRs.
- [ ] I read the [Tree Hygiene] wiki page, which explains my
responsibilities.
- [ ] I read and followed the [Flutter Style Guide], including [Features
we expect every widget to implement].
- [ ] I signed the [CLA].
- [ ] I listed at least one issue that this PR fixes in the description
above.
- [ ] I updated/added relevant documentation (doc comments with `///`).
- [ ] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [ ] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] 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-10-14 13:36:24 -07:00
Bruno Leroux
a60933551d
Refactor some DropdownMenu tests (#156702)
## Description

This PR adds a utility method, named `isItemHighlighted`, to simplify several `DropdownMenu` tests.
It will help for some inworking changes.
2024-10-14 20:17:09 +00:00
Jatin Nagar
b3491acb0d
RadioListTile: add property to scale the radio (#156292)
Added a property in the RadioListTile to scale the underlying Radio using `Transform.scale`.

Fixes: #81334
2024-10-12 15:50:36 +00:00
Jatin Nagar
63dd042e72
CheckboxListTile: use Transform.scale only when required (#156593)
Make CheckboxListTile use `Transform.scale` only when required.

Fixes: #81334
2024-10-12 05:37:38 +00:00
Bruno Leroux
9e64b67111
Improve InputDecoration.errorMaxLines documentation (#156468)
## Description

This PR improves the `InputDecoration.errorMaxLines` and `InputDecoration.helperMaxLines` documentations to explain when wrapping and ellipsing are applied.

## Related Issue

Fixes [InputDecoration.errorMaxLines's documentation does not match behavior](https://github.com/flutter/flutter/issues/155626).
2024-10-11 21:35:27 +00:00
RamonFarizel
51aa2f5809
Add code sample to the CupertinoMagnifier/CupertinoTextMagnifier (#156028)
This PR adds code samples regarding the CupertinoMagnifier and CupertinoTextMagnifier

Fixes #154439
2024-10-11 20:53:18 +00:00