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
14aa57b1
Unverified
Commit
14aa57b1
authored
Apr 01, 2019
by
Hans Muller
Committed by
GitHub
Apr 01, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix OutlineInputBorder crash (#30123)
parent
d639883c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
3 deletions
+39
-3
input_border.dart
packages/flutter/lib/src/material/input_border.dart
+3
-3
input_decorator_test.dart
packages/flutter/test/material/input_decorator_test.dart
+36
-0
No files found.
packages/flutter/lib/src/material/input_border.dart
View file @
14aa57b1
...
...
@@ -412,7 +412,7 @@ class OutlineInputBorder extends InputBorder {
const
double
cornerArcSweep
=
math
.
pi
/
2.0
;
final
double
tlCornerArcSweep
=
start
<
center
.
tlRadiusX
?
math
.
asin
(
start
/
center
.
tlRadiusX
)
?
math
.
asin
(
(
start
/
center
.
tlRadiusX
).
clamp
(-
1.0
,
1.0
)
)
:
math
.
pi
/
2.0
;
final
Path
path
=
Path
()
...
...
@@ -474,12 +474,12 @@ class OutlineInputBorder extends InputBorder {
final
double
extent
=
lerpDouble
(
0.0
,
gapExtent
+
gapPadding
*
2.0
,
gapPercentage
);
switch
(
textDirection
)
{
case
TextDirection
.
rtl
:
{
final
Path
path
=
_gapBorderPath
(
canvas
,
center
,
gapStart
+
gapPadding
-
extent
,
extent
);
final
Path
path
=
_gapBorderPath
(
canvas
,
center
,
math
.
max
(
0.0
,
gapStart
+
gapPadding
-
extent
)
,
extent
);
canvas
.
drawPath
(
path
,
paint
);
break
;
}
case
TextDirection
.
ltr
:
{
final
Path
path
=
_gapBorderPath
(
canvas
,
center
,
gapStart
-
gapPadding
,
extent
);
final
Path
path
=
_gapBorderPath
(
canvas
,
center
,
math
.
max
(
0.0
,
gapStart
-
gapPadding
)
,
extent
);
canvas
.
drawPath
(
path
,
paint
);
break
;
}
...
...
packages/flutter/test/material/input_decorator_test.dart
View file @
14aa57b1
...
...
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:io'
show
Platform
;
import
'package:flutter/material.dart'
;
...
...
@@ -2255,6 +2256,41 @@ void main() {
expect
(
getBorderRadius
(
tester
),
BorderRadius
.
zero
);
});
testWidgets
(
'OutlineInputBorder async lerp'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/28724
final
Completer
<
void
>
completer
=
Completer
<
void
>();
bool
waitIsOver
=
false
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
StatefulBuilder
(
builder:
(
BuildContext
context
,
StateSetter
setState
)
{
return
GestureDetector
(
onTap:
()
async
{
setState
(()
{
waitIsOver
=
true
;
});
await
completer
.
future
;
setState
(()
{
waitIsOver
=
false
;
});
},
child:
InputDecorator
(
decoration:
InputDecoration
(
labelText:
'Test'
,
enabledBorder:
!
waitIsOver
?
null
:
const
OutlineInputBorder
(
borderSide:
BorderSide
(
color:
Colors
.
blue
)),
),
),
);
},
),
),
);
await
tester
.
tap
(
find
.
byType
(
StatefulBuilder
));
await
tester
.
pumpAndSettle
();
completer
.
complete
();
await
tester
.
pumpAndSettle
();
});
test
(
'InputBorder equality'
,
()
{
// OutlineInputBorder's equality is defined by the borderRadius, borderSide, & gapPadding
const
OutlineInputBorder
outlineInputBorder
=
OutlineInputBorder
(
...
...
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