diff --git a/packages/flutter/lib/fix_data.yaml b/packages/flutter/lib/fix_data.yaml index e563450f75..a6dd53acff 100644 --- a/packages/flutter/lib/fix_data.yaml +++ b/packages/flutter/lib/fix_data.yaml @@ -15,6 +15,260 @@ version: 1 transforms: + # Changes made in https://github.com/flutter/flutter/pull/66482 + - title: "Migrate to 'TextSelectionThemeData'" + date: 2020-09-24 + element: + uris: [ 'material.dart' ] + constructor: 'raw' + inClass: 'ThemeData' + oneOf: + - if: "textSelectionColor != '' && cursorColor != '' && textSelectionHandleColor != ''" + changes: + - kind: 'addParameter' + index: 73 + name: 'textSelectionTheme' + style: optional_named + argumentValue: + expression: 'TextSelectionThemeData(cursorColor: {% cursorColor %}, selectionColor: {% textSelectionColor %}, selectionHandleColor: {% textSelectionHandleColor %},)' + requiredIf: "textSelectionColor != '' && cursorColor != '' && textSelectionHandleColor != ''" + - kind: 'removeParameter' + name: 'textSelectionColor' + - kind: 'removeParameter' + name: 'cursorColor' + - kind: 'removeParameter' + name: 'textSelectionHandleColor' + - kind: 'removeParameter' + name: 'useTextSelectionTheme' + - if: "textSelectionColor == '' && cursorColor != '' && textSelectionHandleColor != ''" + changes: + - kind: 'addParameter' + index: 73 + name: 'textSelectionTheme' + style: optional_named + argumentValue: + expression: 'TextSelectionThemeData(cursorColor: {% cursorColor %}, selectionHandleColor: {% textSelectionHandleColor %},)' + requiredIf: "textSelectionColor == '' && cursorColor != '' && textSelectionHandleColor != ''" + - kind: 'removeParameter' + name: 'cursorColor' + - kind: 'removeParameter' + name: 'textSelectionHandleColor' + - kind: 'removeParameter' + name: 'useTextSelectionTheme' + - if: "textSelectionColor != '' && cursorColor != '' && textSelectionHandleColor == ''" + changes: + - kind: 'addParameter' + index: 73 + name: 'textSelectionTheme' + style: optional_named + argumentValue: + expression: 'TextSelectionThemeData(cursorColor: {% cursorColor %}, selectionColor: {% textSelectionColor %},)' + requiredIf: "textSelectionColor != '' && cursorColor != '' && textSelectionHandleColor == ''" + - kind: 'removeParameter' + name: 'textSelectionColor' + - kind: 'removeParameter' + name: 'cursorColor' + - kind: 'removeParameter' + name: 'useTextSelectionTheme' + - if: "textSelectionColor != '' && cursorColor == '' && textSelectionHandleColor != ''" + changes: + - kind: 'addParameter' + index: 73 + name: 'textSelectionTheme' + style: optional_named + argumentValue: + expression: 'TextSelectionThemeData(selectionColor: {% textSelectionColor %}, selectionHandleColor: {% textSelectionHandleColor %},)' + requiredIf: "textSelectionColor != '' && cursorColor == '' && textSelectionHandleColor != ''" + - kind: 'removeParameter' + name: 'textSelectionColor' + - kind: 'removeParameter' + name: 'textSelectionHandleColor' + - kind: 'removeParameter' + name: 'useTextSelectionTheme' + - if: "textSelectionColor == '' && cursorColor != '' && textSelectionHandleColor == ''" + changes: + - kind: 'addParameter' + index: 73 + name: 'textSelectionTheme' + style: optional_named + argumentValue: + expression: 'TextSelectionThemeData(cursorColor: {% cursorColor %})' + requiredIf: "textSelectionColor == '' && cursorColor != '' && textSelectionHandleColor == ''" + - kind: 'removeParameter' + name: 'cursorColor' + - kind: 'removeParameter' + name: 'useTextSelectionTheme' + - if: "textSelectionColor != '' && cursorColor == '' && textSelectionHandleColor == ''" + changes: + - kind: 'addParameter' + index: 73 + name: 'textSelectionTheme' + style: optional_named + argumentValue: + expression: 'TextSelectionThemeData(selectionColor: {% textSelectionColor %})' + requiredIf: "textSelectionColor != '' && cursorColor == '' && textSelectionHandleColor == ''" + - kind: 'removeParameter' + name: 'textSelectionColor' + - kind: 'removeParameter' + name: 'useTextSelectionTheme' + - if: "textSelectionColor == '' && cursorColor == '' && textSelectionHandleColor != ''" + changes: + - kind: 'addParameter' + index: 73 + name: 'textSelectionTheme' + style: optional_named + argumentValue: + expression: 'TextSelectionThemeData(selectionHandleColor: {% textSelectionHandleColor %})' + requiredIf: "textSelectionColor == '' && cursorColor == '' && textSelectionHandleColor != ''" + - kind: 'removeParameter' + name: 'textSelectionHandleColor' + - kind: 'removeParameter' + name: 'useTextSelectionTheme' + - if: "useTextSelectionTheme != ''" + changes: + - kind: 'removeParameter' + name: 'useTextSelectionTheme' + variables: + textSelectionColor: + kind: 'fragment' + value: 'arguments[textSelectionColor]' + cursorColor: + kind: 'fragment' + value: 'arguments[cursorColor]' + textSelectionHandleColor: + kind: 'fragment' + value: 'arguments[textSelectionHandleColor]' + useTextSelectionTheme: + kind: 'fragment' + value: 'arguments[useTextSelectionTheme]' + + # Changes made in https://github.com/flutter/flutter/pull/66482 + - title: "Migrate to 'TextSelectionThemeData'" + date: 2020-09-24 + element: + uris: [ 'material.dart' ] + constructor: '' + inClass: 'ThemeData' + oneOf: + - if: "textSelectionColor != '' && cursorColor != '' && textSelectionHandleColor != ''" + changes: + - kind: 'addParameter' + index: 73 + name: 'textSelectionTheme' + style: optional_named + argumentValue: + expression: 'TextSelectionThemeData(cursorColor: {% cursorColor %}, selectionColor: {% textSelectionColor %}, selectionHandleColor: {% textSelectionHandleColor %},)' + requiredIf: "textSelectionColor != '' && cursorColor != '' && textSelectionHandleColor != ''" + - kind: 'removeParameter' + name: 'textSelectionColor' + - kind: 'removeParameter' + name: 'cursorColor' + - kind: 'removeParameter' + name: 'textSelectionHandleColor' + - kind: 'removeParameter' + name: 'useTextSelectionTheme' + - if: "textSelectionColor == '' && cursorColor != '' && textSelectionHandleColor != ''" + changes: + - kind: 'addParameter' + index: 73 + name: 'textSelectionTheme' + style: optional_named + argumentValue: + expression: 'TextSelectionThemeData(cursorColor: {% cursorColor %}, selectionHandleColor: {% textSelectionHandleColor %},)' + requiredIf: "textSelectionColor == '' && cursorColor != '' && textSelectionHandleColor != ''" + - kind: 'removeParameter' + name: 'cursorColor' + - kind: 'removeParameter' + name: 'textSelectionHandleColor' + - kind: 'removeParameter' + name: 'useTextSelectionTheme' + - if: "textSelectionColor != '' && cursorColor != '' && textSelectionHandleColor == ''" + changes: + - kind: 'addParameter' + index: 73 + name: 'textSelectionTheme' + style: optional_named + argumentValue: + expression: 'TextSelectionThemeData(cursorColor: {% cursorColor %}, selectionColor: {% textSelectionColor %},)' + requiredIf: "textSelectionColor != '' && cursorColor != '' && textSelectionHandleColor == ''" + - kind: 'removeParameter' + name: 'textSelectionColor' + - kind: 'removeParameter' + name: 'cursorColor' + - kind: 'removeParameter' + name: 'useTextSelectionTheme' + - if: "textSelectionColor != '' && cursorColor == '' && textSelectionHandleColor != ''" + changes: + - kind: 'addParameter' + index: 73 + name: 'textSelectionTheme' + style: optional_named + argumentValue: + expression: 'TextSelectionThemeData(selectionColor: {% textSelectionColor %}, selectionHandleColor: {% textSelectionHandleColor %},)' + requiredIf: "textSelectionColor != '' && cursorColor == '' && textSelectionHandleColor != ''" + - kind: 'removeParameter' + name: 'textSelectionColor' + - kind: 'removeParameter' + name: 'textSelectionHandleColor' + - kind: 'removeParameter' + name: 'useTextSelectionTheme' + - if: "textSelectionColor == '' && cursorColor != '' && textSelectionHandleColor == ''" + changes: + - kind: 'addParameter' + index: 73 + name: 'textSelectionTheme' + style: optional_named + argumentValue: + expression: 'TextSelectionThemeData(cursorColor: {% cursorColor %})' + requiredIf: "textSelectionColor == '' && cursorColor != '' && textSelectionHandleColor == ''" + - kind: 'removeParameter' + name: 'cursorColor' + - kind: 'removeParameter' + name: 'useTextSelectionTheme' + - if: "textSelectionColor != '' && cursorColor == '' && textSelectionHandleColor == ''" + changes: + - kind: 'addParameter' + index: 73 + name: 'textSelectionTheme' + style: optional_named + argumentValue: + expression: 'TextSelectionThemeData(selectionColor: {% textSelectionColor %})' + requiredIf: "textSelectionColor != '' && cursorColor == '' && textSelectionHandleColor == ''" + - kind: 'removeParameter' + name: 'textSelectionColor' + - kind: 'removeParameter' + name: 'useTextSelectionTheme' + - if: "textSelectionColor == '' && cursorColor == '' && textSelectionHandleColor != ''" + changes: + - kind: 'addParameter' + index: 73 + name: 'textSelectionTheme' + style: optional_named + argumentValue: + expression: 'TextSelectionThemeData(selectionHandleColor: {% textSelectionHandleColor %})' + requiredIf: "textSelectionColor == '' && cursorColor == '' && textSelectionHandleColor != ''" + - kind: 'removeParameter' + name: 'textSelectionHandleColor' + - kind: 'removeParameter' + name: 'useTextSelectionTheme' + - if: "useTextSelectionTheme != ''" + changes: + - kind: 'removeParameter' + name: 'useTextSelectionTheme' + variables: + textSelectionColor: + kind: 'fragment' + value: 'arguments[textSelectionColor]' + cursorColor: + kind: 'fragment' + value: 'arguments[cursorColor]' + textSelectionHandleColor: + kind: 'fragment' + value: 'arguments[textSelectionHandleColor]' + useTextSelectionTheme: + kind: 'fragment' + value: 'arguments[useTextSelectionTheme]' + # Changes made in https://github.com/flutter/flutter/pull/65246 - title: "Remove 'disabledThumbGapWidth'" date: 2020-11-17 diff --git a/packages/flutter/test_fixes/material.dart b/packages/flutter/test_fixes/material.dart index 9a6e535261..6ba929d361 100644 --- a/packages/flutter/test_fixes/material.dart +++ b/packages/flutter/test_fixes/material.dart @@ -194,4 +194,96 @@ void main() { InputDecorationTheme(hasFloatingPlaceholder: false); InputDecorationTheme(); inputDecorationTheme.hasFloatingPlaceholder; + + // Changes made in https://github.com/flutter/flutter/pull/66482 + ThemeData(textSelectionColor: Colors.red); + ThemeData(cursorColor: Colors.blue); + ThemeData(textSelectionHandleColor: Colors.yellow); + ThemeData(useTextSelectionTheme: false); + ThemeData(textSelectionColor: Colors.red, useTextSelectionTheme: false); + ThemeData(cursorColor: Colors.blue, useTextSelectionTheme: false); + ThemeData(textSelectionHandleColor: Colors.yellow, useTextSelectionTheme: false); + ThemeData( + textSelectionColor: Colors.red, + cursorColor: Colors.blue, + ); + ThemeData( + textSelectionHandleColor: Colors.yellow, + cursorColor: Colors.blue, + ); + ThemeData( + textSelectionColor: Colors.red, + textSelectionHandleColor: Colors.yellow, + ); + ThemeData( + textSelectionColor: Colors.red, + cursorColor: Colors.blue, + useTextSelectionTheme: false, + ); + ThemeData( + textSelectionHandleColor: Colors.yellow, + cursorColor: Colors.blue, + useTextSelectionTheme: true, + ); + ThemeData( + textSelectionColor: Colors.red, + textSelectionHandleColor: Colors.yellow, + useTextSelectionTheme: false, + ); + ThemeData( + textSelectionColor: Colors.red, + cursorColor: Colors.blue, + textSelectionHandleColor: Colors.yellow, + ); + ThemeData( + textSelectionColor: Colors.red, + cursorColor: Colors.blue, + textSelectionHandleColor: Colors.yellow, + useTextSelectionTheme: false, + ); + ThemeData.raw(textSelectionColor: Colors.red); + ThemeData.raw(cursorColor: Colors.blue); + ThemeData.raw(textSelectionHandleColor: Colors.yellow); + ThemeData.raw(useTextSelectionTheme: false); + ThemeData.raw(textSelectionColor: Colors.red, useTextSelectionTheme: false); + ThemeData.raw(cursorColor: Colors.blue, useTextSelectionTheme: false); + ThemeData.raw(textSelectionHandleColor: Colors.yellow, useTextSelectionTheme: false); + ThemeData.raw( + textSelectionColor: Colors.red, + cursorColor: Colors.blue, + ); + ThemeData.raw( + textSelectionHandleColor: Colors.yellow, + cursorColor: Colors.blue, + ); + ThemeData.raw( + textSelectionColor: Colors.red, + textSelectionHandleColor: Colors.yellow, + ); + ThemeData.raw( + textSelectionColor: Colors.red, + cursorColor: Colors.blue, + useTextSelectionTheme: false, + ); + ThemeData.raw( + textSelectionHandleColor: Colors.yellow, + cursorColor: Colors.blue, + useTextSelectionTheme: true, + ); + ThemeData.raw( + textSelectionColor: Colors.red, + textSelectionHandleColor: Colors.yellow, + useTextSelectionTheme: false, + ); + ThemeData.raw( + textSelectionColor: Colors.red, + cursorColor: Colors.blue, + textSelectionHandleColor: Colors.yellow, + ); + ThemeData.raw( + textSelectionColor: Colors.red, + cursorColor: Colors.blue, + textSelectionHandleColor: Colors.yellow, + useTextSelectionTheme: false, + ); } diff --git a/packages/flutter/test_fixes/material.dart.expect b/packages/flutter/test_fixes/material.dart.expect index 57aeaeb7ae..3a5f868094 100644 --- a/packages/flutter/test_fixes/material.dart.expect +++ b/packages/flutter/test_fixes/material.dart.expect @@ -194,4 +194,68 @@ void main() { InputDecorationTheme(floatingLabelBehavior: FloatingLabelBehavior.never); InputDecorationTheme(); inputDecorationTheme.floatingLabelBehavior; + + // Changes made in https://github.com/flutter/flutter/pull/66482 + ThemeData(textSelectionTheme: TextSelectionThemeData(selectionColor: Colors.red)); + ThemeData(textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.blue)); + ThemeData(textSelectionTheme: TextSelectionThemeData(selectionHandleColor: Colors.yellow)); + ThemeData(); + ThemeData(textSelectionTheme: TextSelectionThemeData(selectionColor: Colors.red)); + ThemeData(textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.blue)); + ThemeData(textSelectionTheme: TextSelectionThemeData(selectionHandleColor: Colors.yellow)); + ThemeData( + textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.blue, selectionColor: Colors.red,), + ); + ThemeData( + textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.blue, selectionHandleColor: Colors.yellow,), + ); + ThemeData( + textSelectionTheme: TextSelectionThemeData(selectionColor: Colors.red, selectionHandleColor: Colors.yellow,), + ); + ThemeData( + textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.blue, selectionColor: Colors.red,), + ); + ThemeData( + textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.blue, selectionHandleColor: Colors.yellow,), + ); + ThemeData( + textSelectionTheme: TextSelectionThemeData(selectionColor: Colors.red, selectionHandleColor: Colors.yellow,), + ); + ThemeData( + textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.blue, selectionColor: Colors.red, selectionHandleColor: Colors.yellow,), + ); + ThemeData( + textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.blue, selectionColor: Colors.red, selectionHandleColor: Colors.yellow,), + ); + ThemeData.raw(textSelectionTheme: TextSelectionThemeData(selectionColor: Colors.red)); + ThemeData.raw(textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.blue)); + ThemeData.raw(textSelectionTheme: TextSelectionThemeData(selectionHandleColor: Colors.yellow)); + ThemeData.raw(); + ThemeData.raw(textSelectionTheme: TextSelectionThemeData(selectionColor: Colors.red)); + ThemeData.raw(textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.blue)); + ThemeData.raw(textSelectionTheme: TextSelectionThemeData(selectionHandleColor: Colors.yellow)); + ThemeData.raw( + textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.blue, selectionColor: Colors.red,), + ); + ThemeData.raw( + textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.blue, selectionHandleColor: Colors.yellow,), + ); + ThemeData.raw( + textSelectionTheme: TextSelectionThemeData(selectionColor: Colors.red, selectionHandleColor: Colors.yellow,), + ); + ThemeData.raw( + textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.blue, selectionColor: Colors.red,), + ); + ThemeData.raw( + textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.blue, selectionHandleColor: Colors.yellow,), + ); + ThemeData.raw( + textSelectionTheme: TextSelectionThemeData(selectionColor: Colors.red, selectionHandleColor: Colors.yellow,), + ); + ThemeData.raw( + textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.blue, selectionColor: Colors.red, selectionHandleColor: Colors.yellow,), + ); + ThemeData.raw( + textSelectionTheme: TextSelectionThemeData(cursorColor: Colors.blue, selectionColor: Colors.red, selectionHandleColor: Colors.yellow,), + ); }