From 252f6a02855194f17678dd29254cf6216f049f14 Mon Sep 17 00:00:00 2001 From: Kate Lovett Date: Wed, 14 Jul 2021 11:31:02 -0500 Subject: [PATCH] Add fixes for ThemeData (#86369) --- packages/flutter/lib/fix_data.yaml | 356 ++++++++++++++++++ packages/flutter/test_fixes/material.dart | 44 +++ .../flutter/test_fixes/material.dart.expect | 44 +++ 3 files changed, 444 insertions(+) diff --git a/packages/flutter/lib/fix_data.yaml b/packages/flutter/lib/fix_data.yaml index fe6ca359fb..4815db56d4 100644 --- a/packages/flutter/lib/fix_data.yaml +++ b/packages/flutter/lib/fix_data.yaml @@ -15,6 +15,362 @@ version: 1 transforms: + # Changes made in https://github.com/flutter/flutter/pull/81336 + - title: "Remove 'buttonColor'" + date: 2021-04-30 + element: + uris: [ 'material.dart' ] + method: 'copyWith' + inClass: 'ThemeData' + changes: + - kind: 'removeParameter' + name: 'buttonColor' + + # Changes made in https://github.com/flutter/flutter/pull/81336 + - title: "Remove 'buttonColor'" + date: 2021-04-30 + element: + uris: [ 'material.dart' ] + constructor: 'raw' + inClass: 'ThemeData' + changes: + - kind: 'removeParameter' + name: 'buttonColor' + + # Changes made in https://github.com/flutter/flutter/pull/81336 + - title: "Remove 'buttonColor'" + date: 2021-04-30 + element: + uris: [ 'material.dart' ] + constructor: '' + inClass: 'ThemeData' + changes: + - kind: 'removeParameter' + name: 'buttonColor' + + # Changes made in https://github.com/flutter/flutter/pull/81336 + - title: "Remove 'accentIconTheme'" + date: 2021-04-30 + element: + uris: [ 'material.dart' ] + method: 'copyWith' + inClass: 'ThemeData' + changes: + - kind: 'removeParameter' + name: 'accentIconTheme' + + # Changes made in https://github.com/flutter/flutter/pull/81336 + - title: "Remove 'accentIconTheme'" + date: 2021-04-30 + element: + uris: [ 'material.dart' ] + constructor: 'raw' + inClass: 'ThemeData' + changes: + - kind: 'removeParameter' + name: 'accentIconTheme' + + # Changes made in https://github.com/flutter/flutter/pull/81336 + - title: "Remove 'accentIconTheme'" + date: 2021-04-30 + element: + uris: [ 'material.dart' ] + constructor: '' + inClass: 'ThemeData' + changes: + - kind: 'removeParameter' + name: 'accentIconTheme' + + # Changes made in https://github.com/flutter/flutter/pull/81336 + - title: "Remove 'accentTextTheme'" + date: 2021-04-30 + element: + uris: [ 'material.dart' ] + method: 'copyWith' + inClass: 'ThemeData' + changes: + - kind: 'removeParameter' + name: 'accentTextTheme' + + # Changes made in https://github.com/flutter/flutter/pull/81336 + - title: "Remove 'accentTextTheme'" + date: 2021-04-30 + element: + uris: [ 'material.dart' ] + constructor: 'raw' + inClass: 'ThemeData' + changes: + - kind: 'removeParameter' + name: 'accentTextTheme' + + # Changes made in https://github.com/flutter/flutter/pull/81336 + - title: "Remove 'accentTextTheme'" + date: 2021-04-30 + element: + uris: [ 'material.dart' ] + constructor: '' + inClass: 'ThemeData' + changes: + - kind: 'removeParameter' + name: 'accentTextTheme' + + # Changes made in https://github.com/flutter/flutter/pull/81336 + - title: "Remove 'accentColorBrightness'" + date: 2021-04-30 + element: + uris: [ 'material.dart' ] + method: 'copyWith' + inClass: 'ThemeData' + changes: + - kind: 'removeParameter' + name: 'accentColorBrightness' + + # Changes made in https://github.com/flutter/flutter/pull/81336 + - title: "Remove 'accentColorBrightness'" + date: 2021-04-30 + element: + uris: [ 'material.dart' ] + constructor: 'raw' + inClass: 'ThemeData' + changes: + - kind: 'removeParameter' + name: 'accentColorBrightness' + + # Changes made in https://github.com/flutter/flutter/pull/81336 + - title: "Remove 'accentColorBrightness'" + date: 2021-04-30 + element: + uris: [ 'material.dart' ] + constructor: '' + inClass: 'ThemeData' + changes: + - kind: 'removeParameter' + name: 'accentColorBrightness' + + # Changes made in https://github.com/flutter/flutter/pull/81336 + - title: "Migrate to 'ColorScheme.secondary'" + date: 2021-04-30 + element: + uris: [ 'material.dart' ] + field: 'accentColor' + inClass: 'ThemeData' + changes: + - kind: 'rename' + newName: 'colorScheme.secondary' + + # Changes made in https://github.com/flutter/flutter/pull/81336 + - title: "Migrate to 'ColorScheme.secondary'" + date: 2021-04-30 + element: + uris: [ 'material.dart' ] + method: 'copyWith' + inClass: 'ThemeData' + oneOf: + - if: "accentColor != '' && primarySwatch == '' && colorScheme == ''" + changes: + - kind: 'addParameter' + index: 56 + name: 'colorScheme' + style: optional_named + argumentValue: + expression: 'ColorScheme.fromSwatch().copyWith(secondary: {% accentColor %})' + requiredIf: "accentColor != '' && primarySwatch == '' && colorScheme ==''" + - kind: 'removeParameter' + name: 'accentColor' + - if: "accentColor != '' && primarySwatch != '' && colorScheme == ''" + changes: + - kind: 'addParameter' + index: 56 + name: 'colorScheme' + style: optional_named + argumentValue: + expression: 'ColorScheme.fromSwatch(primarySwatch: {% primarySwatch %}).copyWith(secondary: {% accentColor %})' + requiredIf: "accentColor != '' && primarySwatch != '' && colorScheme == ''" + - kind: 'removeParameter' + name: 'accentColor' + - kind: 'removeParameter' + name: 'primarySwatch' + - if: "accentColor != '' && primarySwatch == '' && colorScheme != ''" + changes: + - kind: 'removeParameter' + name: 'colorScheme' # Remove to add back with modification + - kind: 'addParameter' + index: 56 + name: 'colorScheme' + style: optional_named + argumentValue: + expression: '{% colorScheme %}.copyWith(secondary: {% accentColor %})' + requiredIf: "accentColor != '' && primarySwatch == '' && colorScheme != ''" + - kind: 'removeParameter' + name: 'accentColor' + - if: "accentColor != '' && primarySwatch != '' && colorScheme != ''" + changes: + - kind: 'removeParameter' + name: 'colorScheme' # Remove to add back with modification + - kind: 'addParameter' + index: 56 + name: 'colorScheme' + style: optional_named + argumentValue: + expression: '{% colorScheme %}.copyWith(primarySwatch: {% primarySwatch %}, secondary: {% accentColor %})' + requiredIf: "accentColor != '' && primarySwatch != '' && colorScheme != ''" + - kind: 'removeParameter' + name: 'accentColor' + - kind: 'removeParameter' + name: 'primarySwatch' + variables: + accentColor: + kind: 'fragment' + value: 'arguments[accentColor]' + primarySwatch: + kind: 'fragment' + value: 'arguments[primarySwatch]' + colorScheme: + kind: 'fragment' + value: 'arguments[colorScheme]' + + # Changes made in https://github.com/flutter/flutter/pull/81336 + - title: "Migrate to 'ColorScheme.secondary'" + date: 2021-04-30 + element: + uris: [ 'material.dart' ] + constructor: 'raw' + inClass: 'ThemeData' + oneOf: + - if: "accentColor != '' && primarySwatch == '' && colorScheme == ''" + changes: + - kind: 'addParameter' + index: 56 + name: 'colorScheme' + style: optional_named + argumentValue: + expression: 'ColorScheme.fromSwatch().copyWith(secondary: {% accentColor %})' + requiredIf: "accentColor != '' && primarySwatch == '' && colorScheme ==''" + - kind: 'removeParameter' + name: 'accentColor' + - if: "accentColor != '' && primarySwatch != '' && colorScheme == ''" + changes: + - kind: 'addParameter' + index: 56 + name: 'colorScheme' + style: optional_named + argumentValue: + expression: 'ColorScheme.fromSwatch(primarySwatch: {% primarySwatch %}).copyWith(secondary: {% accentColor %})' + requiredIf: "accentColor != '' && primarySwatch != '' && colorScheme == ''" + - kind: 'removeParameter' + name: 'accentColor' + - kind: 'removeParameter' + name: 'primarySwatch' + - if: "accentColor != '' && primarySwatch == '' && colorScheme != ''" + changes: + - kind: 'removeParameter' + name: 'colorScheme' # Remove to add back with modification + - kind: 'addParameter' + index: 56 + name: 'colorScheme' + style: optional_named + argumentValue: + expression: '{% colorScheme %}.copyWith(secondary: {% accentColor %})' + requiredIf: "accentColor != '' && primarySwatch == '' && colorScheme != ''" + - kind: 'removeParameter' + name: 'accentColor' + - if: "accentColor != '' && primarySwatch != '' && colorScheme != ''" + changes: + - kind: 'removeParameter' + name: 'colorScheme' # Remove to add back with modification + - kind: 'addParameter' + index: 56 + name: 'colorScheme' + style: optional_named + argumentValue: + expression: '{% colorScheme %}.copyWith(primarySwatch: {% primarySwatch %}, secondary: {% accentColor %})' + requiredIf: "accentColor != '' && primarySwatch != '' && colorScheme != ''" + - kind: 'removeParameter' + name: 'accentColor' + - kind: 'removeParameter' + name: 'primarySwatch' + variables: + accentColor: + kind: 'fragment' + value: 'arguments[accentColor]' + primarySwatch: + kind: 'fragment' + value: 'arguments[primarySwatch]' + colorScheme: + kind: 'fragment' + value: 'arguments[colorScheme]' + + # Changes made in https://github.com/flutter/flutter/pull/81336 + - title: "Migrate to 'ColorScheme.secondary'" + date: 2021-04-30 + element: + uris: [ 'material.dart' ] + constructor: '' + inClass: 'ThemeData' + oneOf: + - if: "accentColor != '' && primarySwatch == '' && colorScheme == ''" + changes: + - kind: 'addParameter' + index: 56 + name: 'colorScheme' + style: optional_named + argumentValue: + expression: 'ColorScheme.fromSwatch().copyWith(secondary: {% accentColor %})' + requiredIf: "accentColor != '' && primarySwatch == '' && colorScheme ==''" + - kind: 'removeParameter' + name: 'accentColor' + - if: "accentColor != '' && primarySwatch != '' && colorScheme == ''" + changes: + - kind: 'addParameter' + index: 56 + name: 'colorScheme' + style: optional_named + argumentValue: + expression: 'ColorScheme.fromSwatch(primarySwatch: {% primarySwatch %}).copyWith(secondary: {% accentColor %})' + requiredIf: "accentColor != '' && primarySwatch != '' && colorScheme == ''" + - kind: 'removeParameter' + name: 'accentColor' + - kind: 'removeParameter' + name: 'primarySwatch' + - if: "accentColor != '' && primarySwatch == '' && colorScheme != ''" + changes: + - kind: 'removeParameter' + name: 'colorScheme' # Remove to add back with modification + - kind: 'addParameter' + index: 56 + name: 'colorScheme' + style: optional_named + argumentValue: + expression: '{% colorScheme %}.copyWith(secondary: {% accentColor %})' + requiredIf: "accentColor != '' && primarySwatch == '' && colorScheme != ''" + - kind: 'removeParameter' + name: 'accentColor' + - if: "accentColor != '' && primarySwatch != '' && colorScheme != ''" + changes: + - kind: 'removeParameter' + name: 'colorScheme' # Remove to add back with modification + - kind: 'addParameter' + index: 56 + name: 'colorScheme' + style: optional_named + argumentValue: + expression: '{% colorScheme %}.copyWith(primarySwatch: {% primarySwatch %}, secondary: {% accentColor %})' + requiredIf: "accentColor != '' && primarySwatch != '' && colorScheme != ''" + - kind: 'removeParameter' + name: 'accentColor' + - kind: 'removeParameter' + name: 'primarySwatch' + variables: + accentColor: + kind: 'fragment' + value: 'arguments[accentColor]' + primarySwatch: + kind: 'fragment' + value: 'arguments[primarySwatch]' + colorScheme: + kind: 'fragment' + value: 'arguments[colorScheme]' + # Changes made in https://flutter.dev/docs/release/breaking-changes/clip-behavior - title: "Migrate to 'clipBehavior'" date: 2020-08-20 diff --git a/packages/flutter/test_fixes/material.dart b/packages/flutter/test_fixes/material.dart index e7743716fc..87fdf25551 100644 --- a/packages/flutter/test_fixes/material.dart +++ b/packages/flutter/test_fixes/material.dart @@ -331,6 +331,50 @@ void main() { renderObjectToWidgetElement.moveChildRenderObject(renderObject, object); renderObjectToWidgetElement.removeChildRenderObject(renderObject); + // Changes made in https://github.com/flutter/flutter/pull/81336 + ThemeData themeData = ThemeData(); + themeData = ThemeData(accentColor: Colors.red); + themeData = ThemeData(accentColor: Colors.red, primarySwatch: Colors.blue); + themeData = ThemeData(accentColor: Colors.red, colorScheme: ColorScheme.light()); + themeData = ThemeData(accentColor: Colors.red, colorScheme: ColorScheme.light(), primarySwatch: Colors.blue); + themeData = ThemeData.raw(accentColor: Colors.red); + themeData = ThemeData.raw(accentColor: Colors.red, primarySwatch: Colors.blue); + themeData = ThemeData.raw(accentColor: Colors.red, colorScheme: ColorScheme.light()); + themeData = ThemeData.raw(accentColor: Colors.red, colorScheme: ColorScheme.light(), primarySwatch: Colors.blue); + themeData = themeData.copyWith(accentColor: Colors.red); + themeData = themeData.copyWith(accentColor: Colors.red, primarySwatch: Colors.blue); + themeData = themeData.copyWith(accentColor: Colors.red, colorScheme: ColorScheme.light()); + themeData = themeData.copyWith(accentColor: Colors.red, colorScheme: ColorScheme.light(), primarySwatch: Colors.blue); + themeData.accentColor; + + // Changes made in https://github.com/flutter/flutter/pull/81336 + ThemeData themeData = ThemeData(); + themeData = ThemeData(accentColorBrightness: Brightness.dark); + themeData = ThemeData.raw(accentColorBrightness: Brightness.dark); + themeData = themeData.copyWith(accentColorBrightness: Brightness.dark); + themeData.accentColorBrightness; // Removing field reference not supported. + + // Changes made in https://github.com/flutter/flutter/pull/81336 + ThemeData themeData = ThemeData(); + themeData = ThemeData(accentTextTheme: TextTheme()); + themeData = ThemeData.raw(accentTextTheme: TextTheme()); + themeData = themeData.copyWith(accentTextTheme: TextTheme()); + themeData.accentTextTheme; // Removing field reference not supported. + + // Changes made in https://github.com/flutter/flutter/pull/81336 + ThemeData themeData = ThemeData(); + themeData = ThemeData(accentIconTheme: IconThemeData()); + themeData = ThemeData.raw(accentIconTheme: IconThemeData()); + themeData = themeData.copyWith(accentIconTheme: IconThemeData()); + themeData.accentIconTheme; // Removing field reference not supported. + + // Changes made in https://github.com/flutter/flutter/pull/81336 + ThemeData themeData = ThemeData(); + themeData = ThemeData(buttonColor: Colors.red); + themeData = ThemeData.raw(buttonColor: Colors.red); + themeData = themeData.copyWith(buttonColor: Colors.red); + themeData.buttonColor; // Removing field reference not supported. + // Changes made in https://flutter.dev/docs/release/breaking-changes/clip-behavior ListWheelScrollView listWheelScrollView = ListWheelScrollView(); listWheelScrollView = ListWheelScrollView(clipToSize: true); diff --git a/packages/flutter/test_fixes/material.dart.expect b/packages/flutter/test_fixes/material.dart.expect index eb082b95f7..7117ed89dc 100644 --- a/packages/flutter/test_fixes/material.dart.expect +++ b/packages/flutter/test_fixes/material.dart.expect @@ -303,6 +303,50 @@ void main() { renderObjectToWidgetElement.moveRenderObjectChild(renderObject, object); renderObjectToWidgetElement.removeRenderObjectChild(renderObject); + // Changes made in https://github.com/flutter/flutter/pull/81336 + ThemeData themeData = ThemeData(); + themeData = ThemeData(colorScheme: ColorScheme.fromSwatch().copyWith(secondary: Colors.red)); + themeData = ThemeData(colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.blue).copyWith(secondary: Colors.red)); + themeData = ThemeData(colorScheme: ColorScheme.light().copyWith(secondary: Colors.red)); + themeData = ThemeData(colorScheme: ColorScheme.light().copyWith(primarySwatch: Colors.blue, secondary: Colors.red)); + themeData = ThemeData.raw(colorScheme: ColorScheme.fromSwatch().copyWith(secondary: Colors.red)); + themeData = ThemeData.raw(colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.blue).copyWith(secondary: Colors.red)); + themeData = ThemeData.raw(colorScheme: ColorScheme.light().copyWith(secondary: Colors.red)); + themeData = ThemeData.raw(colorScheme: ColorScheme.light().copyWith(primarySwatch: Colors.blue, secondary: Colors.red)); + themeData = themeData.copyWith(colorScheme: ColorScheme.fromSwatch().copyWith(secondary: Colors.red)); + themeData = themeData.copyWith(colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.blue).copyWith(secondary: Colors.red)); + themeData = themeData.copyWith(colorScheme: ColorScheme.light().copyWith(secondary: Colors.red)); + themeData = themeData.copyWith(colorScheme: ColorScheme.light().copyWith(primarySwatch: Colors.blue, secondary: Colors.red)); + themeData.colorScheme.secondary; + + // Changes made in https://github.com/flutter/flutter/pull/81336 + ThemeData themeData = ThemeData(); + themeData = ThemeData(); + themeData = ThemeData.raw(); + themeData = themeData.copyWith(); + themeData.accentColorBrightness; // Removing field reference not supported. + + // Changes made in https://github.com/flutter/flutter/pull/81336 + ThemeData themeData = ThemeData(); + themeData = ThemeData(); + themeData = ThemeData.raw(); + themeData = themeData.copyWith(); + themeData.accentTextTheme; // Removing field reference not supported. + + // Changes made in https://github.com/flutter/flutter/pull/81336 + ThemeData themeData = ThemeData(); + themeData = ThemeData(); + themeData = ThemeData.raw(); + themeData = themeData.copyWith(); + themeData.accentIconTheme; // Removing field reference not supported. + + // Changes made in https://github.com/flutter/flutter/pull/81336 + ThemeData themeData = ThemeData(); + themeData = ThemeData(); + themeData = ThemeData.raw(); + themeData = themeData.copyWith(); + themeData.buttonColor; // Removing field reference not supported. + // Changes made in https://flutter.dev/docs/release/breaking-changes/clip-behavior ListWheelScrollView listWheelScrollView = ListWheelScrollView(); listWheelScrollView = ListWheelScrollView(clipBehavior: Clip.hardEdge);