11201 Commits

Author SHA1 Message Date
Polina Cherkasova
1f0730e67a
DraggableScrollableActuator should dispose notifier. (#133917) 2023-09-06 22:07:07 +00:00
Burak İmdat
cd9a257d74
Fix subtitleTextStyle.color isn't applied to the ListTile.subtitle in Material 2 (#133422)
The difference between header text style and subtitle text style and the reason why it doesn't work is the code difference below. If we make the subtitle text style the same as the title text style it will work

<details>
  <summary>Title Text Style</summary>
  
  ###  All Code
  
  ```dart
  TextStyle titleStyle = titleTextStyle
      ?? tileTheme.titleTextStyle
      ?? defaults.titleTextStyle!;
    final Color? titleColor = effectiveColor;
    titleStyle = titleStyle.copyWith(
      color: titleColor,
      fontSize: _isDenseLayout(theme, tileTheme) ? 13.0 : null,
    );
    final Widget titleText = AnimatedDefaultTextStyle(
      style: titleStyle,
      duration: kThemeChangeDuration,
      child: title ?? const SizedBox(),
    );
  ```
  
  ## Different Code Section
  
  ```dart
  final Color? titleColor = effectiveColor;
  ```
</details>

<details>
  <summary>Subtitle Text Style</summary>
  
  ## All Code
  
  ```dart
  subtitleStyle = subtitleTextStyle
        ?? tileTheme.subtitleTextStyle
        ?? defaults.subtitleTextStyle!;
      final Color? subtitleColor = effectiveColor
        ?? (theme.useMaterial3 ? null : theme.textTheme.bodySmall!.color);
      subtitleStyle = subtitleStyle.copyWith(
        color: subtitleColor,
        fontSize: _isDenseLayout(theme, tileTheme) ? 12.0 : null,
      );
      subtitleText = AnimatedDefaultTextStyle(
        style: subtitleStyle,
        duration: kThemeChangeDuration,
        child: subtitle!,
      );
  ```
  
  ## Different Code Section
  
  ```dart
  final Color? subtitleColor = effectiveColor
        ?? (theme.useMaterial3 ? null : theme.textTheme.bodySmall!.color);
  ```

### Description for code 
- The value `theme.textTheme.bodySmall!.color` is given because the `effectiveColor` value is `null` and the `theme.useMaterial3` value is `false`
</details>

<details>
  <summary>Problem solved code</summary>
  
  ## All Code
  
  ```dart
  subtitleStyle = subtitleTextStyle
        ?? tileTheme.subtitleTextStyle
        ?? defaults.subtitleTextStyle!;
      final Color? subtitleColor = effectiveColor;
      subtitleStyle = subtitleStyle.copyWith(
        color: subtitleColor,
        fontSize: _isDenseLayout(theme, tileTheme) ? 12.0 : null,
      );
      subtitleText = AnimatedDefaultTextStyle(
        style: subtitleStyle,
        duration: kThemeChangeDuration,
        child: subtitle!,
      );
  ```
</details>

<details>
<summary>Screenshot of the result after making the necessary change</summary>
<img src="https://github.com/flutter/flutter/assets/70351342/b552fd4c-fdcd-4bf5-b4ba-d6b2cfe527cc" width=250>
</details>

#133412

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
2023-09-06 18:54:45 +00:00
Tirth
b0e5a5ca67
Add CheckedPopupMenuItem.onTap callback (#134000)
Adds parent prop `onTap` to CheckedPopupMenuItem.

Fixes #127800
2023-09-06 18:33:00 +00:00
Polina Cherkasova
61a388a448
Fix not disposed items in Cupertino app and route. (#134085) 2023-09-06 09:14:57 -07:00
Polina Cherkasova
03b60ac75b
_DropdownMenuState should dispose TextEditingController. (#133914) 2023-09-06 08:12:10 -07:00
Polina Cherkasova
a425e56252
Revert "CupertinoAlertDialog should not create ScrollController on every build, if null values are passed in constructor." (#134071)
Reverts flutter/flutter#133918 as it causes build failures.
2023-09-05 21:03:54 +00:00
Polina Cherkasova
e30f9c4218
Revert "_SearchBarState should dispose FocusNode, if it created it." (#134072)
Reverts flutter/flutter#133947 as it causes build failures.
2023-09-05 21:03:53 +00:00
Polina Cherkasova
a7dbec31f1
Cover more tests with leak tracking. (#133958) 2023-09-05 13:45:12 -07:00
Polina Cherkasova
7625c10f44
_MaterialAppState should dispose MaterialHeroController. (#133951) 2023-09-05 13:41:10 -07:00
Polina Cherkasova
af1b7494d8
RenderParagraph should dispose instances of SelectableFragments. (#133915) 2023-09-05 13:40:14 -07:00
Polina Cherkasova
c9f70e9fd2
_SearchBarState should dispose FocusNode, if it created it. (#133947) 2023-09-05 13:12:28 -07:00
Polina Cherkasova
7cdf314d06
CupertinoAlertDialog should not create ScrollController on every build, if null values are passed in constructor. (#133918) 2023-09-05 13:01:51 -07:00
Polina Cherkasova
cb0a613ec6
SegmentedButton should not create new MaterialStatesController in every build. (#133949) 2023-09-05 11:00:22 -07:00
Renzo Olivares
ef9befc9da
Reland leak fix for EditableTextState (#133806)
Relands: https://github.com/flutter/flutter/pull/131377
Reverted in: https://github.com/flutter/flutter/pull/133804
2023-09-03 18:23:20 +00:00
Zachary Anderson
3896912d44
Fix for new analyzer lint (#133923)
For https://github.com/flutter/flutter/issues/133922
2023-09-02 12:47:28 -07:00
Polina Cherkasova
248645a2b2
RestorableProperty should dispatch creation in constructor. (#133883) 2023-09-01 17:59:25 -07:00
chunhtai
0f3bd90d9b
Adds a parent scope TraversalEdgeBehavior and fixes modal route to no… (#130841)
…t trap the focus

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

Several things I done:

1. add new enum `parentScope`
2. refactor _sortAllDescendants so that it doesn't recursively looking
into its descendant when it encounter a FocusScopeNode.
3. When the nextFocus try to focus into a FocusScopeNode, it will try to
find the first focusable FocusNode in traversal order and focus it
instead if it doesn't have a first focus.
4. Change the default in Navigator to always be `parentScope`
5. Only the root navigator will use `leaveFlutterView` if platform is
web.


Previously 2 and 3 are not needed because once a focusscope trapped the
focus, there isn't a chance where the parent focusscope have to deal
with next focus.

If we don't do 2 and 3 after the change, it will cause it to stuck in
the current scope again. Because once the focus leave the current scope,
it needs to also remove the first focus in that scope (so that it can
start fresh when focus traversal back to the scope in the future). At
this point the current scope will have the primary focus without the
first focus. The parent scope will then try to find the next focus, and
it will place the focus to the first traversal child in the current
scope again.

## 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-09-01 08:37:38 -07:00
Mark O'Sullivan
1b1c8a1607
Fixed PaginatedDataTable not using dataRowMinHeight and dataRowMaxHeight from Theme (#133634)
`PaginatedDataTable` will now make use of `dataRowMinHeight` and `dataRowMaxHeight` from the Theme

*List which issues are fixed by this PR. You must list at least one issue.*

Resolves #133633
2023-09-01 15:36:48 +00:00
Bruno Leroux
e326199923
Add more documentation for SystemChannels.keyboard getKeyboardState (#133663)
## Description

This PR adds some documentation to SystemChannels.keyboard getKeyboardState.
This method was added in https://github.com/flutter/flutter/pull/122885.

## Related Issue

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

## Tests

Documentation only.
2023-09-01 09:24:33 +00:00
Bruno Leroux
510ecaa4e7
Fix MaterialState.pressed is missing when pressing button with keyboard (#133558)
## Description

This PR fixes changes how `InkWell` reacts to keyboard activation. 

**Before**: the activation started a splash and immediately terminated it which did not let time for widgets that resolve material state properties to react (visually it also mean the splash does not have time to expand).

**After**: the activation starts and terminates after a delay (I arbitrary choose 200ms for the moment).

## Related Issue

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

## Tests

Adds one test.
2023-09-01 09:08:21 +00:00
Andrea Cioni
400702d1d6
Add an example for InputChip generated by user input (#130645)
New example for `InputChip` that demonstrate how to create/delete them based on user text inputs.

The sample application shows a custom text area where user can enter text. After the user has typed and hits _Enter_ the text will be replaced with an `InputChip` that contains that text. Is it possible to continue typing and add more chips in this way. All of them will be placed in a scrollable horizontal row. Also is it possible to have suggestion displayed below the text input field in case the typed text match some of the available suggestions.

Issue I'm trying to solve:

- https://github.com/flutter/flutter/issues/128247

**Code structure:**

The example app is composed of 2 main components that find places inside `MainScreen`:

 - `ChipsInput`
 - `ListView`

`ChipsInput` emulates a `TextField` where you can enter text. This text field accepts also a list of values of generic type T (`Topping` in my example), that gets rendered as `InputChip` inside the text field, before the text inserted by the user. This widgets is basically an `InputDecorator` widget that implements `TextInputClient` to get `TextEditingValue` events from the user keyboard. At the end of the input field there is another component, the `TextCursor`, that is displayed just when the user give the focus to the field and emulates the carrets that `TextField` has.

There are also some available callbacks that the user can use to capture events in the `ChipsInput` field like: `onChanged`, `onChipTapped`, `onSubmitted` and `onTextChanged`. This last callback is used to build a list of suggestion that will be placed just below the `ChipsInput` field inside the `ListView`.
2023-09-01 00:02:04 +00:00
Kate Lovett
cf051e7db2
Fix clipBehavior ignored in Scrollable of SingleChildScrollView (#133696)
Fixes https://github.com/flutter/flutter/issues/133330

The clipBehavior was not passed to the underlying Scrollable, which informs things like the clip on the StretchingOverscrollIndicator.
2023-08-31 23:50:39 +00:00
Polina Cherkasova
956999a4b9
Make Route dispatching memory events. (#133721) 2023-08-31 16:23:44 -07:00
yaakovschectman
e6e44de33c
Add MacOS AppKitView class. (#132583)
Add derived classes from the Darwin platform view base classes for
MacOS. Functionality is largely the same as the `UiKitView`, but the two
are decoupled and and can further diverge in the future as needed. Some
unit tests remain skipped for now as the gesture recognizers for MacOS
are not yet implemented.

https://github.com/flutter/flutter/issues/128519

## 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].
- [ ] I signed the [CLA].
- [x] I listed at least one issue that this PR fixes in the description
above.
- [x] I updated/added relevant documentation (doc comments with `///`).
- [x] I added new tests to check the change I am making, or this PR is
[test-exempt].
- [x] All existing and new tests are passing.

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

<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#overview
[Tree Hygiene]: https://github.com/flutter/flutter/wiki/Tree-hygiene
[test-exempt]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#tests
[Flutter Style Guide]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo
[Features we expect every widget to implement]:
https://github.com/flutter/flutter/wiki/Style-guide-for-Flutter-repo#features-we-expect-every-widget-to-implement
[CLA]: https://cla.developers.google.com/
[flutter/tests]: https://github.com/flutter/tests
[breaking change policy]:
https://github.com/flutter/flutter/wiki/Tree-hygiene#handling-breaking-changes
[Discord]: https://github.com/flutter/flutter/wiki/Chat

---------

Co-authored-by: Chris Bracken <chris@bracken.jp>
2023-08-31 17:48:12 -04:00
Renzo Olivares
acdcbae78a
Revert "Fixing memory leak in EditableTextState" (#133804)
Reverts flutter/flutter#131377

reverting because of internal google testing failures b/298310760
2023-08-31 20:42:52 +00:00
Taha Tesser
f32b6fed24
Fix cursorColor with an opacity is not respected (#133548)
fixes [`cursorColor` with an opacity  is not respected](https://github.com/flutter/flutter/issues/132886)

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

```dart
import "package:flutter/material.dart";
// import "package:flutter/scheduler.dart";

// final color = Colors.red;
const color = Color(0x55ff0000);

void main() {
  // timeDilation = 4;
  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> {
  late FocusNode _focusNode;
  late TextEditingController _controller;

  @override
  void initState() {
    super.initState();
    _focusNode = FocusNode();
    _controller = TextEditingController(text: 'Hello World');
  }

  @override
  void dispose() {
    _focusNode.dispose();
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    const bool cursorOpacityAnimates = false;
    double cursorWidth = 6;

    return Scaffold(

      body: Center(
        child: Padding(
          padding: const EdgeInsets.symmetric(
            horizontal: 16,
          ),
          child: Column(
            children: <Widget>[
              const Spacer(),
              const Text('EditableText'),
              const SizedBox(height: 8),
              InputDecorator(
                decoration: InputDecoration(
                  border: OutlineInputBorder(
                    borderRadius: BorderRadius.circular(8),
                  ),
                ),
                child: EditableText(
                  cursorColor: color,
                  cursorWidth: cursorWidth,
                  cursorOpacityAnimates: cursorOpacityAnimates,
                  focusNode: _focusNode,
                  controller: _controller,
                  style: Theme.of(context).textTheme.bodyLarge!,
                  backgroundCursorColor: Colors.amber,
                  onSubmitted: (String value) {
                    // Add your code here.
                  },
                ),
              ),
              const Spacer(),
              const Text('TextField'),
              const SizedBox(height: 8),
              TextField(
                cursorColor: color,
                cursorWidth: cursorWidth,
                cursorOpacityAnimates: cursorOpacityAnimates,
                controller: _controller,
                focusNode: _focusNode,
                onSubmitted: (String value) {
                  // Add your code here.
                },
              ),
              const Spacer(),
            ],
          ),
        ),
      ),
    );
  }
}
```

</details>

### Before

![Screenshot 2023-08-29 at 14 57 57](https://github.com/flutter/flutter/assets/48603081/cd55bb74-23b8-4980-915d-f13dee22a50f)

### After
![Screenshot 2023-08-29 at 14 58 20](https://github.com/flutter/flutter/assets/48603081/c94af4e3-f24b-44e7-bbed-7c6c21e90f2a)
2023-08-31 19:49:06 +00:00
Polina Cherkasova
c1256d5353
_FocusTraversalGroupNode should communicate creation in constructor. (#133717) 2023-08-31 10:18:19 -07:00
Polina Cherkasova
54402ae375
_ResetNotifier should communicate creation in constructor. (#133716) 2023-08-31 10:18:04 -07:00
Kostia Sokolovskyi
414bff1403
ScrollController creation dispatching for memory leaks tracking (#133759) 2023-08-31 08:52:06 -07:00
Delwin Mathew
dd1ee24fc2
InputDecorationTheme.isCollapsed doesn't work if InputDecoration.isCollapsed is not provided. (#133189)
`appleDefault` method didn't include setting values for non-null (here `isCollapsed`) parameters initially, which has been updated and documented in this commit.

Existing and new tests are passing.

Fixes #133144
2023-08-31 13:29:18 +00:00
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