24361 Commits

Author SHA1 Message Date
Nate Wilson
9ee00ae168
Fix NestedScrollView inner position logic (#157756)
closes #40740

<p align="center">
  <img 
    src="https://github.com/user-attachments/assets/8a48abd0-466b-4e06-90f3-dd05869bac27"
    alt="NestedScrollController fix"
    height="720px"
  />
</p>

<details> <summary><h4>Demo source code</h4> (click to expand)</summary>

(this is a slightly more concise version of the code sample from #40740)

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

void main() {
  runApp(
    const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(body: NewsScreen()),
    ),
  );
}

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

  static const List<String> _tabs = <String>['Featured', 'Popular', 'Latest'];

  static final List<Widget> _tabViews = <Widget>[
    for (final String name in _tabs)
      SafeArea(
        top: false,
        bottom: false,
        child: Builder(builder: (BuildContext context) {
          final handle = NestedScrollView.sliverOverlapAbsorberHandleFor(context);

          return NotificationListener<ScrollNotification>(
            onNotification: (ScrollNotification notification) => true,
            child: CustomScrollView(
              key: PageStorageKey<String>(name),
              slivers: <Widget>[
                SliverOverlapInjector(handle: handle),
                SliverPadding(
                  padding: const EdgeInsets.all(8.0),
                  sliver: SliverList(
                    delegate: SliverChildBuilderDelegate(
                      childCount: 30,
                      (BuildContext context, int index) => Container(
                        margin: const EdgeInsets.only(bottom: 8),
                        width: double.infinity,
                        height: 150,
                        color: const Color(0xFFB0A4C8),
                        alignment: Alignment.center,
                        child: Text(
                          '$name $index',
                          style: const TextStyle(fontWeight: FontWeight.w600),
                        ),
                      ),
                    ),
                  ),
                ),
              ],
            ),
          );
        }),
      ),
  ];

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: _tabs.length,
      child: NestedScrollView(
        headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) => <Widget>[
          SliverOverlapAbsorber(
            handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
            sliver: SliverSafeArea(
              top: false,
              sliver: SliverAppBar(
                title: const Text('Tab Demo'),
                floating: true,
                pinned: true,
                snap: true,
                forceElevated: innerBoxIsScrolled,
                bottom: TabBar(
                  tabs: _tabs.map((String name) => Tab(text: name)).toList(),
                ),
              ),
            ),
          ),
        ],
        body: TabBarView(children: _tabViews),
      ),
    );
  }
}
```

<br>

</details>

<br>

This bug can be traced to a return statement inside `_NestedScrollPosition`:

```dart
double applyClampedDragUpdate(double delta) {
  // ...
  return delta + offset;
}
```

Thanks to some quirks of floating-point arithmetic, `applyClampedDragUpdate` would sometimes return a tiny non-zero value, which ends up ruining one of the scroll coordinator's equality checks.

8990ed6538/packages/flutter/lib/src/widgets/nested_scroll_view.dart (L658-L664)
2024-11-04 16:42:06 +00:00
Valentin Vignal
8591d0c16a
Remove null from flex documentation (#158086)
Closes https://github.com/flutter/flutter/issues/158085
2024-11-04 12:46:29 +00:00
Polina Cherkasova
0505176f1b
Revert "Add and plumb useImplicitPubspecResolution across flutter_tools." (#158076)
Reverts flutter/flutter#157879 to unblock flutter roll.

Prerequisite reverts:
https://github.com/flutter/flutter/pull/157934

Reason: b/377107864
2024-11-03 17:29:24 +00:00
Polina Cherkasova
f7b24fa525
Revert "Add a warning/additional handlers for parsingsynthetic-package." (#158078)
Reverts flutter/flutter#157934 to unblock https://github.com/flutter/flutter/pull/158076 and then flutter roll.

Reason: b/377107864
2024-11-03 17:12:20 +00:00
Loïc Sharma
3699474585
Make SwiftPM integration tests even MORE idiomatic (#158014)
Reach peak idiomacy by replacing `expect(file.existsSync(), isTrue)` with `expect(file, exists)`!

Follow up to: https://github.com/flutter/flutter/pull/157971
2024-11-01 20:00:04 +00:00
Loïc Sharma
84ad67f8c1
Improve consistency of code snippets in basic.dart (#158015)
Updates `basic.dart` to use consistent doc snippets that follows the style from the [documentation on snippets](https://github.com/flutter/flutter/tree/master/dev/snippets#snippet-tool).

Follow-up to: https://github.com/flutter/flutter/pull/157227#discussion_r1807499353
2024-11-01 19:38:19 +00:00
Matan Lurey
2ce743d0f0
Remove unnecessary kCliAnimationsFeatureName that is available as .configSetting. (#158013)
... for consistency with the rest of the file/features.
2024-11-01 19:20:59 +00:00
Loïc Sharma
49ccfb7302
Make the SwiftPM integration tests more idiomatic (#157971)
I recommend reviewing with [whitespace changes disabled](https://github.com/flutter/flutter/pull/157971/files?diff=split&w=1).

Changes:

1. Replaces `expect(string.contains('foo'), isTrue)` with `expect(string, contains('foo'))`
2. Replaces `try/finally` with `addTearDown`

Follow-up to: https://github.com/flutter/flutter/pull/157482#discussion_r1813939657
2024-11-01 18:15:15 +00:00
Paolo Lammens
d836ca5a68
performance: Override .elementAt in CachingIterable (#152477)
Add a more efficient override of `Iterable.elementAt` in `CachingIterable`.

Closes #152476
2024-11-01 04:50:17 +00:00
Matan Lurey
d77d7c3f36
Add a warning/additional handlers for parsingsynthetic-package. (#157934)
Closes https://github.com/flutter/flutter/issues/157928.
Closes https://github.com/flutter/flutter/issues/157929.

| Condition | Expectation |
| --------- | ------------ |
| `synthetic-packages: true` && `--implicit-pubpsec-resolution` | Generates `flutter_gen` with warning.
| `<no synthetic-packages key>` && `--implicit-pubspec-resolution` | Generates `flutter_gen` with warning.
| `synthetic-packages: false` && `--implicit-pubpsec-resolution` | Does not generate `flutter_gen`.
| `synthetic-packages: true` && `--no-implicit-pubpsec-resolution` | Error.
| `<no synthetic-packages key>` && `--no-implicit-pubspec-resolution` | Does not generate `flutter_gen`.
| `synthetic-packages: false` && `--no-implicit-pubpsec-resolution` | Generates `flutter_gen` with warning.
2024-11-01 00:45:07 +00:00
Matan Lurey
8d7513efb6
Renames injectBuildTimePluginFilesForWebPlatform and removes unused named parameter. (#157944)
Closes https://github.com/flutter/flutter/issues/157943.

---------

Co-authored-by: Andrew Kolos <andrewrkolos@gmail.com>
2024-10-31 15:48:23 -07:00
Jonah Williams
1050959d19
[flutter_driver] use mostly public screenshot API. (#157888)
Instead of completely private. This has been broken for Impeller for years, which shows how much this method is getting used.

Fixes https://github.com/flutter/flutter/issues/130461
2024-10-31 21:31:07 +00:00
Sarbagya Dhaubanjar
19d8fbc6f4
Made insetPadding configurable for Date Picker Dialog (#155651)
This PR adds following properties to the **DatePickerDialog**:
- `insetPadding`
2024-10-31 21:07:08 +00:00
Bruno Leroux
5f65bd06c0
Fix showSnackBar can't access useMaterial3 from the theme (#157707)
## Description

This PR makes it possible for the `MaterialApp` built in `ScaffoldMessenger` state to access the ambient theme.

Before this PR, the built in messenger was above the theme.
After this PR, the build in messenger is below the theme.

## Related Issue

Fixes [Can't access useMaterial3 from the theme in the showSnackBar method](https://github.com/flutter/flutter/issues/115924)

## Tests

Adds 1 test.
2024-10-31 21:04:57 +00:00
chunhtai
b2f72e08ef
Hides added routes before top-most route finishes pushing (#156104)
fixes https://github.com/flutter/flutter/issues/156033
2024-10-31 16:47:55 +00:00
Benji Farquhar
b01558c1cd
Fix cursor on hover expand/collapse icon (#155207) (#155209)
@TahaTesser Fix undesirable side effects of your refactor away from my solution to add `IgnorePointer` during your code review of my PR https://github.com/flutter/flutter/pull/147098. I don't have time to implement my whole initial fix a second time, and update the tests that were added to verify your disabled color change. The issue is resolved with only adding the IgnorePointer.

See [155207](https://github.com/flutter/flutter/issues/155207).
2024-10-31 16:09:18 +00:00
Matan Lurey
fb022290ff
Add and plumb useImplicitPubspecResolution across flutter_tools. (#157879)
Work towards https://github.com/flutter/flutter/issues/157819. **No behavior changes as a result of this PR**.

Based on a proof of concept by @jonahwilliams (https://github.com/flutter/flutter/pull/157818).

The existence of this flag (which for the time being, defaults to `true`) implies the following:

1. The (legacy, deprecated) `.flutter-plugins` file is not generated:
    https://docs.flutter.dev/release/breaking-changes/flutter-plugins-configuration
    
2. The (legacy, deprecated) `package:flutter_gen` is not synthetically generated:
    https://github.com/flutter/website/pull/11343
    (awaiting website approvers, but owners approve this change)

This change creates `useImplicitPubspecResolution` and plumbs it through as a required variable, parsing it from a `FlutterCommand.globalResults` where able. In tests, I've defaulted the value to `true` 100% of the time - except for places where the value itself is acted on directly, in which case there are true and false test-cases (e.g. localization and i10n based classes and functions).

I'm not extremely happy this needed to change 50+ files, but is sort of a result of how inter-connected many of the elements of the tools are. I believe keeping this as an explicit (flagged) argument will be our best way to ensure the default behavior changes consistently and that tests are running as expected.
2024-10-31 10:43:25 +00:00
LouiseHsu
ec04707feb
Adds a new helpful tool exit message for SocketExceptions thrown during mdns discovery (#157638)
Addresses https://github.com/flutter/flutter/issues/150131, but doesn't fix it, as there seem to be cases where the steps included in the messages added in this PR don't work.
2024-10-30 21:20:25 +00:00
Gray Mackall
55c026a230
Upgrade templates to AGP 8.7/Gradle 8.10.2 (#157872)
These are the versions we use in test, as of https://github.com/flutter/flutter/pull/157617.

Motivated by noticing a warning with the old template version:
```
This Android Gradle plugin (8.1.0) was tested up to compileSdk = 33 (and compileSdkPreview = "UpsideDownCakePrivacySandbox").
You are strongly encouraged to update your project to use a newer
Android Gradle plugin that has been tested with compileSdk = 35.
```
2024-10-30 18:54:06 +00:00
Taha Tesser
b8dcb0c3c5
Update Material 3 LinearProgressIndicator for new visual style (#154817)
Related to [Update both `ProgressIndicator` for Material 3 redesign](https://github.com/flutter/flutter/issues/141340)

### 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> {
  bool isRTL = false;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(

        body: Directionality(
          textDirection: isRTL ? TextDirection.rtl : TextDirection.ltr,
          child: Center(
            child: Column(
              spacing: 2.0,
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                const Text('Default LinearProgressIndicator'),
                const Padding(
                  padding: EdgeInsets.all(16.0),
                  child: LinearProgressIndicator(
                    value: 0.45,
                  ),
                ),
                const Text('Default indefinite LinearProgressIndicator'),
                const Padding(
                  padding: EdgeInsets.all(16.0),
                  child: LinearProgressIndicator(),
                ),
                const Text('Updated height and border radius'),
                Padding(
                  padding: const EdgeInsets.all(16.0),
                  child: LinearProgressIndicator(
                    value: 0.25,
                    minHeight: 16.0,
                    borderRadius: BorderRadius.circular(16.0),
                  ),
                ),
                const Text('Updated stop indicator color and radius'),
                Padding(
                  padding: const EdgeInsets.all(16.0),
                  child: LinearProgressIndicator(
                    value: 0.74,
                    minHeight: 16.0,
                    borderRadius: BorderRadius.circular(16.0),
                    stopIndicatorColor: Theme.of(context).colorScheme.error,
                    stopIndicatorRadius: 32.0,
                  ),
                ),
                const Text('Track gap and stop indicator radius set to 0'),
                Padding(
                  padding: const EdgeInsets.all(16.0),
                  child: LinearProgressIndicator(
                    value: 0.50,
                    minHeight: 16.0,
                    borderRadius: BorderRadius.circular(16.0),
                    trackGap: 0,
                    stopIndicatorRadius: 0,
                  ),
                ),
              ],
            ),
          ),
        ),
        floatingActionButton: FloatingActionButton.extended(
          onPressed: () {
            setState(() {
              isRTL = !isRTL;
            });
          },
          label:  const Text('Toggle Direction'),
        ),
      ),
    );
  }
}
```

