Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
c733864a
Unverified
Commit
c733864a
authored
May 14, 2020
by
Kate Lovett
Committed by
GitHub
May 14, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Step 1 of 3: Add opt-in for debugCheckHasMaterialLocalizations assertion on TextField (#56090)
parent
ae462038
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
13 deletions
+25
-13
text_field.dart
packages/flutter/lib/src/material/text_field.dart
+18
-2
physical_model_test.dart
packages/flutter/test/widgets/physical_model_test.dart
+7
-11
No files found.
packages/flutter/lib/src/material/text_field.dart
View file @
c733864a
...
...
@@ -2,6 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// 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'
;
...
...
@@ -348,6 +352,7 @@ class TextField extends StatefulWidget {
this
.
scrollController
,
this
.
scrollPhysics
,
this
.
autofillHints
,
bool
canAssertMaterialLocalizations
,
})
:
assert
(
textAlign
!=
null
),
assert
(
readOnly
!=
null
),
assert
(
autofocus
!=
null
),
...
...
@@ -393,6 +398,7 @@ class TextField extends StatefulWidget {
selectAll:
true
,
paste:
true
,
)),
canAssertMaterialLocalizations
=
canAssertMaterialLocalizations
??
false
,
super
(
key:
key
);
/// Controls the text being edited.
...
...
@@ -724,6 +730,16 @@ class TextField extends StatefulWidget {
/// {@macro flutter.widgets.editableText.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
();
...
...
@@ -964,8 +980,8 @@ class _TextFieldState extends State<TextField> implements TextSelectionGestureDe
@override
Widget
build
(
BuildContext
context
)
{
assert
(
debugCheckHasMaterial
(
context
));
// TODO(jonahwilliams): uncomment out this check once we have migrated tests.
//
assert(debugCheckHasMaterialLocalizations(context));
if
(
widget
.
canAssertMaterialLocalizations
)
assert
(
debugCheckHasMaterialLocalizations
(
context
));
assert
(
debugCheckHasDirectionality
(
context
));
assert
(
!(
widget
.
style
!=
null
&&
widget
.
style
.
inherit
==
false
&&
...
...
packages/flutter/test/widgets/physical_model_test.dart
View file @
c733864a
...
...
@@ -55,17 +55,13 @@ void main() {
testWidgets
(
'PhysicalModel - creates a physical model layer when it needs compositing'
,
(
WidgetTester
tester
)
async
{
debugDisableShadows
=
false
;
await
tester
.
pumpWidget
(
MediaQuery
(
data:
const
MediaQueryData
(
devicePixelRatio:
1.0
),
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
PhysicalModel
(
shape:
BoxShape
.
rectangle
,
color:
Colors
.
grey
,
shadowColor:
Colors
.
red
,
elevation:
1.0
,
child:
Material
(
child:
TextField
(
controller:
TextEditingController
())),
),
MaterialApp
(
home:
PhysicalModel
(
shape:
BoxShape
.
rectangle
,
color:
Colors
.
grey
,
shadowColor:
Colors
.
red
,
elevation:
1.0
,
child:
Material
(
child:
TextField
(
controller:
TextEditingController
())),
),
),
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment