[go: nahoru, domu]

Skip to content

Commit

Permalink
Step 3 of 3: Remove opt-in for debugCheckHasMaterialLocalizations ass…
Browse files Browse the repository at this point in the history
…ertion on TextField (flutter#58831)
  • Loading branch information
Piinks authored and zljj0818 committed Jun 22, 2020
1 parent 29585de commit 620135d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 22 deletions.
4 changes: 2 additions & 2 deletions packages/flutter/lib/src/material/debug.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ bool debugCheckHasMaterialLocalizations(BuildContext context) {
'to be provided by a Localizations widget ancestor.'
),
ErrorDescription(
'Localizations are used to generate many different messages, labels, '
'and abbreviations which are used by the material library.'
'The material library uses Localizations to generate messages, '
'labels, and abbreviations.'
),
ErrorHint(
'To introduce a MaterialLocalizations, either use a '
Expand Down
19 changes: 1 addition & 18 deletions packages/flutter/lib/src/material/text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

// @dart = 2.8

// TODO(Piinks): Remove ignoring deprecated member use analysis
// when TextField.canAssertMaterialLocalizations parameter is removed.
// ignore_for_file: deprecated_member_use_from_same_package

import 'dart:ui' as ui show BoxHeightStyle, BoxWidthStyle;

import 'package:flutter/cupertino.dart';
Expand Down Expand Up @@ -354,7 +350,6 @@ class TextField extends StatefulWidget {
this.scrollController,
this.scrollPhysics,
this.autofillHints,
bool canAssertMaterialLocalizations,
}) : assert(textAlign != null),
assert(readOnly != null),
assert(autofocus != null),
Expand Down Expand Up @@ -400,7 +395,6 @@ class TextField extends StatefulWidget {
selectAll: true,
paste: true,
)),
canAssertMaterialLocalizations = canAssertMaterialLocalizations ?? true,
super(key: key);

/// Controls the text being edited.
Expand Down Expand Up @@ -733,16 +727,6 @@ class TextField extends StatefulWidget {
/// {@macro flutter.services.autofill.autofillHints}
final Iterable<String> autofillHints;

/// Indicates whether [debugCheckHasMaterialLocalizations] can be called
/// during build.
@Deprecated(
'Set canAssertMaterialLocalizations to `true`. This parameter will be '
'removed and was introduced to migrate TextField to assert '
'debugCheckHasMaterialLocalizations by default. '
'This feature was deprecated after v1.18.0.'
)
final bool canAssertMaterialLocalizations;

@override
_TextFieldState createState() => _TextFieldState();

Expand Down Expand Up @@ -1004,8 +988,7 @@ class _TextFieldState extends State<TextField> implements TextSelectionGestureDe
@override
Widget build(BuildContext context) {
assert(debugCheckHasMaterial(context));
if (widget.canAssertMaterialLocalizations)
assert(debugCheckHasMaterialLocalizations(context));
assert(debugCheckHasMaterialLocalizations(context));
assert(debugCheckHasDirectionality(context));
assert(
!(widget.style != null && widget.style.inherit == false &&
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/test/material/debug_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ void main() {
' No MaterialLocalizations found.\n'
' BackButton widgets require MaterialLocalizations to be provided\n'
' by a Localizations widget ancestor.\n'
' Localizations are used to generate many different messages,\n'
' labels, and abbreviations which are used by the material library.\n'
' The material library uses Localizations to generate messages,\n'
' labels, and abbreviations.\n'
' To introduce a MaterialLocalizations, either use a MaterialApp at\n'
' the root of your application to include them automatically, or\n'
' add a Localization widget with a MaterialLocalizations delegate.\n'
Expand Down

0 comments on commit 620135d

Please sign in to comment.