</details>

### Preview

<img width="824" alt="Screenshot 2024-09-09 at 13 53 10" src="https://github.com/user-attachments/assets/d12e56a5-f196-4011-8266-c7ab96be96b2">
2024-10-30 18:14:11 +00:00
Matan Lurey
e6c9fce313
Add hidden --no-implicit-pubspec-resolution flag for one stable release. (#157635)
Closes https://github.com/flutter/flutter/issues/157532.

Work towards https://github.com/flutter/flutter/issues/157819.

Because this flag is checked in `FlutterCommand.verifyAndRun`, it seemed cleaner to just make it a global flag - particularly because this flag's longevity is unlikely to be longer than a single stable release.
2024-10-30 17:00:32 +00:00
Taha Tesser
40c22749f5
Add ability to customize the default Slider padding (#156143)
Fixes [Ability to change Sliders padding](https://github.com/flutter/flutter/issues/40098)

Add ability to override default padding so the Slider can fit better in a layout.

### 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 _sliderValue = 0.5;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        sliderTheme: const SliderThemeData(
          padding: EdgeInsets.symmetric(vertical: 4.0),
          thumbColor: Colors.red,
          inactiveTrackColor: Colors.amber,
        ),
      ),
      home: Scaffold(
        body: Directionality(
          textDirection: TextDirection.ltr,
          child: Center(
            child: Card(
              shape: const RoundedRectangleBorder(
                borderRadius: BorderRadius.all(Radius.circular(4.0)),
              ),
              color: Theme.of(context).colorScheme.surfaceContainerHighest,
              margin: const EdgeInsets.symmetric(horizontal: 16.0),
              child: Padding(
                padding: const EdgeInsets.all(16.0),
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    const Placeholder(fallbackHeight: 100.0),
                    Slider(
                      value: _sliderValue,
                      onChanged: (double value) {
                        setState(() {
                          _sliderValue = value;
                        });
                      },
                    ),
                    const Placeholder(fallbackHeight: 100.0),

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

</details>

### Before
(Cannot adjust default `Slider` padding to fill the horizontal space in a `Column` and reduce the padded height)

<img width="717" alt="Screenshot 2024-10-03 at 15 45 18" src="https://github.com/user-attachments/assets/e9d9a4d1-3087-45b4-8607-b94411e2bd23">

### After 
Can adjust default `Slider` padding via `SliderTheme`)

<img width="717" alt="Screenshot 2024-10-03 at 15 46 25" src="https://github.com/user-attachments/assets/cd455881-6d52-46cb-8ac6-cc33f50a13ff">
2024-10-30 10:16:23 +00:00
YeungKC
ec50578982
Fix menu anchor state handling (#157612)
This commit refactors the `_MenuAnchorState` class in `menu_anchor.dart` to include a check for the mounted state and the scheduler phase before calling `setState()`. This ensures that UI updates are only performed when the widget is still mounted and not during the persistent callbacks phase. Additionally, a new test case is added in `menu_anchor_test.dart` to verify that the `isOpen` state of the `MenuAnchor` widget is updated correctly when the button is pressed.

Fix: #157606

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

*List which issues are fixed by this PR. You must list at least one issue. An issue is not required if the PR fixes something trivial like a typo.*

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2024-10-30 09:42:00 +00:00
yim
c051b69e2a
Add boundary feature to the drag gesture. (#147521)
Inspired by the review on #146182.

This PR adds boundary feature to the drag gestures, including `MultiDragGestureRecognizer` and `DragGestureRecognizer`. The `GestureDetector` widget will also benefit from this.
2024-10-30 03:01:18 +00:00
Nate Wilson
7ee7fff210
Fix ResizeImage documentation (#157619)
Whoever reviewed the documentation changes in #154212 neglected to double-check that the information was accurate (it was me who did this).

Fixes #136508
2024-10-30 00:46:11 +00:00
Matan Lurey
1068d31382
Fix and remove a few no-shuffle tags in flutter_tools. (#157656)
Two of the tests, `test_test` and `break_on_framework_exceptions`, no longer appear to leak (without changes). Perhaps underlying infrastructure has changed, or some other bug in the tool itself was fixed in meantime.

`packages_test` required resetting `Cache.flutterRoot`.

Work towards https://github.com/flutter/flutter/issues/85160.
2024-10-29 19:01:54 +00:00
Gray Mackall
42132e879b
Reland "Upgrade tests to AGP 8.7/Gradle 8.10.2/Kotlin 1.8.10" (#157617)
Reland of https://github.com/flutter/flutter/pull/157032.

Failed tests for initial land: 
https://flutter-dashboard.appspot.com/#/build?hashFilter=5ca6350a06fdae8d3e160f9adbece193f34d0302&repo=flutter&branch=master

These two tests run the same `flavors_test`
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20flavors_test/4579/overview
https://ci.chromium.org/ui/p/flutter/builders/prod/Windows_mokey%20flavors_test_win/988/overview
which is now passing
https://ci.chromium.org/ui/p/flutter/builders/try/Linux_pixel_7pro%20flavors_test/37/overview
(fixed by 23c62df1dc)

The other failures seem to be flakes
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux_pixel_7pro%20new_gallery_impeller_old_zoom__transition_perf/4902/overview
https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20tool_integration_tests_2_5/1247/overview
the first is a timeout, the second passed in presubmit on the original PR and also on this PR.
2024-10-29 18:01:19 +00:00
Koji Wakamiya
94c537192f
Remove unused import from kt plugin template (#157220)
Remove import as `@NonNull` is no longer used by https://github.com/flutter/flutter/pull/129472.

<img width="480" alt="code" src="https://github.com/user-attachments/assets/de45b396-995a-459f-8f36-f738d16cc229">
2024-10-29 15:42:20 +00:00
Taha Tesser
97596e5895
Fix TabBar tab icons not respecting custom IconTheme (#157724)
Fixes [TabBar ignores Theme's iconTheme.size](https://github.com/flutter/flutter/issues/155518)

### Description

When `ThemeData.IconTheme`  with color and size, is provided, it can override the default `Tab` icon color and size. 

### 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(
      theme: ThemeData(
        iconTheme: const IconThemeData(color: Colors.amber, size: 40),
      ),
      home: const Scaffold(
        body: SafeArea(
          child: DefaultTabController(
            length: 2,
            child: Column(
              children: [
                TabBar(
                  tabs: [
                    Tab(icon: Icon(Icons.backpack_outlined), text: 'Backpack'),
                    Tab(icon: Icon(Icons.map_outlined), text: 'Map'),
                  ],
                  overlayColor: WidgetStatePropertyAll(Colors.transparent),
                ),
                Expanded(
                  child: TabBarView(
                    children: [
                      Icon(Icons.backpack_outlined),
                      Icon(Icons.map_outlined),
                    ],
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
```

</details>

---

<img width="666" alt="Screenshot 2024-10-28 at 16 25 06" src="https://github.com/user-attachments/assets/56d31115-7ee9-4378-9811-75a3a2a4ce0f">

<img width="666" alt="Screenshot 2024-10-28 at 16 24 52" src="https://github.com/user-attachments/assets/ab8a3e4b-e912-40ac-b249-6358492581e0">
2024-10-29 10:51:38 +00:00
aniq
c83cf967cf
Allow customizing entry mode icons in TimePicker (#157151)
This PR adds two new properties to the Material Design `TimePicker`: `switchToInputEntryModeIcon` and `switchToTimerEntryModeIcon`. These allow developers to customize the icons for toggling between dial and input modes, with default icons (`Icons.keyboard_outlined` and `Icons.access_time`) used if none are provided.

Fixes #156942
2024-10-29 10:25:20 +00:00
yim
04bcfe9281
Fix Scaffold extend body (#157441)
Fixes: #157316
2024-10-27 04:54:30 +00:00
Matan Lurey
3af8b0a4df
Tighten up throwToolExit, explain when to use it. (#157561)
Documents when to use `throwToolExit` and how to use it.

Replaces every invocation of `throw ToolExit` with `throwToolExit` and makes the former impossible; this is so that every user will at least (hypothetically) have the chance to read the documentation attached to `throwToolExit` (and if we change parameters in the future they will all flow through one place).
2024-10-26 03:17:24 +00:00
Matan Lurey
82a20e407e
Remove extraneous throw. (#157658)
h/t to @tvolkert for noticing this one!
2024-10-26 02:49:20 +00:00
Polina Cherkasova
9cf98f7273
Create flutter specific leak troubleshooting guidance. (#157396) 2024-10-25 13:25:34 -07:00
Kate Lovett
2c20325af4
Update CupertinoNavigationBar to support large layout (#157133)
Fixes https://github.com/flutter/flutter/issues/149625

This adds a new constructor CupertinoNavigationBar.large for the large style navigation bar. CupertinoSliverNavigationBar enables dynamically changing between the smaller and larger layouts for native iOS headers in response to scrolling, this change makes it possible to configure the static navigation bar in one style or the other.
2024-10-25 19:08:12 +00:00
Jonah Williams
c4c545215a
Support backdrop key in flutter framework. (#157278)
The backdrop key functionality allows multiple backdrop filters to share the same input filter, dramatically improving raster performance. This is only supported on the Impeller backend.

The backdrop key class allocates a new int from a static and passes this to the engine layer. with 64 bit integers, we can allocate many backdrop filter ids per frame and never run out.

See also: https://github.com/flutter/flutter/issues/156455

```dart
import 'dart:math';
import 'dart:ui';

import 'package:flutter/material.dart';

final _random = Random();

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

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

  static final listKey = BackdropKey();
  static final overlayKey = BackdropKey();

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        backgroundColor: Colors.white,
        body: Stack(
          children: [
            ListView.builder(
              itemCount: 120, // 60 pairs of red and blue containers
              itemBuilder: (context, index) {
                return Container(
                  height: 100,
                  color: index % 2 == 0 ? Colors.red : Colors.blue,
                );
              },
            ),
            Center(
              child: Container(
                width: 400,
                height: 400,
                decoration: BoxDecoration(
                  border: Border.all(color: Colors.black),
                ),
                child: Image.network('https://picsum.photos/400'),
              ),
            ),
            ListView.separated(
              separatorBuilder: (_, __) => const SizedBox(height: 8),
              itemBuilder: (context, index) => BlurEffect(
                backdropKey: listKey,
                child: SizedBox(
                  height: 50,
                  child: Center(
                    child: Text(index.toString(),
                        style: const TextStyle(color: Colors.white)),
                  ),
                ),
              ),
              itemCount: 200,
            ),
            Positioned.fill(
              bottom: null,
              child: BlurEffect(
                backdropKey: overlayKey,
                child: Padding(
                  padding: EdgeInsets.only(
                    top: MediaQuery.of(context).viewPadding.top,
                  ),
                  child: const SizedBox(height: 45),
                ),
              ),
            ),
            Positioned.fill(
              top: null,
              child: BlurEffect(
                backdropKey: overlayKey,
                child: Padding(
                  padding: EdgeInsets.only(
                    top: MediaQuery.of(context).viewPadding.bottom,
                  ),
                  child: const SizedBox(height: 50),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

class BlurEffect extends StatelessWidget {
  final Widget child;

  const BlurEffect({
    required this.child,
    required this.backdropKey,
    super.key,
  });

  final BackdropKey backdropKey;

  @override
  Widget build(BuildContext context) {
    return ClipRect(
      child: BackdropFilter(
        backdropKey: backdropKey,
        filter: ImageFilter.blur(
          sigmaX: 40,
          sigmaY: 40,
          // tileMode: TileMode.mirror,
        ),
        child: DecoratedBox(
          decoration: BoxDecoration(color: Colors.black.withOpacity(.65)),
          child: child,
        ),
      ),
    );
  }
}
```

### Skia

<img src="https://github.com/user-attachments/assets/4c08e92d-f0ba-42b2-a4c4-fc44efbcfae0" width="200"/>

### Impeller

<img src="https://github.com/user-attachments/assets/21e95efd-5e0c-4f41-8f84-af3f0e47d1aa" width="200"/>
2024-10-25 16:27:51 +00:00
Mohellebi abdessalem
7e2a06657c
Update flutter.groovy to catch unknown task exception when finding api task (#157282)
see #147122 for context
and [this](https://github.com/flutter/flutter/pull/157221) for more
2024-10-25 14:51:12 +00:00
Matan Lurey
a4167b7cf2
Remove unused PubDependenciesProjectValidator. (#157516)
Closes https://github.com/flutter/flutter/issues/157479.

This came up while I was looking at parsing the results of `dart pub deps --json`, turns out it isn't used.
2024-10-24 22:05:50 +00:00
auto-submit[bot]
b98d9a37ac
Reverts "Upgrade tests to AGP 8.7/Gradle 8.10.2/Kotlin 1.8.10 (#157032)" (#157559)
Reverts: flutter/flutter#157032
Initiated by: gmackall
Reason for reverting: https://github.com/flutter/flutter/pull/157032#issuecomment-2436336078
Original PR Author: gmackall

Reviewed By: {reidbaker, bartekpacia}

This change reverts the following previous change:
I recently noticed the following log when building an app in verbose mode:
```
This Android Gradle plugin (8.1.0) was tested up to compileSdk = 33 (and compileSdkPreview = "UpsideDownCakePrivacySandbox").
You are strongly encouraged to update your project to use a newer
Android Gradle plugin that has been tested with compileSdk = 35.
```

It looks like AGP would like us to use a newer AGP version if we want to use compileSdk 35 (which we do). This pr upgrades the tests, in advance of updating the templates.
2024-10-24 21:06:16 +00:00
Taha Tesser
cdf4a2d109
Deprecate ThemeData.dialogBackgroundColor in favor of DialogThemeData.backgroundColor (#155072)
Related to [☂️ Material Theme System Updates](https://github.com/flutter/flutter/issues/91772)
2024-10-24 20:12:21 +00:00
Gray Mackall
5ca6350a06
Upgrade tests to AGP 8.7/Gradle 8.10.2/Kotlin 1.8.10 (#157032)
I recently noticed the following log when building an app in verbose mode:
```
This Android Gradle plugin (8.1.0) was tested up to compileSdk = 33 (and compileSdkPreview = "UpsideDownCakePrivacySandbox").
You are strongly encouraged to update your project to use a newer
Android Gradle plugin that has been tested with compileSdk = 35.
```

It looks like AGP would like us to use a newer AGP version if we want to use compileSdk 35 (which we do). This pr upgrades the tests, in advance of updating the templates.
2024-10-24 20:08:45 +00:00
Matan Lurey
dc13c3bfb7
Allow opting out of .flutter-plugins, opt-out in refreshPluginsList. (#157527)
Work towards https://github.com/flutter/flutter/issues/48918.

Workaround for https://github.com/flutter/flutter/issues/157391 (see https://github.com/flutter/flutter/pull/157393#issuecomment-2434336047).

I'll run all post-submit tasks as well on this PR using `test: all`.
2024-10-24 20:01:45 +00:00
auto-submit[bot]
73f66a7ea4
Reverts "Reverts "Added a warning if flutter.groovy uses a .flutter-plugins file. (#157388)" (#157541)" (#157549)
Reverts: flutter/flutter#157541
Initiated by: matanlurey
Reason for reverting: Was _not_ the cause of failure, see https://github.com/flutter/flutter/issues/157542.
Original PR Author: auto-submit[bot]

Reviewed By: {fluttergithubbot}

This change reverts the following previous change:
Reverts: flutter/flutter#157388
Initiated by: matanlurey
Reason for reverting: We have `--fatal-warnings` on postsubmit and this breaks the tree.
Original PR Author: matanlurey

Reviewed By: {reidbaker}

This change reverts the following previous change:
Work towards https://github.com/flutter/flutter/issues/48918.

This file was soft deprecated in _2020_, but the code was never removed. This warning message will serve as a warning and we'll rip out support for `flutter-plugins` after the _next_ stable release (i.e. after the mid-November branch cut).
2024-10-24 19:52:25 +00:00
Mairramer
8cc862c727
Changes the offset computation to first item for RenderSliverMainAxisGroup (#154688)
Fixes https://github.com/flutter/flutter/issues/154615
When scrolling back to the top, the position of the first visible item should have its scrollExtent subtracted. Otherwise, the accumulated position may be retained, which may result in the first visible item being hidden in some cases.
2024-10-24 19:23:07 +00:00
Loïc Sharma
bf319d6213
Add partial test for flutter build ios-framework on non-module (#157482)
Add a partial test for running `flutter build ios-framework` on a regular app project (not a module).

Follow-up to this conversation: https://github.com/flutter/flutter/pull/157393/files#r1811810540

Part of https://github.com/flutter/flutter/issues/146957
2024-10-24 18:53:09 +00:00
Loïc Sharma
fe95b2e225
Add example to SafeArea docs (#157228) 2024-10-24 18:53:07 +00:00
auto-submit[bot]
ef99fcbd60
Reverts "Added a warning if flutter.groovy uses a .flutter-plugins file. (#157388)" (#157541)
Reverts: flutter/flutter#157388
Initiated by: matanlurey
Reason for reverting: We have `--fatal-warnings` on postsubmit and this breaks the tree.
Original PR Author: matanlurey

Reviewed By: {reidbaker}

This change reverts the following previous change:
Work towards https://github.com/flutter/flutter/issues/48918.

This file was soft deprecated in _2020_, but the code was never removed. This warning message will serve as a warning and we'll rip out support for `flutter-plugins` after the _next_ stable release (i.e. after the mid-November branch cut).
2024-10-24 18:20:47 +00:00
Matan Lurey
25b55b9f2d
Added a warning if flutter.groovy uses a .flutter-plugins file. (#157388)
Work towards https://github.com/flutter/flutter/issues/48918.

This file was soft deprecated in _2020_, but the code was never removed. This warning message will serve as a warning and we'll rip out support for `flutter-plugins` after the _next_ stable release (i.e. after the mid-November branch cut).
2024-10-24 16:25:09 +00:00
Huy
fa5254331f
Add ability to disable CupertinoSegmentedControl (#152813)
### Summary

Add the ability to configure enabled or disabled segments in CupertinoSegmentedControl. The idea is to pass a `segmentStates` map, where the user can set the state according to segment key. User can also set background and text colors when the segment is disabled.

### Demo

https://github.com/user-attachments/assets/4a02da02-a0fb-4ded-a271-033a8dc79ac3

### Related issue
Fixes https://github.com/flutter/flutter/issues/52105
2024-10-24 12:05:35 +00:00
Taha Tesser
0167f02e90
Update Tab.height parameter doc for tab height lower than default (#157443)
Fixes [TabBar.height adds a gap between the AppBar.toolbar and AppBar.bottom](https://github.com/flutter/flutter/issues/156200)
2024-10-24 09:43:36 +00:00