Skip to content

Commit f30b7f4

Browse files
christopherfujinowilllarchepedromassangoJonah Williams
authored
[flutter_releases] Flutter 1.22.1 Framework Cherrypicks (flutter#67552)
* [Docs] [Material] Fix Icons api docs (flutter#66508) * [Docs] [Icons] Updating dart doc styles to recognize more styles of icons. All the 4 icon styles we support have to be pulled from 4 individual web fonts when we show the html page for api docs. * Better documentation and that special awful case. * Couple more places to remove. * Add back the autovalidate class property (flutter#66267) * Add back autovalidate property * Add autovalidate property back (include tests) * Fix typos * One more test :) * [flutter_tools] prevent running analyze-size with split-debug-info (flutter#66983) Running a build command with split debug info and analyze size causes a crash in the snapshot analysis library. Disable the combination of these two flags. Fixes flutter#66962 * fix invocatiion of non-existent function after cherry pick * update engine revision Co-authored-by: Will Larche <larche@google.com> Co-authored-by: Pedro Massango <pedromassango.developer@gmail.com> Co-authored-by: Jonah Williams <jonahwilliams@google.com>
1 parent d408d30 commit f30b7f4

File tree

9 files changed

+4288
-4148
lines changed

9 files changed

+4288
-4148
lines changed

bin/internal/engine.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5babba6c4d25fa237bbf755ab85c9a0c50b3c6ec
1+
75bef9f6c8ac2ed4e1e04cdfcd88b177d9f1850d

dev/docs/assets/overrides.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ dl.dl-horizontal dt {
121121
}
122122

123123
/* Line the material icons up with their labels */
124-
i.material-icons.md-36,
125-
i.material-icons.md-48 {
124+
i.md-36 {
126125
vertical-align: bottom;
127126
}
128127

dev/docs/styles.html

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,13 @@
11
<!-- style overrides for dartdoc -->
22
<style>
33
@import 'https://fonts.googleapis.com/css?family=Roboto:500,400italic,300,400,100i';
4-
@import 'https://fonts.googleapis.com/css?family=Material+Icons';
4+
@import 'https://fonts.googleapis.com/css?family=Material+Icons|Material+Icons+Outlined|Material+Icons+Sharp|Material+Icons+Round';
55
</style>
66

77
<link href="../assets/overrides.css" rel="stylesheet" type="text/css">
88

9-
<!-- The following rules are from http://google.github.io/material-design-icons/ -->
10-
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
9+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons|Material+Icons+Outlined|Material+Icons+Sharp|Material+Icons+Round" rel="stylesheet">
1110
<style>
12-
/* Rules for sizing the icon. */
13-
.material-icons.md-18 { font-size: 18px; }
14-
.material-icons.md-24 { font-size: 24px; }
15-
.material-icons.md-36 { font-size: 36px; }
16-
.material-icons.md-48 { font-size: 48px; }
17-
18-
/* Rules for using icons as black on a light background. */
19-
.material-icons.md-dark { color: rgba(0, 0, 0, 0.54); }
20-
.material-icons.md-dark.md-inactive { color: rgba(0, 0, 0, 0.26); }
21-
22-
/* Rules for using icons as white on a dark background. */
23-
.material-icons.md-light { color: rgba(255, 255, 255, 1); }
24-
.material-icons.md-light.md-inactive { color: rgba(255, 255, 255, 0.3); }
11+
/* Rule for sizing the icon. */
12+
.md-36 { font-size: 36px; }
2513
</style>

dev/tools/update_icons.dart

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,40 @@ void _testIsMapSuperset(Map<String, String> newCodepoints, Map<String, String> o
263263
}
264264

265265
String _generateDeclaration(MapEntry<String, String> tokenPair) {
266-
final String identifier = _generateIdentifier(tokenPair.key);
267266
final String description = tokenPair.key.replaceAll('_', ' ');
267+
268+
String styleSuffix = '';
269+
String webFontKey = tokenPair.key;
270+
271+
// The first line of each generated declaration includes a comment of html.
272+
// DartDocs reads that to make the listings in our api docs that shows the
273+
// icon rendered next to its key name. Unfortunately, unlike Flutter, this
274+
// html needs to use a different web font for each style. We read the style's
275+
// suffix from the key for Flutter's icons font, add the corresponding style's
276+
// suffix to the class we pass into html, and then remove the suffix from the
277+
// icon key. The keys needed for the individual web fonts do not use a suffix
278+
// to denote style.
279+
if (webFontKey.endsWith('_outlined') && webFontKey!='insert_chart_outlined') {
280+
styleSuffix = '-outlined';
281+
webFontKey = webFontKey.replaceAll('_outlined', '');
282+
}
283+
if (webFontKey.endsWith('_rounded')) {
284+
styleSuffix = '-round';
285+
webFontKey = webFontKey.replaceAll('_rounded', '');
286+
}
287+
if (webFontKey.endsWith('_sharp')) {
288+
styleSuffix = '-sharp';
289+
webFontKey = webFontKey.replaceAll('_sharp', '');
290+
}
291+
292+
final String identifier = _generateIdentifier(tokenPair.key);
268293
final String rtl = _mirroredIcons.contains(tokenPair.key)
269294
? ', matchTextDirection: true'
270295
: '';
296+
271297
return '''
272298
273-
/// <i class="material-icons md-36">${tokenPair.key}</i> &#x2014; material icon named "$description".
299+
/// <i class="material-icons$styleSuffix md-36">$webFontKey</i> &#x2014; material icon named "$description".
274300
static const IconData $identifier = IconData(0x${tokenPair.value}, fontFamily: 'MaterialIcons'$rtl);
275301
''';
276302
}

packages/flutter/lib/src/material/icons.dart

Lines changed: 4113 additions & 4113 deletions
Large diffs are not rendered by default.

packages/flutter/lib/src/widgets/form.dart

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ class Form extends StatefulWidget {
7979
Key key,
8080
@required this.child,
8181
@Deprecated(
82-
'Use autoValidateMode parameter which provide more specific '
83-
'behaviour related to auto validation. '
82+
'Use autoValidateMode parameter which provides more specific '
83+
'behavior related to auto validation. '
8484
'This feature was deprecated after v1.19.0.'
8585
)
86-
bool autovalidate = false,
86+
this.autovalidate = false,
8787
this.onWillPop,
8888
this.onChanged,
8989
AutovalidateMode autovalidateMode,
@@ -94,9 +94,8 @@ class Form extends StatefulWidget {
9494
autovalidate == true && autovalidateMode == null,
9595
'autovalidate and autovalidateMode should not be used together.'
9696
),
97-
autovalidateMode = autovalidate
98-
? AutovalidateMode.always
99-
: (autovalidateMode ?? AutovalidateMode.disabled),
97+
autovalidateMode = autovalidateMode ??
98+
(autovalidate ? AutovalidateMode.always : AutovalidateMode.disabled),
10099
super(key: key);
101100

102101
/// Returns the closest [FormState] which encloses the given context.
@@ -143,6 +142,15 @@ class Form extends StatefulWidget {
143142
/// {@macro flutter.widgets.form.autovalidateMode}
144143
final AutovalidateMode autovalidateMode;
145144

145+
/// Used to enable/disable form fields auto validation and update their error
146+
/// text.
147+
@Deprecated(
148+
'Use autoValidateMode parameter which provides more specific '
149+
'behavior related to auto validation. '
150+
'This feature was deprecated after v1.19.0.'
151+
)
152+
final bool autovalidate;
153+
146154
@override
147155
FormState createState() => FormState();
148156
}
@@ -320,11 +328,11 @@ class FormField<T> extends StatefulWidget {
320328
this.validator,
321329
this.initialValue,
322330
@Deprecated(
323-
'Use autoValidateMode parameter which provide more specific '
324-
'behaviour related to auto validation. '
331+
'Use autoValidateMode parameter which provides more specific '
332+
'behavior related to auto validation. '
325333
'This feature was deprecated after v1.19.0.'
326334
)
327-
bool autovalidate = false,
335+
this.autovalidate = false,
328336
this.enabled = true,
329337
AutovalidateMode autovalidateMode,
330338
}) : assert(builder != null),
@@ -333,9 +341,8 @@ class FormField<T> extends StatefulWidget {
333341
autovalidate == true && autovalidateMode == null,
334342
'autovalidate and autovalidateMode should not be used together.'
335343
),
336-
autovalidateMode = autovalidate
337-
? AutovalidateMode.always
338-
: (autovalidateMode ?? AutovalidateMode.disabled),
344+
autovalidateMode = autovalidateMode ??
345+
(autovalidate ? AutovalidateMode.always : AutovalidateMode.disabled),
339346
super(key: key);
340347

341348
/// An optional method to call with the final value when the form is saved via
@@ -387,6 +394,15 @@ class FormField<T> extends StatefulWidget {
387394
/// {@endtemplate}
388395
final AutovalidateMode autovalidateMode;
389396

397+
/// Used to enable/disable auto validation and update their error
398+
/// text.
399+
@Deprecated(
400+
'Use autoValidateMode parameter which provides more specific '
401+
'behavior related to auto validation. '
402+
'This feature was deprecated after v1.19.0.'
403+
)
404+
final bool autovalidate;
405+
390406
@override
391407
FormFieldState<T> createState() => FormFieldState<T>();
392408
}

packages/flutter/test/widgets/form_test.dart

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -886,4 +886,87 @@ void main() {
886886
expect(fieldValue, '123456');
887887
expect(formKey.currentState.validate(), isFalse);
888888
});
889+
890+
testWidgets('FormField.autovalidate parameter is passed into class the property', (WidgetTester tester) async {
891+
String errorText(String value) => '$value/error';
892+
const ObjectKey widgetKey = ObjectKey('key');
893+
894+
Widget builder({@required bool autovalidate}) {
895+
return MaterialApp(
896+
home: MediaQuery(
897+
data: const MediaQueryData(devicePixelRatio: 1.0),
898+
child: Directionality(
899+
textDirection: TextDirection.ltr,
900+
child: Center(
901+
child: Material(
902+
child: FormField<String>(
903+
key: widgetKey,
904+
initialValue: 'foo',
905+
autovalidate: autovalidate,
906+
builder: (FormFieldState<String> state) {
907+
return Container();
908+
},
909+
validator: errorText,
910+
),
911+
),
912+
),
913+
),
914+
),
915+
);
916+
}
917+
918+
// When autovalidate is true
919+
await tester.pumpWidget(builder(autovalidate: true));
920+
921+
final Finder formFieldFinder = find.byKey(widgetKey);
922+
FormField<String> formField = tester.widget(formFieldFinder);
923+
expect(formField.autovalidate, isTrue);
924+
expect(formField.autovalidateMode, equals(AutovalidateMode.always));
925+
926+
// When autovalidate is false
927+
await tester.pumpWidget(builder(autovalidate: false));
928+
929+
formField = tester.widget(formFieldFinder);
930+
expect(formField.autovalidate, isFalse);
931+
expect(formField.autovalidateMode, equals(AutovalidateMode.disabled));
932+
});
933+
934+
testWidgets('Form.autovalidate parameter is passed into class the property', (WidgetTester tester) async {
935+
const ObjectKey widgetKey = ObjectKey('key');
936+
937+
Widget builder({@required bool autovalidate}) {
938+
return MaterialApp(
939+
home: MediaQuery(
940+
data: const MediaQueryData(devicePixelRatio: 1.0),
941+
child: Directionality(
942+
textDirection: TextDirection.ltr,
943+
child: Center(
944+
child: Material(
945+
child: Form(
946+
key: widgetKey,
947+
autovalidate: autovalidate,
948+
child: Container(),
949+
),
950+
),
951+
),
952+
),
953+
),
954+
);
955+
}
956+
957+
// When autovalidate is true
958+
await tester.pumpWidget(builder(autovalidate: true));
959+
960+
final Finder formFinder = find.byKey(widgetKey);
961+
Form formWidget = tester.widget(formFinder);
962+
expect(formWidget.autovalidate, isTrue);
963+
expect(formWidget.autovalidateMode, equals(AutovalidateMode.always));
964+
965+
// When autovalidate is false
966+
await tester.pumpWidget(builder(autovalidate: false));
967+
968+
formWidget = tester.widget(formFinder);
969+
expect(formWidget.autovalidate, isFalse);
970+
expect(formWidget.autovalidateMode, equals(AutovalidateMode.disabled));
971+
});
889972
}

packages/flutter_tools/lib/src/runner/flutter_command.dart

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,8 @@ abstract class FlutterCommand extends Command<void> {
458458
'symbol files can be stored for later use. These symbol files contain '
459459
'the information needed to symbolize Dart stack traces. For an app built '
460460
"with this flag, the 'flutter symbolize' command with the right program "
461-
'symbol file is required to obtain a human readable stack trace.',
461+
'symbol file is required to obtain a human readable stack trace.\n'
462+
'This flag cannot be combined with --analyze-size',
462463
valueHelp: '/project-name/v1.2.3/',
463464
);
464465
}
@@ -654,7 +655,8 @@ abstract class FlutterCommand extends Command<void> {
654655
help: 'Whether to produce additional profile information for artifact output size. '
655656
'This flag is only supported on release builds. When building for Android, a single '
656657
'ABI must be specified at a time with the --target-platform flag. When building for iOS, '
657-
'only the symbols from the arm64 architecture are used to analyze code size.'
658+
'only the symbols from the arm64 architecture are used to analyze code size.\n'
659+
'This flag cannot be combined with --split-debug-info.'
658660
);
659661
}
660662

