11171 Commits

Author SHA1 Message Date
Jonah Williams
a0862f1c3f
[framework] use ImageFilter for stretch overscroll. (#133613)
Rather than changing the size of the child elements (relaying out text
and potentially changing glyph shape and position due to pixel
snapping), apply the stretch effect as a compositing effect - render the
children to a texture and stretch the texture. If we end up using an
image shader to apply an custom shader we'll need to do this anyway.

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

### Before


https://github.com/flutter/flutter/assets/8975114/16e9eb57-f864-4093-b4a4-461082b89b43

### After


https://github.com/flutter/flutter/assets/8975114/14cf0167-8922-4876-a325-e3bc154b084f
2023-08-30 18:58:42 -07:00
Polina Cherkasova
95e197ba69
_RawAutocompleteState should dispose _highlightedOptionIndex. (#133700) 2023-08-30 16:07:35 -07:00
Taha Tesser
d7a3a68275
Fix cancelButtonStyle & confirmButtonStyle properties from TimePickerTheme aren't working (#132843)
fixes [`TimePickerThemeData` action buttons styles aren't working](https://github.com/flutter/flutter/issues/132760)

### 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(
        useMaterial3: true,
        timePickerTheme: TimePickerThemeData(
          cancelButtonStyle: TextButton.styleFrom(
            shape: const RoundedRectangleBorder(
              borderRadius: BorderRadius.all(Radius.circular(4)),
              side: BorderSide(color: Colors.red),
            ),
            backgroundColor: Colors.white,
            foregroundColor: Colors.red,
            elevation: 3,
            shadowColor: Colors.red,
          ),
          confirmButtonStyle: TextButton.styleFrom(
            shape: const RoundedRectangleBorder(
              borderRadius: BorderRadius.all(Radius.circular(4)),
            ),
            backgroundColor: Colors.green[700],
            foregroundColor: Colors.white,
            elevation: 3,
            shadowColor: Colors.green[700],
          ),
        ),
      ),
      home: const Example(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: TimePickerDialog(initialTime: TimeOfDay.now()),
      ),
    );
  }
}

``` 

</details>

### Before (action buttons don't use the style from the `TimePickerTheme`)

![Screenshot 2023-08-18 at 14 57 37](https://github.com/flutter/flutter/assets/48603081/c95160e2-76a2-4bb5-84e0-3731fce19c0b)

### After (action buttons use the style from the `TimePickerTheme`)

![Screenshot 2023-08-18 at 14 57 18](https://github.com/flutter/flutter/assets/48603081/422d348a-bee2-4696-8d9a-5fce56191aaa)
2023-08-30 22:21:29 +00:00
Taha Tesser
1e770c3808
Add cancelButtonStyle & confirmButtonStyle to the DatePickerThemeData (#132847)
fixes [Unable to adjust the color for "Cancel" and "Ok" button in datePicker dialog](https://github.com/flutter/flutter/issues/127739)

### 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(
        useMaterial3: true,
        datePickerTheme: DatePickerThemeData(
          cancelButtonStyle: TextButton.styleFrom(
            shape: const RoundedRectangleBorder(
              borderRadius: BorderRadius.all(Radius.circular(16)),
              side: BorderSide(color: Colors.red),
            ),
            backgroundColor: Colors.white,
            foregroundColor: Colors.red,
            elevation: 3,
            shadowColor: Colors.red,
          ),
          confirmButtonStyle: TextButton.styleFrom(
            shape: const RoundedRectangleBorder(
              borderRadius: BorderRadius.all(Radius.circular(16)),
            ),
            backgroundColor: Colors.green[700],
            foregroundColor: Colors.white,
            elevation: 3,
            shadowColor: Colors.green[700],
          ),
        ),
      ),
      home: const Example(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: DatePickerDialog(
          initialDate: DateTime.now(),
          firstDate: DateTime(2020),
          lastDate: DateTime(2030),
        ),
      ),
    );
  }
}
``` 

</details>

### Before 

