Commit Graph

189 Commits

Author SHA1 Message Date
Hans Muller
0d4b5ae122
Dev, examples/api, etc updated for Material 3 by default (#129683)
Updated tests in dev, examples/api, and tests/widgets to ensure that
they continue to pass when the default for `ThemeData.useMaterial3` is
changed to true.

This is the final set of changes required for
https://github.com/flutter/flutter/issues/127064.
2023-06-28 09:41:58 -07:00
Qun Cheng
c3b2175a40
Update golden tests (#128914) 2023-06-15 13:09:43 -07:00
Greg Spencer
a280346193
Add AppLifecycleListener, with support for application exit handling (#123274)
## Description

This adds `AppLifecycleListener`, a class for listening to changes in the application lifecycle, and responding to requests to exit the application.

It depends on changes in the Engine that add new lifecycle states: https://github.com/flutter/engine/pull/42418

Here's a diagram for the lifecycle states. I'll add a similar diagram to the documentation for these classes.

![Application Lifecycle Diagram](https://github.com/flutter/flutter/assets/8867023/f6937002-cb93-4ab9-a221-25de2c45cf0e)

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

## Tests
- Added tests for new lifecycle value, as well as for the `AppLifecycleListener` itself.
2023-06-08 22:57:19 +00:00
Tae Hyung Kim
f2351f61d4
Sliver Main Axis Group (#126596)
This widget implements the ability to place slivers one after another in
a single ScrollView in a way that all child slivers are drawn within the
bounds of the group itself (i.e. SliverPersistentHeaders aren't drawn
outside of the scroll extent provided by all of the child slivers). The
design document for SliverMainAxisGroup can be found
[here](https://docs.google.com/document/d/1e2bdLSYV_Dq2h8aHpF8mda67aOmZocPiMyjCcTTZhTg/edit?resourcekey=0-Xj2X2XA3CAFae22Sv3hAiA).

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

## Pre-launch Checklist

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

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

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

---------

Co-authored-by: Kate Lovett <katelovett@google.com>
2023-06-08 15:54:09 -07:00
Greg Spencer
36f73cf645
Disable context menu (#128365)
## Description

Changes the context menu example for `MenuAnchor` so that it uses right-click, or (on macOS and iOS only) ctrl-left-click, for the context menu. Also disables the browser context menu on web platforms.

## Tests
 - Updated test to reflect new triggers.
2023-06-07 23:40:17 +00:00
Leigha Jarett
6c8cf3a9d0
Migration guide for moving from BottomNavigationBar to NavigationBar (#128263)
Fixes https://github.com/flutter/flutter/issues/127213
2023-06-06 03:52:07 +00:00
Hans Muller
4464d09db0
Updated TabBar and ToggleButtons examples (#128088)
Updated the ToggleButtons example and test to M3.

Updated the nested tabs test to avoid warnings like:
```
Warning: A call to tap() with finder "exactly one widget with type "Tab" which is an ancestor of text "Explore": Tab(text: "Explore", icon: Icon)" derived an Offset (Offset(666.7, 92.0)) that would not hit test on the specified widget.
```
2023-06-02 01:05:31 +00:00
Hans Muller
14136ae319
Updated custom ListTile examples (#128071) 2023-06-01 16:21:42 -07:00
Hans Muller
f0e32fc6ca
Updated Menu examples (#128080) 2023-06-01 15:27:34 -07:00
Hans Muller
420f442e5c
Updated InputDecoratorExamples for M3 (#128065) 2023-06-01 15:22:03 -07:00
Hans Muller
1a098ae8eb
Revised Floating Action Button examples (#128058)
Of the original 4 examples, the first 3 mostly covered the same API features and occupied quite a bit of real-estate at the top of https://api.flutter.dev/flutter/material/FloatingActionButton-class.html.  Additionally the illustrations and the code samples didn't match in some cases.

Replaced examples 0,1,2 with one example that changes attributes of the FAB when it's pushed. 

Fixes https://github.com/flutter/flutter/issues/128048
2023-06-01 22:16:48 +00:00
Taha Tesser
9bce790162
Updated the ToggleButtons API doc to link to SegmentedButton (#127021)
fixes https://github.com/flutter/flutter/issues/124884
2023-05-27 00:27:19 +00:00
Taha Tesser
c05a05e6fc
Add ScrollNotificationObserver sample (#127023)
fixes https://github.com/flutter/flutter/issues/126702

### Preview

https://github.com/flutter/flutter/assets/48603081/4c529a0d-b8a5-4950-9095-429f1c5eccbb
2023-05-25 15:58:52 +00:00
LongCatIsLooong
1b800fd496
Remove Tooltip mouse tracker listener & update hovering/MouseRegion logic & animation (#119199)
Fixes https://github.com/flutter/flutter/issues/117627

### Behavior changes:
1. If fade in/fade out animation is already in progress, hiding/showing the tooltip will immediately take effect without waiting for `waitDuration`.
2. A PointerDownEvent that doesn't become a part of a "trigger" gesture dismisses the tooltip, even for hovered ones.
3. The OverlayEntry is now updated only when the previous tooltip was completely dismissed. This can be fixed by OverlayPortal but I'm not sure what the correct behavior is.
2023-05-25 07:24:45 +00:00
Sun Jiao
7b67aa587a
make suggestionsBuilder in SearchAnchor asyncable (#127019) 2023-05-24 13:12:47 -07:00
Justin McCandless
f6f5bb9023
Fix bug in Autocomplete example (#127219)
This example was incorrectly throwing away results from a query when multiple queries were pending at once.   Thanks to @sun-jiao in https://github.com/flutter/flutter/pull/127019#issuecomment-1552347037 for pointing this out.

I also added a quick  `Text` widget explaining what to do to use the examples.  Since there are only three small possible `options`, it's easy to type into the field and not get any results and wonder what's wrong.
2023-05-22 16:55:21 +00:00
Justin McCandless
9d882983ff
Autocomplete async examples (#126283)
Added examples clarifying how to fetch Autocomplete options asynchronously.
2023-05-17 09:46:26 -07:00
Kate Lovett
27caa7fed9
Add ScrollController.onAttach & onDetach, samples/docs on listening/getting scrolling info (#124823)
This PR does a couple of things!

https://user-images.githubusercontent.com/16964204/231897483-416287f9-50ce-468d-a714-2a4bc0f2e011.mov

![Screenshot 2023-04-13 at 3 24 28 PM](https://user-images.githubusercontent.com/16964204/231897497-f5bee17d-43ed-46e5-acd7-e1bd64768274.png)

Fixes #20819 
Fixes #41910 
Fixes #121419

### Adds ScrollController.onAttach and ScrollController.onDetach

This resolves a long held pain point for developers. When using a scroll controller, there is not scroll position until the scrollable widget is built, and almost all methods of notification are only triggered when scrolling happens. Adding these two methods will help developers gain access to the scroll position when it is created. A common workaround for this was using a post frame callback to access controller.position after the first frame, but this is ripe for issues such as having multiple positions attached to the controller, or the scrollable no longer existing after that post frame callback. I think this can also be helpful for folks to debug cases when the scroll controller has multiple positions attached.

In particular, this also resolves this commented case: https://github.com/flutter/flutter/issues/20819#issuecomment-417784218
The isScrollingNotifier is hard for developers to access.

### Docs & samples

I was surprised we did not have samples on scroll notification or scroll controller, so I overhauled it and added a lot of docs on all the different ways to access scrolling information, when it is available and how they differ.
2023-05-15 21:01:06 +00:00
Taha Tesser
12659f2a7b
Fix MultiChildLayoutDelegate.hasChild doc (#126433)
fixes https://github.com/flutter/flutter/issues/115898

`hasChild` checks `_idToChild` map.  `_idToChild` is not assigned until `_callPerformLayout` is called.
So `hasChild` shouldn't be called in `getSize`.

df789c9e76/packages/flutter/lib/src/rendering/custom_layout.dart (L400-L404)

Updated docs and example class names.
2023-05-11 14:59:07 +00:00
Istiak Ahmed
042eaf6b90
Add sample code for SliverAppBar (#125785)
This PR adds an another example for SliverAppBar, showing the use of stretch and onStretchTrigger

https://user-images.githubusercontent.com/68919043/235420973-2bfb9871-9e05-4d87-9538-941d43178c76.mp4

Fixes #125651 

### Adds sample code for SliverAppBar [stretch, onStretchTrigger]

This PR adds an another simple and easily understandable example code for SliverAppBar.
2023-05-05 18:09:25 +00:00
Bruno Leroux
de2615462c
Add a ReorderableListView example with cards + cleanup existing tests (#126155)
## Description

This PR adds one `ReorderableListView` example to demonstrate how `proxyDecorator` can be used to animate cards elevation.

https://user-images.githubusercontent.com/840911/236468570-d2b33ab3-6b6d-4f8d-90de-778dcf1ad8ce.mp4

For motivation, see https://github.com/flutter/flutter/issues/124729#issuecomment-1521524190.

## Related Issue

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

## Tests

Adds 1 tests.

This PR also moves some misplaced example tests from `examples/api/test/reorderable_list` to `examples/api/test/material/reorderable_list` (and replaces two existing ones).
2023-05-05 16:39:11 +00:00
Tae Hyung Kim
1a0b03cb25
Sliver Cross Axis Group (#123862)
This widget implements the ability to place slivers side by side in a single ScrollView so that they scroll together. The design document for `SliverCrossAxisGroup` can be found [here](https://docs.google.com/document/d/1e2bdLSYV_Dq2h8aHpF8mda67aOmZocPiMyjCcTTZhTg/edit?resourcekey=0-Xj2X2XA3CAFae22Sv3hAiA).

Fixes #56756.
2023-04-28 23:41:58 +00:00
Tae Hyung Kim
482d1aaf13
Sliver Constrained Cross Axis (#125239)
Reimplements what we reverted here: #125233.
2023-04-24 23:17:36 +00:00
Tae Hyung Kim
9caabdd220
Revert "Sliver Constrained Cross Axis" (#125233)
Going to make some changes to the implementation so I'll revert in the meantime.

Reverts flutter/flutter#124337
2023-04-20 18:47:50 +00:00
Mitchell Goodwin
bd2617ecb9
Adaptive alert dialog (#124336)
Fixes #102811. Adds an adaptive constructor to AlertDialog, along with the adaptive function showAdaptiveDialog.

<img width="357" alt="Screenshot 2023-04-06 at 10 40 18 AM" src="https://user-images.githubusercontent.com/58190796/230455412-31100922-cfc5-4252-b8c6-6f076353f29e.png">
<img width="350" alt="Screenshot 2023-04-06 at 10 42 50 AM" src="https://user-images.githubusercontent.com/58190796/230455454-363dd37e-c44e-4aca-b6a0-cfa1d959f606.png">
2023-04-18 23:00:03 +00:00
Qun Cheng
6e85113418
Add an example for SearchBar (#124992)
This PR is to: 
* Update API doc for `SearchBar`.
* Add an example to show how to use a `SearchBar` as the builder of the `SearchAnchor`.
2023-04-17 23:23:57 +00:00
chunhtai
cc9ffd3f3b
SelectionContainer's listeners can remove itself during listener call… (#124624)
When swapping out delegate of  selectioncontainer, if the newly passed in delegate doesn't have any selectable content(which is usually the case), the selectioncontainerstate will notify all of the listeners. One of the listener would be SelectionRegistrant._updateSelectionRegistrarSubscription, and since it doesn't have content, it would remove itself from the listener which causes concurrent modification
2023-04-17 23:19:11 +00:00
Tae Hyung Kim
3c18f57480
Sliver Constrained Cross Axis (#124337)
Sliver Constrained Cross Axis
2023-04-10 21:15:48 +00:00
Ian Hickson
806c1f8186
Deprecate these old APIs (#116793)
Deprecate these old APIs
2023-04-06 19:53:50 +00:00
Loïc Sharma
6058e95919
Add CallbackShortcuts example (#123944)
Add CallbackShortcuts example
2023-04-05 22:17:59 +00:00
Greg Spencer
e3bc8efd39
Rename Sample classes (#124080)
Rename Sample classes
2023-04-04 20:34:29 +00:00
Kate Lovett
dd7d4b9521
Fix docs and error messages for scroll directions + sample code (#123819)
Fix docs and error messages for scroll directions + sample code
2023-03-31 23:46:59 +00:00
Mitchell Goodwin
84078c856f
Create CupertinoRadio Widget (#123296)
Create CupertinoRadio Widget
2023-03-30 15:43:36 +00:00
Vinny
f44064991d
Modified TextField docs - Replaced 'labelText' to 'hintText' in code snippet (#94128)
Modified TextField docs - Replaced 'labelText' to 'hintText' in code snippet
2023-03-29 20:02:33 +00:00
Simon Binder
c71f1dd76b
Treat hidden IndexedStack children as offstage for test finder (#123129)
Treat hidden `IndexedStack` children as offstage for test finder
2023-03-29 19:58:58 +00:00
Hans Muller
59c9d4e845
Added ExpansionTileController (#123298)
Added ExpansionTileController
2023-03-24 00:51:06 +00:00
Pierre-Louis
02d5c7595b
Add support for secondary tab bar (#122756)
Add support for secondary tab bar
2023-03-23 22:49:59 +00:00
Michael Goderbauer
fda9ecfef7
Remove 1745 decorative breaks (#123259)
Remove 1745 decorative breaks
2023-03-22 21:12:22 +00:00
Greg Spencer
bcdab118ba
Add support for application exit requests (#121378)
Add support for application exit requests
2023-03-17 15:35:55 +00:00
Bruno Leroux
3b4a882b61
Add one DefaultTextStyle example (#122182)
Add one DefaultTextStyle example
2023-03-08 20:40:54 +00:00
Bruno Leroux
a5ed960d0b
SystemUiOverlayStyle, add examples and improve documentation (#122187)
SystemUiOverlayStyle, add two examples and improve documentation
2023-03-08 20:31:59 +00:00
Bruno Leroux
961df985fa
Add ZoomPageTransitionsBuilder.allowSnapshotting (#122019)
Add ZoomPageTransitionsBuilder.allowSnapshotting
2023-03-06 22:43:00 +00:00
Bruno Leroux
a4ecd3e2f1
Cleanup PageTransitionsTheme documentation and add one example (#121701)
Cleanup PageTransitionsTheme documentation and add one example
2023-03-02 20:47:53 +00:00
LongCatIsLooong
e7ab3b07f8
OverlayPortal (#105335)
`OverlayPortal`
2023-03-02 17:34:01 +00:00
Taha Tesser
87679ff1c3
Update date picker examples, remove unused variables and add missing tests (#121528)
Update date picker examples, remove unused variables and add missing tests
2023-02-28 08:31:51 +00:00
Skandar Munir
681b72c304
fixes Show Week Day in CupertinoDatePicker with CupertinoDatePickerMo… (#120052)
fixes Show Week Day in CupertinoDatePicker with CupertinoDatePickerMo…
2023-02-28 01:52:51 +00:00
Taha Tesser
9a4e897965
Add OverflowBox example and update existing examples under basic.dart (#121213)
Add `OverflowBox` example and update existing examples under `basic.dart`
2023-02-27 18:52:00 +00:00
Taha Tesser
219ff64574
Reland "Update ExpansionTile to support Material 3 & add an example" (#121212) 2023-02-24 06:30:33 -08:00
Lioness100
26b6c1bedd
Fix typos (#121171)
* Fix typos

* lowercase animated & opacity

* Undo typo fix

---------

Co-authored-by: Michael Goderbauer <goderbauer@google.com>
2023-02-23 19:43:21 +00:00
Mushaheed Syed
7d85a585da
Add ActionButtonIconsData for overriding action icons (#118229)
* Add ActionButtonIconsData for overriding action icons

* Fix formatting issues

* Add missing exports in material library and add copyWith method in ActionButtonIconsData

* Move all action buttons, and icons to action_buttons.dart

* Rename actionButtonIcons to actionIconTheme

* Refactor buttons in action_buttons.dart to extend a private class for common implementation

* Refactor icons in action_buttons

* Fix docs in action_buttons_theme

* Fix #107646 always use 'Icons.arrow_back' as a back_button icon in web

* Update documentation for action buttons and add style parameter to every action button

* Fix analyzer warnings

* Add missing style argument in IconButton of _ActionButton

* Add tests for action buttons, action icon theme, drawer buttons, and back buttons

* Add example (+test) for action icon button's action icon theme in examples/api

* Fix analysis errors

* Add missing license header in action_icon_theme.0.dart

* Fix deprecation notice in theme_data.dart

* Update theme data tests for actionIconTheme

* Remove iconSize parameter from ActionButtons and update docs

* Fix failing tests

* Update button color during backbutton tests to red

* Fix analytics issues

* Fix format
2023-02-22 09:22:44 -08:00