@@ -737,6 +739,9 @@ abstract class FlutterCommand extends Command<void> {
737739
if (buildMode != BuildMode.release && codeSizeDirectory != null) {
738740
throwToolExit('--analyze-size can only be used on release builds.');
739741
}
742+
if (codeSizeDirectory != null && splitDebugInfoPath != null) {
743+
throwToolExit('--analyze-size cannot be combined with --split-debug-info.');
744+
}
740745

741746
final bool treeShakeIcons = argParser.options.containsKey('tree-shake-icons')
742747
&& buildMode.isPrecompiled

packages/flutter_tools/test/integration.shard/analyze_size_test.dart

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,27 @@ void main() {
7878

7979
expect(result.exitCode, 1);
8080
});
81+
82+
testWithoutContext('--analyze-size is not supported in combination with --split-debug-info', () async {
83+
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
84+
final List<String> localEngineArguments = <String>[
85+
if (platform.environment.containsKey('FLUTTER_LOCAL_ENGINE'))
86+
'--local-engine=${platform.environment['FLUTTER_LOCAL_ENGINE']}',
87+
if (platform.environment.containsKey('FLUTTER_LOCAL_ENGINE_SRC_PATH'))
88+
'--local-engine-src-path=${platform.environment['FLUTTER_LOCAL_ENGINE_SRC_PATH']}',
89+
];
90+
final ProcessResult result = await processManager.run(<String>[
91+
flutterBin,
92+
...localEngineArguments,
93+
'build',
94+
'apk',
95+
'--analyze-size',
96+
'--target-platform=android-arm64',
97+
'--split-debug-info=infos'
98+
], workingDirectory: fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world'));
99+
100+
expect(result.stderr.toString(), contains('--analyze-size cannot be combined with --split-debug-info'));
101+
102+
expect(result.exitCode, 1);
103+
});
81104
}

0 commit comments

Comments
 (0)