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
6758b55c
Unverified
Commit
6758b55c
authored
Mar 19, 2018
by
Ian Hickson
Committed by
GitHub
Mar 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix weird bug when switching text from errorText to helperText (#15390)
parent
0e8b1877
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
5 deletions
+39
-5
input_decorator.dart
packages/flutter/lib/src/material/input_decorator.dart
+11
-5
slider_theme.dart
packages/flutter/lib/src/material/slider_theme.dart
+5
-0
text_field.dart
packages/flutter/lib/src/material/text_field.dart
+2
-0
form.dart
packages/flutter/lib/src/widgets/form.dart
+4
-0
text_field_helper_text_test.dart
...es/flutter/test/material/text_field_helper_text_test.dart
+17
-0
No files found.
packages/flutter/lib/src/material/input_decorator.dart
View file @
6758b55c
...
...
@@ -277,16 +277,19 @@ class _HelperErrorState extends State<_HelperError> with SingleTickerProviderSta
void
didUpdateWidget
(
_HelperError
old
)
{
super
.
didUpdateWidget
(
old
);
final
String
e
rrorText
=
widget
.
errorText
;
final
String
h
elperText
=
widget
.
helperText
;
final
String
newE
rrorText
=
widget
.
errorText
;
final
String
newH
elperText
=
widget
.
helperText
;
final
String
oldErrorText
=
old
.
errorText
;
final
String
oldHelperText
=
old
.
helperText
;
if
((
errorText
??
helperText
)
!=
(
oldErrorText
??
oldHelperText
))
{
if
(
errorText
!=
null
)
{
final
bool
errorTextStateChanged
=
(
newErrorText
!=
null
)
!=
(
oldErrorText
!=
null
);
final
bool
helperTextStateChanged
=
newErrorText
==
null
&&
(
newHelperText
!=
null
)
!=
(
oldHelperText
!=
null
);
if
(
errorTextStateChanged
||
helperTextStateChanged
)
{
if
(
newErrorText
!=
null
)
{
_error
=
_buildError
();
_controller
.
forward
();
}
else
if
(
h
elperText
!=
null
)
{
}
else
if
(
newH
elperText
!=
null
)
{
_helper
=
_buildHelper
();
_controller
.
reverse
();
}
else
{
...
...
@@ -1818,6 +1821,9 @@ class InputDecoration {
///
/// If non-null, the border's color animates to red and the [helperText] is
/// not shown.
///
/// In a [TextFormField], this is overridden by the value returned from
/// [TextFormField.validator], if that is not null.
final
String
errorText
;
/// The style to use for the [errorText].
...
...
packages/flutter/lib/src/material/slider_theme.dart
View file @
6758b55c
...
...
@@ -337,6 +337,8 @@ class SliderThemeData extends Diagnosticable {
/// when the thumb is being touched.
final
ShowValueIndicator
showValueIndicator
;
/// Creates a copy of this object but with the given fields replaced with the
/// new values.
SliderThemeData
copyWith
({
Color
activeRailColor
,
Color
inactiveRailColor
,
...
...
@@ -537,7 +539,9 @@ abstract class SliderComponentShape {
/// * [SliderThemeData] where an instance of this class is set to inform the
/// slider of the shape of the its thumb.
class
RoundSliderThumbShape
extends
SliderComponentShape
{
/// Create a slider thumb that draws a circle.
const
RoundSliderThumbShape
();
static
const
double
_thumbRadius
=
6.0
;
static
const
double
_disabledThumbRadius
=
4.0
;
...
...
@@ -585,6 +589,7 @@ class RoundSliderThumbShape extends SliderComponentShape {
/// * [SliderThemeData] where an instance of this class is set to inform the
/// slider of the shape of the its value indicator.
class
PaddleSliderValueIndicatorShape
extends
SliderComponentShape
{
/// Create a slider value indicator in the shape of an upside-down pear.
const
PaddleSliderValueIndicatorShape
();
// These constants define the shape of the default value indicator.
...
...
packages/flutter/lib/src/material/text_field.dart
View file @
6758b55c
...
...
@@ -213,6 +213,8 @@ class TextField extends StatefulWidget {
/// characters may be entered, but the error counter and divider will
/// switch to the [decoration.errorStyle] when the limit is exceeded.
///
/// ## Limitations
///
/// The TextField does not currently count Unicode grapheme clusters (i.e.
/// characters visible to the user), it counts Unicode scalar values, which
/// leaves out a number of useful possible characters (like many emoji and
...
...
packages/flutter/lib/src/widgets/form.dart
View file @
6758b55c
...
...
@@ -218,6 +218,10 @@ class FormField<T> extends StatefulWidget {
/// An optional method that validates an input. Returns an error string to
/// display if the input is invalid, or null otherwise.
///
/// The returned value is exposed by the [FormFieldState.errorText] property.
/// The [TextFormField] uses this to override the [InputDecoration.errorText]
/// value.
final
FormFieldValidator
<
T
>
validator
;
/// Function that returns the widget representing this form field. It is
...
...
packages/flutter/test/material/text_field_helper_text_test.dart
0 → 100644
View file @
6758b55c
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
void
main
(
)
{
testWidgets
(
'TextField works correctly when changing helperText'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
new
MaterialApp
(
home:
const
TextField
(
decoration:
const
InputDecoration
(
helperText:
'Awesome'
))));
expect
(
find
.
text
(
'Awesome'
),
findsNWidgets
(
1
));
await
tester
.
pump
(
const
Duration
(
milliseconds:
100
));
expect
(
find
.
text
(
'Awesome'
),
findsNWidgets
(
1
));
await
tester
.
pumpWidget
(
new
MaterialApp
(
home:
const
TextField
(
decoration:
const
InputDecoration
(
errorText:
'Awesome'
))));
expect
(
find
.
text
(
'Awesome'
),
findsNWidgets
(
2
));
});
}
\ No newline at end of file
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