Updates for 3.22 (#2266)

Updates for 3.22

---------

Co-authored-by: Brett Morgan <brettmorgan@google.com>
Co-authored-by: Qun Cheng <chengqunq@gmail.com>
Co-authored-by: Brett Morgan <brett.morgan@gmail.com>
recipe_readme
Eric Windmill 2 months ago committed by GitHub
parent 71fef7c869
commit 3172aff8f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -17,8 +17,7 @@ void main() {
// Get the initial color of the button. // Get the initial color of the button.
ElevatedButton button = tester.widget(find.byType(ElevatedButton)); ElevatedButton button = tester.widget(find.byType(ElevatedButton));
MaterialStateProperty<Color?>? initialColor = WidgetStateProperty<Color?>? initialColor = button.style!.backgroundColor;
button.style!.backgroundColor;
// Tap the button. // Tap the button.
await tester.tap(find.byType(ElevatedButton)); await tester.tap(find.byType(ElevatedButton));
@ -26,8 +25,7 @@ void main() {
// Get the updated color of the button. // Get the updated color of the button.
button = tester.widget(find.byType(ElevatedButton)); button = tester.widget(find.byType(ElevatedButton));
MaterialStateProperty<Color?>? updatedColor = WidgetStateProperty<Color?>? updatedColor = button.style!.backgroundColor;
button.style!.backgroundColor;
// Check if the color has changed. // Check if the color has changed.
expect(initialColor, isNot(updatedColor)); expect(initialColor, isNot(updatedColor));
@ -38,8 +36,7 @@ void main() {
// Get the initial color of the button. // Get the initial color of the button.
ElevatedButton button = tester.widget(find.byType(ElevatedButton)); ElevatedButton button = tester.widget(find.byType(ElevatedButton));
MaterialStateProperty<Color?>? initialColor = WidgetStateProperty<Color?>? initialColor = button.style!.backgroundColor;
button.style!.backgroundColor;
// Tap the button to trigger the animation but don't wait for it to finish. // Tap the button to trigger the animation but don't wait for it to finish.
await tester.tap(find.byType(ElevatedButton)); await tester.tap(find.byType(ElevatedButton));
@ -48,8 +45,7 @@ void main() {
// Check that the color has changed but not to the final color. // Check that the color has changed but not to the final color.
button = tester.widget(find.byType(ElevatedButton)); button = tester.widget(find.byType(ElevatedButton));
MaterialStateProperty<Color?>? changedColor = WidgetStateProperty<Color?>? changedColor = button.style!.backgroundColor;
button.style!.backgroundColor;
expect(initialColor, isNot(changedColor)); expect(initialColor, isNot(changedColor));
// Wait for the animation to finish. // Wait for the animation to finish.
@ -57,7 +53,7 @@ void main() {
// Check that the color has changed to the final color. // Check that the color has changed to the final color.
button = tester.widget(find.byType(ElevatedButton)); button = tester.widget(find.byType(ElevatedButton));
MaterialStateProperty<Color?>? finalColor = button.style!.backgroundColor; WidgetStateProperty<Color?>? finalColor = button.style!.backgroundColor;
expect(changedColor, isNot(finalColor)); expect(changedColor, isNot(finalColor));
}); });
}); });

@ -39,7 +39,7 @@ class MessageWidget extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: isFromUser color: isFromUser
? Theme.of(context).colorScheme.primaryContainer ? Theme.of(context).colorScheme.primaryContainer
: Theme.of(context).colorScheme.surfaceVariant, : Theme.of(context).colorScheme.surfaceContainerHighest,
borderRadius: BorderRadius.circular(18), borderRadius: BorderRadius.circular(18),
), ),
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(

@ -86,10 +86,8 @@ abstract class AppTheme {
error: AppColors.red200, error: AppColors.red200,
onPrimary: AppColors.black900, onPrimary: AppColors.black900,
onSecondary: AppColors.black900, onSecondary: AppColors.black900,
onBackground: AppColors.white50,
onSurface: AppColors.white50, onSurface: AppColors.white50,
onError: AppColors.black900, onError: AppColors.black900,
background: AppColors.black900Alpha087,
), ),
textTheme: _buildReplyDarkTextTheme(base.textTheme), textTheme: _buildReplyDarkTextTheme(base.textTheme),
scaffoldBackgroundColor: AppColors.black900, scaffoldBackgroundColor: AppColors.black900,

@ -31,16 +31,16 @@ class TextStyles {
class ButtonStyles { class ButtonStyles {
static ButtonStyle style() { static ButtonStyle style() {
return ButtonStyle( return ButtonStyle(
fixedSize: MaterialStateProperty.resolveWith<Size>((states) { fixedSize: WidgetStateProperty.resolveWith<Size>((states) {
return const Size(100, 36); return const Size(100, 36);
}), }),
shape: MaterialStateProperty.resolveWith<OutlinedBorder>((states) { shape: WidgetStateProperty.resolveWith<OutlinedBorder>((states) {
return const RoundedRectangleBorder( return const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(18))); borderRadius: BorderRadius.all(Radius.circular(18)));
}), }),
overlayColor: null, overlayColor: null,
backgroundColor: MaterialStateProperty.resolveWith<Color?>((states) { backgroundColor: WidgetStateProperty.resolveWith<Color?>((states) {
if (states.contains(MaterialState.hovered)) { if (states.contains(WidgetState.hovered)) {
return Colors.black; // Hovered bg (for desktop with mouse) return Colors.black; // Hovered bg (for desktop with mouse)
} }
return Colors.grey[600]; // Default bg return Colors.grey[600]; // Default bg

@ -266,7 +266,7 @@ class MyApp extends StatelessWidget {
theme: ThemeData.from( theme: ThemeData.from(
colorScheme: ColorScheme.fromSeed( colorScheme: ColorScheme.fromSeed(
seedColor: palette.darkPen, seedColor: palette.darkPen,
background: palette.backgroundMain, surface: palette.backgroundMain,
), ),
textTheme: TextTheme( textTheme: TextTheme(
bodyMedium: TextStyle( bodyMedium: TextStyle(

@ -39,7 +39,7 @@ class MessageWidget extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: isFromUser color: isFromUser
? Theme.of(context).colorScheme.primaryContainer ? Theme.of(context).colorScheme.primaryContainer
: Theme.of(context).colorScheme.surfaceVariant, : Theme.of(context).colorScheme.surfaceContainerHighest,
borderRadius: BorderRadius.circular(18), borderRadius: BorderRadius.circular(18),
), ),
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(

@ -250,14 +250,14 @@ class ColorSchemeView extends StatelessWidget {
onColor: colorScheme.surface, onColor: colorScheme.surface,
), ),
ColorChip( ColorChip(
label: 'surfaceVariant', label: 'surfaceContainerHighest',
color: colorScheme.surfaceVariant, color: colorScheme.surfaceContainerHighest,
onColor: colorScheme.onSurfaceVariant, onColor: colorScheme.surfaceContainerHighest,
), ),
ColorChip( ColorChip(
label: 'onSurfaceVariant', label: 'surfaceContainerHighest',
color: colorScheme.onSurfaceVariant, color: colorScheme.surfaceContainerHighest,
onColor: colorScheme.surfaceVariant, onColor: colorScheme.surfaceContainerHighest,
), ),
ColorChip( ColorChip(
label: 'surfaceTint', label: 'surfaceTint',
@ -303,13 +303,13 @@ class ColorSchemeView extends StatelessWidget {
children: [ children: [
ColorChip( ColorChip(
label: 'background', label: 'background',
color: colorScheme.background, color: colorScheme.surface,
onColor: colorScheme.onBackground, onColor: colorScheme.onSurface,
), ),
ColorChip( ColorChip(
label: 'onBackground', label: 'onSurface',
color: colorScheme.onBackground, color: colorScheme.onSurface,
onColor: colorScheme.background, onColor: colorScheme.surface,
), ),
ColorChip( ColorChip(
label: 'scrim', label: 'scrim',

@ -501,7 +501,7 @@ class Cards extends StatelessWidget {
SizedBox( SizedBox(
width: cardWidth, width: cardWidth,
child: Card( child: Card(
color: Theme.of(context).colorScheme.surfaceVariant, color: Theme.of(context).colorScheme.surfaceContainerHighest,
elevation: 0, elevation: 0,
child: Container( child: Container(
padding: const EdgeInsets.fromLTRB(10, 5, 5, 10), padding: const EdgeInsets.fromLTRB(10, 5, 5, 10),
@ -849,9 +849,9 @@ class _SwitchRowState extends State<SwitchRow> {
bool value0 = false; bool value0 = false;
bool value1 = true; bool value1 = true;
final MaterialStateProperty<Icon?> thumbIcon = final WidgetStateProperty<Icon?> thumbIcon =
MaterialStateProperty.resolveWith<Icon?>((states) { WidgetStateProperty.resolveWith<Icon?>((states) {
if (states.contains(MaterialState.selected)) { if (states.contains(WidgetState.selected)) {
return const Icon(Icons.check); return const Icon(Icons.check);
} }
return const Icon(Icons.close); return const Icon(Icons.close);
@ -2508,7 +2508,10 @@ class ComponentGroupDecoration extends StatelessWidget {
child: Card( child: Card(
margin: EdgeInsets.zero, margin: EdgeInsets.zero,
elevation: 0, elevation: 0,
color: Theme.of(context).colorScheme.surfaceVariant.withOpacity(0.3), color: Theme.of(context)
.colorScheme
.surfaceContainerHighest
.withOpacity(0.3),
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(vertical: 20.0), padding: const EdgeInsets.symmetric(vertical: 20.0),
child: Center( child: Center(

@ -313,7 +313,7 @@ class _ColorSeedButton extends StatelessWidget {
return PopupMenuButton( return PopupMenuButton(
icon: Icon( icon: Icon(
Icons.palette_outlined, Icons.palette_outlined,
color: Theme.of(context).colorScheme.onSurfaceVariant, color: Theme.of(context).colorScheme.surfaceContainerHighest,
), ),
tooltip: 'Select a seed color', tooltip: 'Select a seed color',
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
@ -367,7 +367,7 @@ class _ColorImageButton extends StatelessWidget {
return PopupMenuButton( return PopupMenuButton(
icon: Icon( icon: Icon(
Icons.image_outlined, Icons.image_outlined,
color: Theme.of(context).colorScheme.onSurfaceVariant, color: Theme.of(context).colorScheme.surfaceContainerHighest,
), ),
tooltip: 'Select a color extraction image', tooltip: 'Select a color extraction image',
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),

@ -320,7 +320,7 @@ void main() {
testWidgets('Color theme changes when a color is selected from menu', testWidgets('Color theme changes when a color is selected from menu',
(tester) async { (tester) async {
Color m3BaseColor = const Color(0xff6750a4); Color m3BaseColor = const Color(0xff65558f);
await tester.pumpWidget(Container()); await tester.pumpWidget(Container());
await tester.pumpWidget(const App()); await tester.pumpWidget(const App());
await tester.pump(); await tester.pump();

@ -58,8 +58,8 @@ class _AddButton extends StatelessWidget {
cart.add(item); cart.add(item);
}, },
style: ButtonStyle( style: ButtonStyle(
overlayColor: MaterialStateProperty.resolveWith<Color?>((states) { overlayColor: WidgetStateProperty.resolveWith<Color?>((states) {
if (states.contains(MaterialState.pressed)) { if (states.contains(WidgetState.pressed)) {
return Theme.of(context).primaryColor; return Theme.of(context).primaryColor;
} }
return null; // Defer to the widget's default. return null; // Defer to the widget's default.

@ -16,8 +16,7 @@ declare -ar PROJECT_NAMES=(
"add_to_app/prebuilt_module/flutter_module" "add_to_app/prebuilt_module/flutter_module"
"analysis_defaults" "analysis_defaults"
"android_splash_screen" "android_splash_screen"
# TODO: 'MaterialStateProperty' is deprecated and shouldn't be used. "animations"
# "animations"
"background_isolate_channels" "background_isolate_channels"
"code_sharing/client" "code_sharing/client"
"code_sharing/server" "code_sharing/server"
@ -26,42 +25,36 @@ declare -ar PROJECT_NAMES=(
"deeplink_store_example" "deeplink_store_example"
"desktop_photo_search/fluent_ui" "desktop_photo_search/fluent_ui"
"desktop_photo_search/material" "desktop_photo_search/material"
# TODO: 'surfaceVariant' is deprecated and shouldn't be used. "dynamic_theme"
# "dynamic_theme"
"experimental/federated_plugin/federated_plugin" "experimental/federated_plugin/federated_plugin"
"experimental/federated_plugin/federated_plugin/example" "experimental/federated_plugin/federated_plugin/example"
"experimental/federated_plugin/federated_plugin_macos" "experimental/federated_plugin/federated_plugin_macos"
"experimental/federated_plugin/federated_plugin_platform_interface" "experimental/federated_plugin/federated_plugin_platform_interface"
"experimental/federated_plugin/federated_plugin_web" "experimental/federated_plugin/federated_plugin_web"
"experimental/federated_plugin/federated_plugin_windows" "experimental/federated_plugin/federated_plugin_windows"
# TODO: 'onBackground' is deprecated and shouldn't be used. # TODO: ewindmill to talk to team about removing.
# Depends on package context_menus, which breaks with Material3 by default.
# "experimental/linting_tool" # "experimental/linting_tool"
# TODO: 'MaterialStateProperty' is deprecated and shouldn't be used. "experimental/pedometer"
# "experimental/pedometer" "experimental/pedometer/example"
# "experimental/pedometer/example" "experimental/varfont_shader_puzzle"
# 'MaterialStateProperty' is deprecated and shouldn't be used.
# "experimental/varfont_shader_puzzle"
"experimental/web_dashboard" "experimental/web_dashboard"
"flutter_maps_firestore" "flutter_maps_firestore"
"form_app" "form_app"
# TODO: 'onBackground' is deprecated and shouldn't be used. "game_template"
# "game_template" "gemini_tasks"
# TODO: 'surfaceVariant' is deprecated and shouldn't be used.
# "gemini_tasks"
"google_maps" "google_maps"
"infinite_list" "infinite_list"
"ios_app_clip" "ios_app_clip"
"isolate_example" "isolate_example"
# TODO(ewindmill): Add back when deps allow "material_3_demo"
# "material_3_demo"
"navigation_and_routing" "navigation_and_routing"
"place_tracker" "place_tracker"
"platform_channels" "platform_channels"
"platform_design" "platform_design"
"platform_view_swift" "platform_view_swift"
"provider_counter" "provider_counter"
# TODO: 'MaterialStateProperty' is deprecated and shouldn't be used. "provider_shopper"
# "provider_shopper"
"simple_shader" "simple_shader"
"simplistic_calculator" "simplistic_calculator"
"simplistic_editor" "simplistic_editor"

@ -8,68 +8,60 @@ source "$DIR/flutter_ci_script_shared.sh"
flutter doctor -v flutter doctor -v
declare -ar PROJECT_NAMES=( declare -ar PROJECT_NAMES=(
"add_to_app/android_view/flutter_module_using_plugin" "add_to_app/android_view/flutter_module_using_plugin"
"add_to_app/books/flutter_module_books" "add_to_app/books/flutter_module_books"
"add_to_app/fullscreen/flutter_module" "add_to_app/fullscreen/flutter_module"
"add_to_app/multiple_flutters/multiple_flutters_module" "add_to_app/multiple_flutters/multiple_flutters_module"
"add_to_app/plugin/flutter_module_using_plugin" "add_to_app/plugin/flutter_module_using_plugin"
"add_to_app/prebuilt_module/flutter_module" "add_to_app/prebuilt_module/flutter_module"
"analysis_defaults" "analysis_defaults"
"android_splash_screen" "android_splash_screen"
# TODO: 'MaterialStateProperty' is deprecated and shouldn't be used. "animations"
# "animations" "background_isolate_channels"
"background_isolate_channels" "code_sharing/client"
"code_sharing/client" "code_sharing/server"
"code_sharing/server" "code_sharing/shared"
"code_sharing/shared" "context_menus"
"context_menus" "deeplink_store_example"
"deeplink_store_example" "desktop_photo_search/fluent_ui"
"desktop_photo_search/fluent_ui" "desktop_photo_search/material"
"desktop_photo_search/material" "experimental/federated_plugin/federated_plugin"
# TODO: 'surfaceVariant' is deprecated and shouldn't be used. "experimental/federated_plugin/federated_plugin/example"
# "dynamic_theme" "experimental/federated_plugin/federated_plugin_macos"
"experimental/federated_plugin/federated_plugin" "experimental/federated_plugin/federated_plugin_platform_interface"
"experimental/federated_plugin/federated_plugin/example" "experimental/federated_plugin/federated_plugin_web"
"experimental/federated_plugin/federated_plugin_macos" "experimental/federated_plugin/federated_plugin_windows"
"experimental/federated_plugin/federated_plugin_platform_interface" # TODO: ewindmill to talk to team about removing.
"experimental/federated_plugin/federated_plugin_web" # Depends on package context_menus, which breaks with Material3 by default.
"experimental/federated_plugin/federated_plugin_windows" # "experimental/linting_tool"
# TODO: 'onBackground' is deprecated and shouldn't be used. "experimental/pedometer"
# "experimental/linting_tool" "experimental/pedometer/example"
# TODO: 'MaterialStateProperty' is deprecated and shouldn't be used. "experimental/varfont_shader_puzzle"
# "experimental/pedometer" "experimental/web_dashboard"
# "experimental/pedometer/example" "flutter_maps_firestore"
# 'MaterialStateProperty' is deprecated and shouldn't be used. "form_app"
# "experimental/varfont_shader_puzzle" "game_template"
"experimental/web_dashboard" "google_maps"
"flutter_maps_firestore" "infinite_list"
"form_app" "ios_app_clip"
# TODO: 'onBackground' is deprecated and shouldn't be used. # Don't use 'BuildContext's across async gaps.
# "game_template" # "isolate_example"
# TODO: 'surfaceVariant' is deprecated and shouldn't be used. "material_3_demo"
# "gemini_tasks" "navigation_and_routing"
"google_maps" "place_tracker"
"infinite_list" "platform_channels"
"ios_app_clip" "platform_design"
"isolate_example" "platform_view_swift"
# TODO(ewindmill): Add back when deps allow "provider_counter"
# "material_3_demo" "provider_shopper"
"navigation_and_routing" "simple_shader"
"place_tracker" "simplistic_calculator"
"platform_channels" "simplistic_editor"
"platform_design" "testing_app"
"platform_view_swift" "veggieseasons"
"provider_counter" "web_embedding/element_embedding_demo"
# TODO: 'MaterialStateProperty' is deprecated and shouldn't be used. "web/_tool"
# "provider_shopper" "web/samples_index"
"simple_shader"
"simplistic_calculator"
"simplistic_editor"
"testing_app"
"veggieseasons"
"web_embedding/element_embedding_demo"
"web/_tool"
"web/samples_index"
) )
ci_projects "master" "${PROJECT_NAMES[@]}" ci_projects "master" "${PROJECT_NAMES[@]}"

@ -32,7 +32,9 @@ declare -ar PROJECT_NAMES=(
"experimental/federated_plugin/federated_plugin_platform_interface" "experimental/federated_plugin/federated_plugin_platform_interface"
"experimental/federated_plugin/federated_plugin_web" "experimental/federated_plugin/federated_plugin_web"
"experimental/federated_plugin/federated_plugin_windows" "experimental/federated_plugin/federated_plugin_windows"
"experimental/linting_tool" # TODO: ewindmill to talk to team about removing.
# Depends on package context_menus, which breaks with Material3 by default.
# "experimental/linting_tool"
"experimental/pedometer" "experimental/pedometer"
"experimental/pedometer/example" "experimental/pedometer/example"
"experimental/varfont_shader_puzzle" "experimental/varfont_shader_puzzle"

Loading…
Cancel
Save