Martin Kustermann
354902f7ca
[web] Pass --no-source-maps
instead of --extra-compiler-option=--no-source-maps
to dart compile wasm
( #153417 )
2024-08-14 12:00:24 +02:00
PurplePolyhedron
593729165d
Move @_debugOnly
documentation in framework.dart
to be more visible to IDE. ( #153134 )
...
Change the location of the documentation of `@_debugOnly` following the style of `@override` so it is visible to IDE where the annotation is used.
2024-08-14 01:13:34 +00:00
flutter-pub-roller-bot
5f99d5782a
Roll pub packages ( #153380 )
...
This PR was generated by `flutter update-packages --force-upgrade`.
2024-08-13 19:12:24 +00:00
Victor Sanni
cc5d08bc79
Make CupertinoButton interactive by keyboard shortcuts ( #153126 )
...
This should have been added with https://github.com/flutter/flutter/pull/150721 .
2024-08-12 23:14:05 +00:00
Jason Simmons
5a04b4dda9
Disable DevTools when running the hot restart integration test in flutter_tools ( #153247 )
...
When DevTools is active HotRunner.attach makes a deferred RPC to a DevTools service. That RPC appears to cause issues if it executes at the wrong time during the hot restart.
Passing the --no-devtools flag works around this by disabling the RPC.
See https://github.com/flutter/flutter/issues/153049
2024-08-12 19:57:22 +00:00
Jamie Kerber
dae3a87d93
Implemented CupertinoButton new styles/sizes ( fixes #92525 ) ( #152845 )
...
This PR fixes #92525 and introduces the following changes according to [latest iOS HIG](https://developer.apple.com/design/human-interface-guidelines/buttons#iOS-iPadOS ):
- `CupertinoButton` now has a `size` property (type `enum CupertinoButtonSize`, values sm/md/lg, default `lg`) that allows the devs to apply new iOS 15+ button styles
- Previously `CupertinoButton` had a larger padding when no background color was specified. With the new HIG, that is no longer the case
- `CupertinoButton` now has a `.tinted` constructor that renders a translucent background (transparency % is brightness-dependent) and uses a different foreground color compared to `.filled`
- `CupertinoButton` now uses the `actionTextStyle` TextStyle from the given theme
- `CupertinoButton`'s child IconTheme's size will always be x1.2 the given TextStyle's size
- `CupertinoTextThemeData` now has a `actionSmallTextStyle` property to use with small buttons (including a default `_kDefaultActionSmallTextStyle` TextStyle)
Preview & example:

> **NOTE**: there is a discrepancy in dark mode button foreground color between the default CupertinoTheme and the HIG. A separate issue will be opened for this.
~EDIT: issue reported here https://github.com/flutter/flutter/issues/152846~
EDIT2: fixed by #153039 !

## Example
```dart
import 'package:flutter/cupertino.dart';
const Widget body = Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Icon(
CupertinoIcons.play_fill,
),
Text("Play"),
],
);
void main() =>
runApp(
CupertinoApp(
home: Container(
child: Wrap(
direction: Axis.horizontal,
children: <Widget>[
// header
Text(''),
Text('Plain'),
Text('Grey'),
Text('Tinted'),
Text('Filled'),
// small
Text('Small'),
CupertinoButton(
child: body,
onPressed: () {},
size: CupertinoButtonSize.small,
),
CupertinoButton.tinted(
child: body,
onPressed: () {},
size: CupertinoButtonSize.small,
color: CupertinoColors.systemGrey,
),
CupertinoButton.tinted(
child: body,
onPressed: () {},
size: CupertinoButtonSize.small,
),
CupertinoButton.filled(
child: body,
onPressed: () {},
size: CupertinoButtonSize.small,
),
// medium
Text('Medium'),
CupertinoButton(
child: body,
onPressed: () {},
size: CupertinoButtonSize.medium,
),
CupertinoButton.tinted(
child: body,
onPressed: () {},
size: CupertinoButtonSize.medium,
color: CupertinoColors.systemGrey,
),
CupertinoButton.tinted(
child: body,
onPressed: () {},
size: CupertinoButtonSize.medium,
),
CupertinoButton.filled(
child: body,
onPressed: () {},
size: CupertinoButtonSize.medium,
),
// large
Text('Large'),
CupertinoButton(
child: body,
onPressed: () {},
size: CupertinoButtonSize.large,
),
CupertinoButton.tinted(
child: body,
onPressed: () {},
color: CupertinoColors.systemGrey,
size: CupertinoButtonSize.large,
),
CupertinoButton.tinted(
child: body,
onPressed: () {},
size: CupertinoButtonSize.large,
),
CupertinoButton.filled(
child: body,
onPressed: () {},
size: CupertinoButtonSize.large,
),
].map((Widget w) => SizedBox(width: 110, height: 70, child: Center(child: w))).toList(),
),
)
),
);
```
*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-08-12 19:26:39 +00:00
flutter-pub-roller-bot
2f0415f37b
Roll pub packages ( #153297 )
...
This PR was generated by `flutter update-packages --force-upgrade`.
2024-08-12 18:41:58 +00:00
Kishan Rathore
33c05da7a0
Refactor: Deprecate inactiveColor from cupertino checkbox ( #152981 )
...
Refactor: Deprecate `inactiveColor` from cupertino checkbox
Fixes #151252
2024-08-12 18:29:07 +00:00
Gray Mackall
814e49be49
Upgrade module template AGP version ( #151675 )
...
Follow up to https://github.com/flutter/flutter/pull/151433 .
2024-08-12 18:17:41 +00:00
Chris Bracken
c375dd8d72
[iOS] Copy Flutter.framework.dSYM into app archive ( #153215 )
...
As of Xcode 16, App Store validation now requires that apps uploaded to the App store bundle dSYM debug information bundles for each Framework they embed.
dSYM bundles are packaged in the Flutter.xcframework shipped in the `ios-release` tools archive as of engine patches:
* https://github.com/flutter/engine/pull/54414
* https://github.com/flutter/engine/pull/54458
This copies the Flutter.framework.dSYM bundle from the tools cache to the app archive produced by `flutter build ipa`.
Issue: https://github.com/flutter/flutter/issues/116493
2024-08-10 16:39:04 +00:00
Bruno Leroux
5609019500
Expose affixes icon constraints in InputDecorationTheme ( #153089 )
...
## Description
This PR makes the existing `InputDecoration.prefixIconConstraints` and `InputDecoration.suffixIconConstraints` configurable from an `InputDecorationTheme`.
## Related Issue
Related to https://github.com/flutter/flutter/issues/138691 (this is needed before providing a fix or a workaround for it).
## Tests
Update and split one existing test into two different tests.
Update the existing test related to debugFillDescription by adding all the non tested properties.
2024-08-09 22:04:56 +00:00
Justin McCandless
ed47c4bb1f
Spell check range error ( #153055 )
...
Fixed a bug in spell checkers, especially custom ones, where deleting characters rapidly threw an error.
2024-08-09 13:52:06 -07:00
Victor Sanni
0c9b2e5832
Move Cupertino focus constants to cupertino/constants.dart ( #153115 )
2024-08-09 17:34:11 +00:00
Alexander Aprelev
22e6af6b81
Fix tests expectations regarding new lines. ( #153174 )
...
Fixes https://github.com/flutter/flutter/issues/153163
Dart sdk change that affected tests is
e8c035308b
2024-08-09 10:31:48 -07:00
Martin Kustermann
493c453d57
Make ios_deploy_test.dart more robust ( #153147 )
...
The test should not assume that a stream of bytes delivers them in a
certain chunked order (e.g. all bytes of a line are delivered in one
chunk and the newline comes in another chunk).
Instead it should use a line splitter to obtain individual lines and can
match those against expectations.
This fragile test is broken after [0] which combines writing a string
together with the newline instead of seperately.
[0] https://dart-review.googlesource.com/c/sdk/+/378024
2024-08-09 12:53:15 +02:00
Jenn Magder
6c3677c6e9
Remove -sdk for watchOS simulator in tool ( #152992 )
...
Fix the xcodebuild flags mixing up the iOS and watchOS simulators.
Confirmed this passed in CI on Xcode 16 beta 5: https://github.com/flutter/flutter/pull/152408
Fixes https://github.com/flutter/flutter/issues/152983
See also https://github.com/flutter/flutter/pull/152347
2024-08-08 19:34:20 +00:00
Kevin Moore
a04ecb2b72
Roll pub packages [manual] ( #153066 )
2024-08-08 17:08:07 +00:00
Jason Simmons
d23be7a07d
[web] Fix reading of the --local-web-sdk flag and remove the copy of useLocalWebSdk in DebuggingOptions ( #152642 )
2024-08-08 16:27:21 +00:00
yim
14cd5fa30a
The PopupMenuButton
should not steal focus from the TextField when it appears. ( #150568 )
...
Fixes : #24843
Fixes : #50567
2024-08-08 16:09:18 +00:00
LouiseHsu
51606f99a4
Fix flutter build ipa --export-method
not accepting enterprise
flag ( #153047 )
...
When implementing the fix for https://github.com/flutter/flutter/issues/149369 , I missed accounting for the `enterprise` flag for `flutter build ipa` ð¬
Fixes https://github.com/flutter/flutter/issues/153000
2024-08-08 16:07:27 +00:00
Bruno Leroux
64b373b1f2
Clean up MenuAnchor ( #152946 )
...
## Description
This PR cleans up some typos and formatting issues in the `material/menu_anchor.dart` file and associated tests.
2024-08-07 23:39:24 +00:00
James Kerber
dc4d64c9c2
Set default Cupertino primaryContrastingColor
to white ( #153039 )
...
**Fixes #152846 in accordance with iOS HIG**
Previously the `_CupertinoThemeDefaults _kDefaultTheme` would set the `primaryContrastingColor` to `CupertinoColors.systemBackground`, which was white-ish in light mode, and black-ish in dark mode. That was in accordance with Apple Design Resources from 5 years ago.
> Before:
> <img width="594" alt="image" src="https://github.com/user-attachments/assets/63e88abb-6933-446f-a7ba-55109d0f353c ">
As of now, iOS HIG suggests that the `primaryContrastingColor` (in combination with the currently default `primaryColor: CupertinoColors.systemBlue`) be white (regardless of light/dark modes, contrast, elevation, etc.)
> After:
> <img width="594" alt="image" src="https://github.com/user-attachments/assets/2a48f22b-a886-46dd-aada-6d157cb4ac06 ">
Example code:
```dart
import 'package:flutter/cupertino.dart';
import 'package:flutter/widgets.dart';
void main() =>
runApp(
CupertinoApp(
theme: CupertinoThemeData(
brightness: Brightness.dark,
),
home: Center(child:
CupertinoButton.filled(
onPressed: () {},
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(CupertinoIcons.add),
Text('Add'),
],
),
)
)
)
);
```
2024-08-07 23:33:23 +00:00
Tyler Holland
88fa6210ad
Allow dropdown_menu to accept any EdgeInsetsGeometry ( #153053 )
...
Allow dropdown_menu to accept any EdgeInsetsGeometry instead of just strictly EdgeInsets.
This follows normal Flutter widget practices when accepting a padding parameter, like Container: https://github.com/flutter/flutter/blob/main/packages/flutter/lib/src/widgets/container.dart#L307C9-L307C27
Fixes https://github.com/flutter/flutter/issues/151769
2024-08-07 21:38:34 +00:00
Jenn Magder
715e476545
Add xcresulttool --legacy flag for deprecated usage ( #152988 )
...
Workaround to add the `--legacy` flag until https://github.com/flutter/flutter/issues/151502 can adopt the non-deprecated usage.
This will allow Xcode errors to be parseable again.
Fixes https://github.com/flutter/flutter/issues/152989
2024-08-07 19:59:11 +00:00
Yegor
e8d2e5814e
[web] hide the --web-renderer option in the tool ( #152683 )
...
Hide the `--web-renderer` option in the Flutter Tool. The defaults already cover all fully supported modes:
- `flutter build web` provides canvaskit + dart2js
- `flutter build web --wasm` provides skwasm + dart2wasm
We do not want to encourage production usage of any other permutations (e.g. `auto` or `html`), in particular those that simply do not work (e.g. `skwasm` + dart2js).
Fixes https://github.com/flutter/flutter/issues/140096
Fixes https://github.com/flutter/flutter/issues/151786
2024-08-07 18:40:58 +00:00
Michael Goderbauer
7c8feb94a5
Doc imports again ( #152958 )
...
https://github.com/flutter/flutter/issues/150800
The only remaining reports of `comment_references` are now because of the known issues listed in https://github.com/flutter/flutter/issues/150800 .
2024-08-07 18:32:37 +00:00
davidhicks980
1f4c6ebc97
MenuAnchor hover traversal fixes ( #150914 )
...
Fixes https://github.com/flutter/flutter/issues/150910 and https://github.com/flutter/flutter/issues/150911 .
https://github.com/flutter/flutter/issues/150910 is fixed by invalidating the focus scope whenever a hover occurs. I'm interested to hear of better fixes -- it feels a bit extreme to invalidate the focus scope so often.
https://github.com/flutter/flutter/issues/150911 is fixed by replacing TextButton.onHover with MouseRegion.onHover and MouseRegion.onExit. The issue appears to be that MouseRegion.onEnter is called on scroll, whereas MouseRegion.onHover is not. I'm not confident this is a great solution, so please let me know if you all have any suggestions!
@Piinks @dkwingsmt
2024-08-07 17:43:00 +00:00
Kishan Rathore
0f7bceb9c4
Style: Rename CupertinoSwitch activeColor and trackColor to activeTrackColor and InactiveTrackColor ( #151367 )
...
Style: Rename CupertinoSwitch `activeColor` and `trackColor` to `activeTrackColor` and `InactiveTrackColor`
Resolves #151256
2024-08-07 17:42:57 +00:00
Bruno Leroux
d595e98d85
Fix PageController throws when changing page before viewPortDimensions are set ( #153017 )
...
## Description
This PR fixes `PageController` throwing when using `jumpToPage` or `animateToPage` to switch page before the viewport dimensions were retrieved.
Solution based on https://github.com/flutter/flutter/pull/152947#discussion_r1706203170 .
## Related Issue
Fixes https://github.com/flutter/flutter/issues/86222 .
Fixes https://github.com/flutter/flutter/issues/152079
## Tests
Adds 2 tests.
2024-08-07 16:45:53 +00:00
auto-submit[bot]
72432c3f15
Reverts "[tool] Guard process writes to frontend server in ResidentCompiler
( #152358 )" ( #153028 )
...
Reverts: flutter/flutter#152358
Initiated by: zanderso
Reason for reverting: Speculative revert to determine whether this PR is related to https://github.com/flutter/flutter/issues/153026
Original PR Author: andrewkolos
Reviewed By: {christopherfujino}
This change reverts the following previous change:
Contributes to fixing https://github.com/flutter/flutter/issues/137184 .
Cleaned up version of earlier PR, https://github.com/flutter/flutter/pull/152187 .
This PR guards all the writes to `Process::stdin` by wrapping them with `ProcessUtils.writelnToStdinUnsafe`. This way, if any writes fail, we should at least get a stacktrace in our crash reporting.
2024-08-07 16:11:26 +00:00
Renzo Olivares
0a7f8af6d1
Support clearing selection programmatically through SelectableRegionState ( #152882 )
...
This change exposes:
* `SelectableRegionState.clearSelection()` to allow a user to programmatically clear the selection.
* `SelectionAreaState`/`SelectionAreaState.selectableRegion` to allow a user to access public API in `SelectableRegion` from `SelectionArea`.
Fixes #126980
2024-08-06 23:05:03 +00:00
Andrew Kolos
d848262fc4
[tool] Guard process writes to frontend server in ResidentCompiler
( #152358 )
...
Contributes to fixing https://github.com/flutter/flutter/issues/137184 .
Cleaned up version of earlier PR, https://github.com/flutter/flutter/pull/152187 .
This PR guards all the writes to `Process::stdin` by wrapping them with `ProcessUtils.writelnToStdinUnsafe`. This way, if any writes fail, we should at least get a stacktrace in our crash reporting.
2024-08-06 21:51:48 +00:00
Zachary Anderson
c4e19962bb
Fix Linux_android_emu tests late initialization errors ( #152932 )
...
This does not fix the issue underlying
https://github.com/flutter/flutter/issues/152684 , but may prevent `adb
logcat` from ending before we've captured the logs that explain why the
app or emulator are potentially crashing.
Fixes Fixes https://github.com/flutter/flutter/issues/152899
2024-08-06 14:48:50 -07:00
davidhicks980
faabe3af72
[material/menu_anchor.dart] MenuAnchor focus refactoring for RawMenuAnchor ( #150950 )
...
This PR is aimed at (1) reducing the private API surface of _MenuAnchorState to make migration into RawMenuAnchor simpler, and (2) fixing focus-related bugs.
Directional focus handling was moved from MenuAnchor (_MenuDirectionalFocusAction, _MenuNextFocusAction, and _MenuPreviousFocusAction) into SubmenuButton (_SubmenuDirectionalFocusAction). MenuAnchor now behaves similarly to a flat FocusScope, which makes it easier to customize. A future PR will ideally expose or remove the remaining internals (_lastItemFocusNode, _firstItemFocusNode, _isRoot, etc). All previous framework tests are passing, and additional tests were added for fixes (MenuAnchor tab traversal, reopened menus not being focusable), and to test MenuAnchor focus behavior separately from MenuBar.
However, [one example test](https://github.com/flutter/flutter/pull/150950/files#diff-a33fa01b59d280784e7c8ed6b704bd005cde95b7d3b649dc82fd58530061a09d ) had to be changed. I'm not sure why the previous example test was working to begin with, as submenu buttons are supposed to open on focus, but this behavior was not observed in the original test.
Fixes https://github.com/flutter/flutter/issues/144381 , https://github.com/flutter/flutter/issues/150334 .
One added feature is the ability to move between top-level horizontal submenus if a horizontal movement is made on a vertical menu item that has no children in the movement direction. This behavior was observed on Google Docs, MacOS, and various other menu systems I encountered.
https://github.com/flutter/flutter/assets/59215665/04a42b8a-cc9e-4a50-9d0c-6f2d784cfc78
2024-08-06 19:04:11 +00:00
Gazal
6f98b485ec
fix: add parameter to maintainState of SearchDelegate ( #152444 )
...
Add parameter to `showSearch`, which is passed to `_SearchPageRoute` to maintain the state of the SearchDelegate.
- fix #43582
_Just contributed this change to start the conversation on how the #43582 can be addressed. Have not added tests yet._
2024-08-06 17:53:03 +00:00
Kishan Rathore
a9b2d8d6d4
Feat: Add fillColor property for cupertinoCheckbox ( #151761 )
...
Feat: Add `fillColor` property for `CupertinoCheckbox`
Required for #151252
2024-08-06 17:51:13 +00:00
Denis Bowen
93b55edff1
Slider does not show changed label value for keyboard users fix ( #152886 )
...
Fix issue to where keyboard users could not see visual indicator label of changed value in Slider
Before:
[Screen recording 2024-08-05 12.16.24 PM.webm](https://github.com/user-attachments/assets/89b99423-7856-4b25-86de-b211b2dbe178 )
After:
[Screen recording 2024-08-05 12.38.20 PM.webm](https://github.com/user-attachments/assets/641f9065-8279-4b79-89b1-b5bcd3d691a8 )
Fixes https://github.com/flutter/flutter/issues/152884
Fixes b/340638215
2024-08-06 16:58:07 +00:00
Kevin Moore
3612ba1fce
Manual dependency bump ( #152881 )
...
`package:collection` is 50+ days behind at this point which is blocking updates to a number of other packages `http_parser`, `shelf`, etc...
2024-08-06 02:40:27 +00:00
Nate Wilson
0397e890be
Implement on
clauses ( #152706 )
...
This pull request removes an `// ignore: avoid_catches_without_on_clauses` comment.
> [!NOTE]
> Diffs are super tiny if you do "hide whitespace"!
2024-08-06 01:54:52 +00:00
Michael Goderbauer
75b6a2ff6a
more docImports ( #151951 )
...
Part of https://github.com/flutter/flutter/issues/150800 .
2024-08-05 23:19:51 +00:00
Taha Tesser
00ef750d28
[Reland] Introduce double
Flex.spacing
parameter for Row
/Column
spacing ( #152890 )
...
Relands https://github.com/flutter/flutter/pull/152472 (Fixed error causing message test, maybe by https://github.com/flutter/flutter/pull/152501 )
---
fixes [add spacing parameter to Column and Row](https://github.com/flutter/flutter/issues/55378 )
### `Column.spacing` 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,
home: Scaffold(
backgroundColor: Colors.black,
body: Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: DecoratedBox(
decoration: BoxDecoration(
border: Border.all(
color: Colors.amber,
)),
child: const Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Column(
spacing: 40.0,
// ignore: avoid_redundant_argument_values
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Column(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Column(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Column(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Column(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Column(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
],
),
),
),
),
),
);
}
}
```
</details>
### Preview
<img width="1072" alt="Screenshot 2024-07-30 at 15 40 59" src="https://github.com/user-attachments/assets/14f21091-9e46-4a58-8552-1379f4ba9216 ">
### `Row.spacing` 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,
home: Scaffold(
backgroundColor: Colors.black,
body: Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: DecoratedBox(
decoration: BoxDecoration(
border: Border.all(
color: Colors.amber,
)),
child: const Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Row(
spacing: 40.0,
// ignore: avoid_redundant_argument_values
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerRight,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Row(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerRight,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Row(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerRight,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Row(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerRight,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Row(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerRight,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Row(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
],
),
),
),
),
),
);
}
}
```
</details>
### Preview
<img width="1072" alt="Screenshot 2024-07-30 at 15 39 42" src="https://github.com/user-attachments/assets/717e9f5e-a491-4853-ba74-e72ec7493363 ">
2024-08-05 23:04:50 +00:00
Qun Cheng
173bf86b7b
Fix CarouselView rebuild ( #152791 )
...
Fixes https://github.com/flutter/flutter/issues/152787
Originally, when we want to update `itemExtent`, we didn't check if the old itemExtent is null but `getItemFromPixels()` needs that information.
https://github.com/flutter/flutter/blob/master/packages/flutter/lib/src/material/carousel.dart#L1343-L1347
Then in `getItemFromPixels()`, it goes to the else statement which assert `flexWeights` is not null, then the exception happens.
- [x ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
2024-08-05 23:04:48 +00:00
Loïc Sharma
29f332c822
Add migration to git ignore SwiftPM build directories ( #152766 )
...
Opening a Swift package in Xcode generates `.build` and `.swiftpm` directories. These should be ignored as they contain intermediary build artifacts that aren't meant to be checked-in.
Part of https://github.com/flutter/flutter/issues/148018
2024-08-05 20:26:16 +00:00
auto-submit[bot]
463a1532b3
Reverts "Introduce double
Flex.spacing
parameter for Row
/Column
spacing ( #152472 )" ( #152885 )
...
Reverts: flutter/flutter#152472
Initiated by: goderbauer
Reason for reverting: Tests are failing, e.g. https://ci.chromium.org/ui/p/flutter/builders/prod/Mac%20tool_integration_tests_5_5/127/overview
Original PR Author: TahaTesser
Reviewed By: {Piinks, goderbauer, Hixie}
This change reverts the following previous change:
fixes [add spacing parameter to Column and Row](https://github.com/flutter/flutter/issues/55378 )
### `Column.spacing` 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,
home: Scaffold(
backgroundColor: Colors.black,
body: Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: DecoratedBox(
decoration: BoxDecoration(
border: Border.all(
color: Colors.amber,
)),
child: const Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Column(
spacing: 40.0,
// ignore: avoid_redundant_argument_values
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Column(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Column(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Column(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Column(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Column(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
],
),
),
),
),
),
);
}
}
```
</details>
### Preview
<img width="1072" alt="Screenshot 2024-07-30 at 15 40 59" src="https://github.com/user-attachments/assets/14f21091-9e46-4a58-8552-1379f4ba9216 ">
### `Row.spacing` 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,
home: Scaffold(
backgroundColor: Colors.black,
body: Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: DecoratedBox(
decoration: BoxDecoration(
border: Border.all(
color: Colors.amber,
)),
child: const Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Row(
spacing: 40.0,
// ignore: avoid_redundant_argument_values
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerRight,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Row(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerRight,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Row(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerRight,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Row(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerRight,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Row(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerRight,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Row(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
],
),
),
),
),
),
);
}
}
```
</details>
### Preview
<img width="1072" alt="Screenshot 2024-07-30 at 15 39 42" src="https://github.com/user-attachments/assets/717e9f5e-a491-4853-ba74-e72ec7493363 ">
2024-08-05 19:32:47 +00:00
Tirth
68983f7084
[Docs] DeviceOrientation Enum Correction ( #152876 )
...
Fixed #151371
2024-08-05 17:16:51 +00:00
Taha Tesser
48ecec16ee
Introduce double
Flex.spacing
parameter for Row
/Column
spacing ( #152472 )
...
fixes [add spacing parameter to Column and Row](https://github.com/flutter/flutter/issues/55378 )
### `Column.spacing` 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,
home: Scaffold(
backgroundColor: Colors.black,
body: Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: DecoratedBox(
decoration: BoxDecoration(
border: Border.all(
color: Colors.amber,
)),
child: const Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Column(
spacing: 40.0,
// ignore: avoid_redundant_argument_values
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Column(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Column(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Column(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Column(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Column(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.topCenter,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.bottomCenter,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
],
),
),
),
),
),
);
}
}
```
</details>
### Preview
<img width="1072" alt="Screenshot 2024-07-30 at 15 40 59" src="https://github.com/user-attachments/assets/14f21091-9e46-4a58-8552-1379f4ba9216 ">
### `Row.spacing` 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,
home: Scaffold(
backgroundColor: Colors.black,
body: Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: DecoratedBox(
decoration: BoxDecoration(
border: Border.all(
color: Colors.amber,
)),
child: const Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Row(
spacing: 40.0,
// ignore: avoid_redundant_argument_values
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerRight,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Row(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerRight,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Row(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerRight,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Row(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerRight,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Row(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerRight,
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
Row(
spacing: 40.0,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
ColoredBox(
color: Color(0xffff0000),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
'RED',
style: TextStyle(color: Colors.white),
),
),
),
),
ColoredBox(
color: Color(0xff00ff00),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Center(
child: Text(
'GREEN',
style: TextStyle(color: Colors.black),
),
),
),
),
ColoredBox(
color: Color(0xff0000ff),
child: SizedBox(
width: 50.0,
height: 75.0,
child: Align(
child: Text(
'BLUE',
style: TextStyle(color: Colors.white),
),
),
),
),
],
),
],
),
),
),
),
),
);
}
}
```
</details>
### Preview
<img width="1072" alt="Screenshot 2024-07-30 at 15 39 42" src="https://github.com/user-attachments/assets/717e9f5e-a491-4853-ba74-e72ec7493363 ">
2024-08-05 16:52:58 +00:00
Mohellebi abdessalem
0e720e84a4
reduce warnings inside flutter.groovy file ( #152073 )
...
In the context of [issue #146036 ](https://github.com/flutter/flutter/issues/146036 ), the flutter.groovy file, considering [issue #147122 ](https://github.com/flutter/flutter/issues/147122 ), currently has only two of the buildDir instances replaced. The other two instances have issues that require more investigation.
2024-08-05 13:56:14 +00:00
Victor Sanni
6b73de27bd
Improve CupertinoRadio
fidelity ( #149703 )
...
Adds the following:
* Darkens when pressed in light mode
* Lightens when pressed in dark mode.
* Tests that confirm `CupertinoRadio` is focusable and has correct focus
colors
* Tests that confirm `CupertinoRadio` uses correct default
active/inactive/fill colors
* Same look in disabled vs. enabled states as native macOS:
| Native macOS | Flutter Before | Flutter After |
--- | --- | --- |
| <img width="50" alt="radio native"
src="https://github.com/flutter/flutter/assets/77553258/27c8c27e-f0dc-4ad7-a8c2-361ae8b437bb ">
| <img width="50" alt="flutter radio before"
src="https://github.com/flutter/flutter/assets/77553258/580d9c4b-0f0d-457e-851f-73450738ee16 ">
| <img width="50" alt="flutter radio after"
src="https://github.com/flutter/flutter/assets/77553258/da6ae21b-87f8-45d8-a2d2-da70ff4853a1 ">
|
* Same look of an unselected radio button in dark mode as native macOS:
| Native light mode | Flutter before light mode | Flutter after light
mode | Native dark mode | Flutter before dark mode | Flutter after dark
mode
--- | --- | --- | --- | --- | --- |
| <img width="23" alt="native radio light"
src="https://github.com/flutter/flutter/assets/77553258/b52fc18b-e10d-4205-b10b-1536fbbf1ca0 ">
| <img width="23" alt="flutter radio after light"
src="https://github.com/flutter/flutter/assets/77553258/54294523-8254-479c-b668-77927a8295f1 ">
| <img width="23" alt="flutter radio light"
src="https://github.com/flutter/flutter/assets/77553258/8472deee-e5ce-4d39-9207-d788ad7f34f4 ">
| <img width="23" alt="native radio dark"
src="https://github.com/flutter/flutter/assets/77553258/44143099-6ab4-4fb8-8a94-ebb1386022c9 ">
| <img width="23" alt="flutter radio before dark"
src="https://github.com/flutter/flutter/assets/77553258/3411d9fb-fc7f-4b20-86a5-34fda167d5b9 ">
| <img width="23" alt="flutter radio dark"
src="https://github.com/flutter/flutter/assets/77553258/39ea3649-142e-43ad-9681-24e1216e0987 ">
|
## Light mode (with focus highlight)
| Native light mode | Flutter before light mode | Flutter after light
mode |
--- | --- | --- |
| <img width="70" alt="native radio light mode"
src="https://github.com/user-attachments/assets/914b9f1f-5819-4c5b-8739-8498a72b337f ">
| <img width="70" alt="radio flutter focus before"
src="https://github.com/user-attachments/assets/3129fca3-3310-4b2b-bcf3-98aa8f049911 ">
| <img width="70" alt="radio flutter focus after"
src="https://github.com/user-attachments/assets/7a2089d9-b2b5-4ff0-9db9-444455301146 ">
|
## Dark mode
| Native dark mode | Flutter before dark mode | Flutter after dark mode
|
--- | --- | --- |
| <img width="70" alt="native radio dark mode"
src="https://github.com/user-attachments/assets/4da3c055-ce89-4f37-8fcd-d4cbbc4031a0 ">
| <img width="70" alt="flutter before radio dark mode"
src="https://github.com/user-attachments/assets/36b5f36a-f1d9-4c32-8493-3533a749cf5d ">
| <img width="70" alt="flutter radio dark mode after"
src="https://github.com/user-attachments/assets/28828e01-bb2f-4217-9756-2766be3919a6 ">
|
## Disabled light mode
| Native | Flutter before | Flutter after |
--- | --- | --- |
| <img width="120" alt="light disabled radio native"
src="https://github.com/user-attachments/assets/bf6d2561-5dcf-4882-afac-6b639fa949b0 ">
| <img width="120" alt="Screenshot 2024-07-30 at 3 13 30 PM"
src="https://github.com/user-attachments/assets/3efc978c-fa58-44e8-877a-ea29778ea384 ">
| <img width="120" alt="light disabled radio flutter after"
src="https://github.com/user-attachments/assets/b2c2e30a-cb8d-40d0-aa6f-75a98caa4829 ">
|
## Disabled dark mode
| Native | Flutter before | Flutter after |
--- | --- | --- |
| <img width="120" alt="dark disabled radio native"
src="https://github.com/user-attachments/assets/feedccc7-9802-4b0c-8038-c9eb771b0eb0 ">
| <img width="120" alt="Screenshot 2024-07-30 at 3 13 30 PM"
src="https://github.com/user-attachments/assets/6d2f03f7-7216-4850-8c4f-f79ae05bb9da ">
| <img width="136" alt="dark disabled radio flutter after"
src="https://github.com/user-attachments/assets/5e03d4fc-4b8e-4518-b429-6bb58f6d988d ">
|
`CupertinoRadio` is missing a tristate/mixed state, but [Apple's latest
HIG specs discourages its
use](https://developer.apple.com/design/human-interface-guidelines/toggles#Radio-buttons ).
Fixes https://github.com/flutter/flutter/issues/151994
## 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] I followed the [breaking change policy] and added [Data Driven
Fixes] where supported.
- [ ] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel
on [Discord].
<!-- Links -->
[Contributor Guide]:
https://github.com/flutter/flutter/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
[Data Driven Fixes]:
https://github.com/flutter/flutter/wiki/Data-driven-Fixes
---------
Co-authored-by: Kate Lovett <katelovett@google.com>
2024-08-02 18:32:17 -07:00
Greg Spencer
51ed348f3b
Fix handling of iconSize
and iconColor
defaults for ButtonStyleButton
subclasses. ( #143501 )
...
## Description
Adds defaults that use tokens to define default `iconSize` and `iconColor` values. Previously, the Material 3 token values for button icon sizes and colors were not being used as defaults when the `ButtonStyleButton.defaultStyleOf` function returned the default values.
Adds tests to make sure appropriate `ButtonStyle` fields are populated when defaultStyle is called on buttons.
Updated documentation for `defaultStyleOf` to indicated that not _all_ fields need to be non-null, since some fields make sense to be null (e.g. `fixedSize`) because they would otherwise override the behavior of other fields in the same `ButtonStyle`.
## Tests
- Added tests to make sure that the appropriate fields are non-null in the default button styles for each type of button.
2024-08-02 23:31:07 +00:00
Greg Price
1dcc1b1876
Write more on Animation and related docs ( #150727 )
...
A few days ago I started reading up on how animations work, in
preparation for starting to use them in a more complex way than
I'd done before. I found it a bit difficult to get my head around;
in particular the many different classes involved, how they relate
to each other, and how to fit them together.
So once I had worked that out, I sat down to express it in the form
of documentation.
The largest change here is an expansion of the docs on [Animation]
itself, including a new section "Using animations" with several
paragraphs laying out how one typically fits together
AnimationController, TickerProvider, CurvedAnimation and/or Tween,
and AnimatedWidget subclasses. [Animation] also gets an expanded
"See also" list, a revised conceptual intro, and a new summary line.
There are also revisions on [TickerProvider], [AnimatedController],
and elsewhere; some new exposition, some revisions for clarity, and
various small fixes.
2024-08-02 21:46:17 +00:00