forked from firka/flutter
Step 3 of 3: Remove opt-in for debugCheckHasMaterialLocalizations assertion on TextField (#58831)
This commit is contained in:
@@ -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 '
|
||||
|
||||
@@ -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';
|
||||
@@ -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),
|
||||
@@ -400,7 +395,6 @@ class TextField extends StatefulWidget {
|
||||
selectAll: true,
|
||||
paste: true,
|
||||
)),
|
||||
canAssertMaterialLocalizations = canAssertMaterialLocalizations ?? true,
|
||||
super(key: key);
|
||||
|
||||
/// Controls the text being edited.
|
||||
@@ -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();
|
||||
|
||||
@@ -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 &&
|
||||
|
||||
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user