Not possible to customize action buttons from the `DatePickerThemeData`.

### After 

![Screenshot 2023-08-18 at 16 42 00](https://github.com/flutter/flutter/assets/48603081/4ec01e93-c661-491d-9253-d687da8b76f3)
2023-08-30 21:16:13 +00:00
Renzo Olivares
4b89fce108
Fixing memory leak in EditableTextState (#131377) 2023-08-30 12:49:56 -07:00
Bruno Leroux
b23105276f
Expose barrierDismissible in PageRoute constructor (#133659)
## Description

This PR exposes `barrierDismissible` in `PageRoute`, `MaterialPageRoute` and `CupertinoPageRoute` constructors.
Setting this property to true will enable the escape key binding.

## Related Issue

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

## Tests

Adds one test.
2023-08-30 19:02:06 +00:00
LongCatIsLooong
7f3abea35a
Reland "Remove ImageProvider.load, DecoderCallback and PaintingBinding.instantiateImageCodec (#132679) (reverted in #133482) (#133605)
Relanding the commit per
https://github.com/flutter/flutter/pull/133482#issuecomment-1698030976

## 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].
- [ ] 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-08-30 11:28:10 -07:00
Bruno Leroux
1fe24956ac
Update SelectableRegion test for M3 (#129627)
## Description

This PR  fixes one selectable region test failure when switching to M3.
The failure is somewhat tricky because it is related to the M3 typography (line height set to 1.43).

## Related Issue

fixes https://github.com/flutter/flutter/issues/129626

## Tests

Updates 1 test.
2023-08-30 13:25:35 +00:00
Xilai Zhang
6fd42536b7
[flutter roll] Revert "Fix Chip.shape's side is not used when provided in Material 3" (#133615)
Reverts flutter/flutter#132941
context: b/298110031

The rounded rectangle borders don't appear in some of the internal
golden image tests.
2023-08-29 19:59:02 -07:00
Polina Cherkasova
4736cd3d37
Fix one notDisposed leak and mark another. (#133595) 2023-08-29 23:08:48 +00:00
Hans Muller
4022864c65
Added DropdownMenuEntry.labelWidget (#133491) 2023-08-29 13:01:49 -07:00
Mouad Debbar
9a9c2826d1
[web] Migrate remaining web-only API usages to dart:ui_web (#132248)
This is the last batch of web-only API migration.

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

Fixes https://github.com/flutter/flutter/issues/52899
Fixes https://github.com/flutter/flutter/issues/126831
2023-08-29 18:56:07 +00:00
Polina Cherkasova
ae64abc614
ShortcutManager should dispatch creation in constructor. (#133487) 2023-08-29 10:40:20 -07:00
Taha Tesser
d8d7e019c1
Add FAB Additional Color Mappings example (#133453)
fixes [Additional color mappings for FAB in Material 3](https://github.com/flutter/flutter/issues/130702)

### Preview
![image](https://github.com/flutter/flutter/assets/48603081/a6f9aef6-af80-41ce-8e59-50f095db047d)
2023-08-29 17:31:02 +00:00
Dan Field
f489256fce
Fix bug in setPreferredOrientations example (#133503)
The `ui.Display` is a simple data class (like `MediaQueryData`), and does not get updated when the display size changes.  The provided sample code does not work as intended, but the update does.
2023-08-29 06:29:05 +00:00
Polina Cherkasova
bd1583f3e5
FocusNode and FocusManager should dispatch creation in constructor. (#133490) 2023-08-28 16:19:32 -07:00
Polina Cherkasova
e8df434956
PlatformRouteInformationProvider should dispatch creation in constructor. (#133492) 2023-08-28 15:51:01 -07:00
Zachary Anderson
7772f6b05a
Revert "Remove ImageProvider.load, DecoderCallback and `PaintingB… (#133482)
…inding.instantiateImageCodec` (#132679)"

This reverts commit b4f4ece40d956ad86efa340ff7fe9d0fa6deea07.

Trial revert for https://github.com/flutter/flutter/issues/133398

Co-authored-by: LongCatIsLooong <31859944+LongCatIsLooong@users.noreply.github.com>
2023-08-28 15:39:10 -07:00
Renzo Olivares
ca33836b45
Fix context menu button color on Android when textButtonTheme is set (#133271)
Fixes #133027

When setting a `textButtonTheme` it should not override the native context menu colors.

```dart
  theme: ThemeData(
    textButtonTheme: const TextButtonThemeData(
      style: ButtonStyle(
        backgroundColor: MaterialStatePropertyAll<Color>(
            Color(0xff05164d)), // blue color
      ),
    ),
  ),
```

Before|After
--|--
<img width="341" alt="Screenshot 2023-08-24 at 1 17 25 PM" src="https://github.com/flutter/flutter/assets/948037/30ea0ef8-b41a-4e1f-93a3-50fcd87ab2bf">|<img width="341" alt="Screenshot 2023-08-24 at 1 15 35 PM" src="https://github.com/flutter/flutter/assets/948037/5f59481c-aa5d-4850-aa4b-daa678e54044">
2023-08-28 22:27:39 +00:00
Taha Tesser
a0943e6533
Fix DatePickerDialog & DateRangePickerDialog overflow when resized from landscape to portrait (#133327)
fixes [resize window with a `showDateRangePicker` will make RenderFlex overflowed error](https://github.com/flutter/flutter/issues/131989)

### Description
- This fixes  `DatePickerDialog` & `DateRangePickerDialog` overflow error when resized from landscape to portrait.
- Added tests that check these two widgets from landscape to portrait for no overflow errors.

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('DatePicker & DateRangePicker'),
      ),
      body: MediaQuery(
        data: MediaQuery.of(context).copyWith(
          size: _portait ? const Size(400, 800) : const Size(800, 400),
        ),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: [
            DatePickerDialog(
              initialDate: DateTime.now(),
              firstDate: DateTime(2020),
              lastDate: DateTime(2030),
              initialEntryMode: DatePickerEntryMode.inputOnly,
            ),
            DateRangePickerDialog(
              currentDate: DateTime.now(),
              firstDate: DateTime(2020),
              lastDate: DateTime(2030),
              initialEntryMode: DatePickerEntryMode.inputOnly,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          setState(() {
            _portait = !_portait;
          });
        },
        child: const Icon(Icons.refresh),
      ),
    );
  }
}

```

</details>

### Before

https://github.com/flutter/flutter/assets/48603081/81387cbb-cdcf-42bd-b4f8-b7a08317c955

### After

https://github.com/flutter/flutter/assets/48603081/36d28ea9-cfed-48ad-90f5-0459755e08c0
2023-08-28 20:52:54 +00:00
Victoria Ashworth
f1f46ef2d3
Revert "PlatformRouteInformationProvider should dispatch creation in constructor." (#133479)
Reverts flutter/flutter#133353

Tree is failing on Mac and Linux customer_testing on this PR.
https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20customer_testing/14646/overview
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20customer_testing/14974/overview
2023-08-28 18:13:21 +00:00
Victoria Ashworth
76d6d36b7a
Revert "FocusNode and FocusManager should dispatch creation in constructor." (#133474)
Reverts flutter/flutter#133352

Tree is failing on Mac and Linux customer_testing on this PR.
https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20customer_testing/14646/overview
https://ci.chromium.org/ui/p/flutter/builders/prod/Linux%20customer_testing/14974/overview
2023-08-28 17:50:22 +00:00
Victoria Ashworth
ec387a467a
Revert "ShortcutManager should dispatch creation in constructor." (#133472)
Reverts flutter/flutter#133356

Tree is failing on customer_testing on this PR.
https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20customer_testing/14646/overview
2023-08-28 17:34:23 +00:00
Polina Cherkasova
703d60b5e9
FocusNode and FocusManager should dispatch creation in constructor. (#133352) 2023-08-28 09:38:19 -07:00
Polina Cherkasova
cf91262f75
ShortcutManager should dispatch creation in constructor. (#133356) 2023-08-28 09:38:05 -07:00
Justin McCandless
dfd4147cea
Fix stuck predictive back platform channel calls (#133368)
Fix a Google test flakiness increase.
2023-08-28 09:23:52 -07:00
Salmanul Farisi.M
69f61a289e
added option to change color of heading row(flutter#132428) (#132728)
Paginated datatable widget cannot give color to table header
 
fixes #132428

---------

Co-authored-by: Hans Muller <hansmuller@google.com>
2023-08-28 08:51:56 -07:00
Polina Cherkasova
2ea5296616
PlatformRouteInformationProvider should dispatch creation in constructor. (#133353) 2023-08-28 08:46:10 -07:00
Polina Cherkasova
343000b6e9
_SelectableFragment should dispatch creation in constructor. (#133351) 2023-08-25 17:03:47 -07:00
Chinmoy
347f7bac94
Adds callback onWillAcceptWithDetails in DragTarget. (#131545)
This PR adds onWillAcceptWithDetails callback to DragTarget to get information about offset.

Fixes: #131378 

This PR is subject to changes based on #131542
2023-08-25 21:24:05 +00:00
Kate Lovett
721016c1db
Remove deprecated androidOverscrollIndicator from ScrollBehaviors (#133181) 2023-08-25 15:13:42 -05:00
gmilou
40af7db6bb
Add an example showing how to use a MatrixTransition. (#132874) 2023-08-25 15:09:58 -05:00
Taha Tesser
ea00521939
Fix PopupMenuItem with a ListTile doesn't use the correct style. (#133141)
fixes [`PopupMenuItem` with a `ListTile`  doesn't use the correct text style.](https://github.com/flutter/flutter/issues/133138)

### Description

This fixes an issue text style issue for `PopupMenuItem` with a `ListTile` (for an elaborate popup menu) 

https://api.flutter.dev/flutter/material/PopupMenuItem-class.html

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

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

/// Flutter code sample for [PopupMenuButton].

// This is the type used by the popup menu below.
enum SampleItem { itemOne, itemTwo, itemThree }

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        useMaterial3: true,
        textTheme: const TextTheme(
          labelLarge: TextStyle(
            fontStyle: FontStyle.italic,
            fontWeight: FontWeight.bold,
          ),
        ),
      ),
      home: const PopupMenuExample(),
    );
  }
}

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

  @override
  State<PopupMenuExample> createState() => _PopupMenuExampleState();
}

class _PopupMenuExampleState extends State<PopupMenuExample> {
  SampleItem? selectedMenu;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: SizedBox(
          width: 300,
          height: 130,
          child: Align(
            alignment: Alignment.topLeft,
            child: PopupMenuButton<SampleItem>(
              initialValue: selectedMenu,
              // Callback that sets the selected popup menu item.
              onSelected: (SampleItem item) {
                setState(() {
                  selectedMenu = item;
                });
              },
              itemBuilder: (BuildContext context) =>
                  <PopupMenuEntry<SampleItem>>[
                const PopupMenuItem<SampleItem>(
                  value: SampleItem.itemOne,
                  child: Text('PopupMenuItem'),
                ),
                const CheckedPopupMenuItem<SampleItem>(
                  checked: true,
                  value: SampleItem.itemTwo,
                  child: Text('CheckedPopupMenuItem'),
                ),
                const PopupMenuItem<SampleItem>(
                  value: SampleItem.itemOne,
                  child: ListTile(
                    leading: Icon(Icons.cloud),
                    title: Text('ListTile'),
                    contentPadding: EdgeInsets.zero,
                    trailing: Icon(Icons.arrow_right_rounded),
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
``` 

</details>

### Before

![Screenshot 2023-08-23 at 14 08 48](https://github.com/flutter/flutter/assets/48603081/434ac95e-2981-4ab5-9843-939b39d771a2)

### After

![Screenshot 2023-08-23 at 14 08 32](https://github.com/flutter/flutter/assets/48603081/f6aba7e0-3d03-454f-8e0b-c031492f3f2d)
2023-08-25 14:49:04 +00:00
Taha Tesser
612117a690
Fix Chip.shape's side is not used when provided in Material 3 (#132941)
fixes [Chip border side color not working in Material3](https://github.com/flutter/flutter/issues/132922)

### 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(
        useMaterial3: true,
        chipTheme: const ChipThemeData(
            // shape: RoundedRectangleBorder(
            //   side: BorderSide(color: Colors.amber),
            //   borderRadius: BorderRadius.all(Radius.circular(12)),
            // ),
            // side: BorderSide(color: Colors.red),
            ),
      ),
      home: const Example(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      body: Center(
        child: RawChip(
          shape: RoundedRectangleBorder(
            side: BorderSide(color: Colors.amber),
            borderRadius: BorderRadius.all(Radius.circular(12)),
          ),
          // side: BorderSide(color: Colors.red),
          label: Text('Chip'),
        ),
      ),
    );
  }
}

``` 

</details>

---

### Before

When `RawChip.shape` is provided with a `BorderSide`.

```dart
      body: Center(
        child: RawChip(
          shape: RoundedRectangleBorder(
            side: BorderSide(color: Colors.amber),
            borderRadius: BorderRadius.all(Radius.circular(12)),
          ),
          label: Text('Chip'),
        ),
      ),
```

![Screenshot 2023-08-24 at 17 54 54](https://github.com/flutter/flutter/assets/48603081/89e2c9b5-44c2-432e-97ff-8bb95b0d0fb1)

When `RawChip.shape` is provided with a `BorderSide` and also `RawChip.side` is provided. The  `RawChip.side` overrides the shape's side.

```dart
      body: Center(
        child: RawChip(
          shape: RoundedRectangleBorder(
            side: BorderSide(color: Colors.amber),
            borderRadius: BorderRadius.all(Radius.circular(12)),
          ),
          side: BorderSide(color: Colors.red),
          label: Text('Chip'),
        ),
      ),
```

![Screenshot 2023-08-24 at 17 55 37](https://github.com/flutter/flutter/assets/48603081/938803cc-d514-464b-b06b-e4841b9ad040)

---

### After

When `RawChip.shape` is provided with a `BorderSide`.

```dart
      body: Center(
        child: RawChip(
          shape: RoundedRectangleBorder(
            side: BorderSide(color: Colors.amber),
            borderRadius: BorderRadius.all(Radius.circular(12)),
          ),
          label: Text('Chip'),
        ),
      ),
```

![Screenshot 2023-08-24 at 17 51 29](https://github.com/flutter/flutter/assets/48603081/d6fcaaa9-8f5d-4180-ad14-062dd459ec45)

When `RawChip.shape` is provided with a `BorderSide` and also `RawChip.side` is provided. The  `RawChip.side` overrides the shape's side.

```dart
      body: Center(
        child: RawChip(
          shape: RoundedRectangleBorder(
            side: BorderSide(color: Colors.amber),
            borderRadius: BorderRadius.all(Radius.circular(12)),
          ),
          side: BorderSide(color: Colors.red),
          label: Text('Chip'),
        ),
      ),
```

![Screenshot 2023-08-24 at 17 52 31](https://github.com/flutter/flutter/assets/48603081/3fa46341-43f0-4fe7-a922-f1d8ba34028c)

---
2023-08-25 14:47:08 +00:00
Tomasz Gucio
5c17a37b0b
Dispose overlay entries (#132826) 2023-08-25 14:35:49 +02:00
Ian Hickson
d6bf1447f4
Update the tool to know about all our new platforms (#132423)
...and add a test so we remember to keep it in sync.
2023-08-24 21:54:59 +00:00
Ian Hickson
5fa8de05ee
l10n-related documentation improvements (#133114) 2023-08-24 21:54:56 +00:00
Henry Riehl
b211891876
Add hover duration for Inkwell widget (#132176)
Adds a `hoverDuration` property to the `Inkwell` widget. This allows the user to customise how long the change in colour animates between the default colour and the hovered colour.

https://github.com/flutter/flutter/assets/73116038/2e7c5ccb-8651-4e08-8c7b-225cc005d594

Fixes #132170
2023-08-24 21:45:21 +00:00
Polina Cherkasova
afa37891cf
Users of ChangeNotifier should dispatch event of object creation in constructor. (#133210) 2023-08-24 13:41:57 -07:00
LongCatIsLooong
b4f4ece40d
Remove ImageProvider.load, DecoderCallback and PaintingBinding.instantiateImageCodec (#132679)
~The failing plugin tests should pass once
https://github.com/flutter/packages/pull/4725 lands and rolls into
flutter/flutter~

google tests are migrated.

Part of https://github.com/flutter/flutter/issues/133171

## 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].
- [ ] 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-08-24 12:38:27 -07:00
Kate Lovett
87c1a461e1
Remove deprecated PlatformViewsService.synchronizeToNativeViewHierarchy (#133175)
Part of https://github.com/flutter/flutter/issues/133171
2023-08-23 23:52:19 +00:00
Kate Lovett
8c69fd550c
Remove deprecated MaterialButtonWithIconMixin (#133173)
Part of https://github.com/flutter/flutter/issues/133171
2023-08-23 23:06:14 +00:00
Polina Cherkasova
89907f6da3
Enable ChangeNotifier clients to dispatch event of object creation in constructor. (#133060) 2023-08-23 15:55:28 -07:00
Michael Goderbauer
382ceb5707
Enable literal_only_boolean_expressions (#133186)
Blocking issue (https://github.com/dart-lang/linter/issues/453) for this lint has been resolved.
2023-08-23 21:35:54 +00:00
Ian Hickson
88290989a1
Reference AppLifecycleListener from widgets library (#132995) 2023-08-23 04:13:15 +00:00
Taha Tesser
1bc791697c
Update default menu text styles for Material 3 (#131930)
Related https://github.com/flutter/flutter/issues/131676

## Description

#### Fix default input text style for `DropdownMenu`

![dropdown_input](https://github.com/flutter/flutter/assets/48603081/301f8243-155a-4b8f-84a8-5e6b7bebb3bc)

### Fix default text style for  `MenuAnchor`'s menu items (which `DropdownMenu` uses for menu items)

![dropdown_item](https://github.com/flutter/flutter/assets/48603081/6b5be81a-72fc-4705-a577-074c7a4cad8f)

###  Default  `DropdownMenu` Input text style 

![Screenshot 2023-08-04 at 16 48 28](https://github.com/flutter/flutter/assets/48603081/bcd9da98-e74d-491e-ae64-6268ae0b3893)

### Default `DropdownMenu` menu item text style

![Screenshot 2023-08-04 at 16 50 19](https://github.com/flutter/flutter/assets/48603081/9592ca43-2854-45b5-8648-203ab65d9745)

### Default `MenuAnchor` menu item text style

![Screenshot 2023-08-04 at 14 34 28](https://github.com/flutter/flutter/assets/48603081/e87e1073-05f8-4dc7-a435-d864e9cce6ab)

### Code sample

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

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

/// Flutter code sample for [DropdownMenu]s. The first dropdown menu has an outlined border.

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

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

  @override
  State<DropdownMenuExample> createState() => _DropdownMenuExampleState();
}

class _DropdownMenuExampleState extends State<DropdownMenuExample> {
  final TextEditingController colorController = TextEditingController();
  final TextEditingController iconController = TextEditingController();
  ColorLabel? selectedColor;
  IconLabel? selectedIcon;

  @override
  Widget build(BuildContext context) {
    final List<DropdownMenuEntry<ColorLabel>> colorEntries =
        <DropdownMenuEntry<ColorLabel>>[];
    for (final ColorLabel color in ColorLabel.values) {
      colorEntries.add(
        DropdownMenuEntry<ColorLabel>(
            value: color, label: color.label, enabled: color.label != 'Grey'),
      );
    }

    final List<DropdownMenuEntry<IconLabel>> iconEntries =
        <DropdownMenuEntry<IconLabel>>[];
    for (final IconLabel icon in IconLabel.values) {
      iconEntries
          .add(DropdownMenuEntry<IconLabel>(value: icon, label: icon.label));
    }

    return MaterialApp(
      theme: ThemeData(
        useMaterial3: true,
        colorSchemeSeed: Colors.green,
        // textTheme: const TextTheme(
        //   bodyLarge: TextStyle(
        //     fontWeight: FontWeight.bold,
        //     fontStyle: FontStyle.italic,
        //     decoration: TextDecoration.underline,
        //   ),
        // ),
      ),
      home: Scaffold(
        body: SafeArea(
          child: Column(
            children: <Widget>[
              const Text('DropdownMenus'),
              Padding(
                padding: const EdgeInsets.symmetric(vertical: 20),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    DropdownMenu<ColorLabel>(
                      controller: colorController,
                      label: const Text('Color'),
                      dropdownMenuEntries: colorEntries,
                      onSelected: (ColorLabel? color) {
                        setState(() {
                          selectedColor = color;
                        });
                      },
                    ),
                    const SizedBox(width: 20),
                    DropdownMenu<IconLabel>(
                      controller: iconController,
                      enableFilter: true,
                      leadingIcon: const Icon(Icons.search),
                      label: const Text('Icon'),
                      dropdownMenuEntries: iconEntries,
                      inputDecorationTheme: const InputDecorationTheme(
                        filled: true,
                        contentPadding: EdgeInsets.symmetric(vertical: 5.0),
                      ),
                      onSelected: (IconLabel? icon) {
                        setState(() {
                          selectedIcon = icon;
                        });
                      },
                    ),
                  ],
                ),
              ),
              const Text('Plain TextFields'),
              Padding(
                padding: const EdgeInsets.symmetric(vertical: 20),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    SizedBox(
                      width: 150,
                      child: TextField(
                          controller: TextEditingController(text: 'Blue'),
                          decoration: const InputDecoration(
                            suffixIcon: Icon(Icons.arrow_drop_down),
                            labelText: 'Color',
                            border: OutlineInputBorder(),
                          )),
                    ),
                    const SizedBox(width: 20),
                    SizedBox(
                      width: 150,
                      child: TextField(
                          controller: TextEditingController(text: 'Smile'),
                          decoration: const InputDecoration(
                            prefixIcon: Icon(Icons.search),
                            suffixIcon: Icon(Icons.arrow_drop_down),
                            filled: true,
                            labelText: 'Icon',
                          )),
                    ),
                  ],
                ),
              ),
              if (selectedColor != null && selectedIcon != null)
                Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Text(
                        'You selected a ${selectedColor?.label} ${selectedIcon?.label}'),
                    Padding(
                      padding: const EdgeInsets.symmetric(horizontal: 5),
                      child: Icon(
                        selectedIcon?.icon,
                        color: selectedColor?.color,
                      ),
                    )
                  ],
                )
              else
                const Text('Please select a color and an icon.')
            ],
          ),
        ),
      ),
    );
  }
}

enum ColorLabel {
  blue('Blue', Colors.blue),
  pink('Pink', Colors.pink),
  green('Green', Colors.green),
  yellow('Yellow', Colors.yellow),
  grey('Grey', Colors.grey);

  const ColorLabel(this.label, this.color);
  final String label;
  final Color color;
}

enum IconLabel {
  smile('Smile', Icons.sentiment_satisfied_outlined),
  cloud(
    'Cloud',
    Icons.cloud_outlined,
  ),
  brush('Brush', Icons.brush_outlined),
  heart('Heart', Icons.favorite);

  const IconLabel(this.label, this.icon);
  final String label;
  final IconData icon;
}

``` 
	
</details>
2023-08-22 22:21:00 +00:00
Taha Tesser
db89df51c3
Fix FlexibleSpaceBar.title doesn't respect the leading widget (#132573)
fixes [Long `FlexibleSpaceBar.title` doesn't respect the leading widget 
](https://github.com/flutter/flutter/issues/132030)

### Description

- This adds `FlexibleSpaceBarSettings.hasLeading` for the `FlexibleSpaceBar`'s title to respect the leading widget.
- Use the new `FlexibleSpaceBarSettings.hasLeading` property in the  `SliverAppBar` for its `FlexibleSpaceBar`.

### 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(
        useMaterial3: true,
        brightness: Brightness.dark,
      ),
      home: const Example(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          const Text('TargetPlatform.Android'),
          Theme(
            data: Theme.of(context).copyWith(
              platform: TargetPlatform.android,
            ),
            child: Container(
              height: 250,
              padding: const EdgeInsets.all(8),
              decoration: BoxDecoration(
                border: Border.all(
                  color: Colors.amber,
                  width: 4,
                ),
              ),
              child: const AppBarLeading(
                showLeading: true,
                showTitle: false,
              ),
            ),
          ),
          const Text('TargetPlatform.iOS'),
          Theme(
            data: Theme.of(context).copyWith(
              platform: TargetPlatform.iOS,
            ),
            child: Container(
              height: 250,
              padding: const EdgeInsets.all(8),
              decoration: BoxDecoration(
                border: Border.all(
                  color: Colors.amber,
                  width: 2,
                ),
              ),
              child: const AppBarLeading(
                showLeading: true,
                showTitle: false,
              ),
            ),
          ),
        ],
      ),
    );
  }
}

class AppBarLeading extends StatelessWidget {
  const AppBarLeading({
    super.key,
    required this.showLeading,
    required this.showTitle,
  });

  final bool showLeading;
  final bool showTitle;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      drawer: const Drawer(),
      body: CustomScrollView(
        slivers: [
          SliverAppBar(
            automaticallyImplyLeading: showLeading,
            iconTheme: const IconThemeData(
              color: Colors.amber,
            ),
            title: showTitle ? const Text('AppBar') : null,
            flexibleSpace: FlexibleSpaceBar(
              title: Text('Title ' * 15),
              // centerTitle: true,
            ),
            toolbarHeight: showTitle ? 170 : 100,
          ),
        ],
      ),
    );
  }
}
``` 
	
</details>

### Before 

![Screenshot 2023-08-15 at 18 11 34](https://github.com/flutter/flutter/assets/48603081/4b798998-8549-43aa-b564-933ea14f494c)

### After

![Screenshot 2023-08-15 at 18 11 45](https://github.com/flutter/flutter/assets/48603081/b085a33a-db7d-40d4-8a12-ee37197b5bd4)
2023-08-22 20:47:05 +00:00
Justin McCandless
0278671bda
Fix memory leak in Form (#132987)
Diposes some restorable variables that weren't disposed before.
2023-08-22 10:23:13 -07:00
Kate Lovett
a5b06f15a0
Fix visual overflow for SliverMainAxisGroup (#132989)
Fixes https://github.com/flutter/flutter/issues/132788

The SliverGeometry was not set properly for SliverMainAxisGroup. Omitting hasVisualOverflow affected the Viewport's choice to apply a clip, leading to the sliver being rendered outside of the bounds of the viewport.
2023-08-22 01:46:23 +00:00
Justin McCandless
8e95ee2e96
Docs on iOS's directional quote characters (#132869)
When you type a single or double quote character on the default iOS keyboard, it doesn't actually insert the usual `'` or `"`.  Instead, it inserts a directional version that tries to match with others.  This is very tricky when allow/deny-listing characters, so I've added a section about this to the docs.

Fixes https://github.com/flutter/flutter/issues/132232
2023-08-21 19:02:33 +00:00