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
e8bceabb
Unverified
Commit
e8bceabb
authored
Jun 05, 2018
by
Hans Muller
Committed by
GitHub
Jun 05, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct OutlineBorder gapStart when InputDecoration icon is specified (#18182)
parent
25c4bc32
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
3 deletions
+56
-3
goldens.version
bin/internal/goldens.version
+1
-1
input_decorator.dart
packages/flutter/lib/src/material/input_decorator.dart
+5
-2
input_decorator_test.dart
packages/flutter/test/material/input_decorator_test.dart
+50
-0
No files found.
bin/internal/goldens.version
View file @
e8bceabb
95f60c7e328b53dd65de18a608830a872a92e3cd
17b9d558228edad27729a0c1823430d73cb26608
packages/flutter/lib/src/material/input_decorator.dart
View file @
e8bceabb
...
...
@@ -1037,12 +1037,15 @@ class _RenderDecoration extends RenderBox {
}
if
(
label
!=
null
)
{
final
double
labelX
=
_boxParentData
(
label
).
offset
.
dx
;
switch
(
textDirection
)
{
case
TextDirection
.
rtl
:
decoration
.
borderGap
.
start
=
_boxParentData
(
label
).
offset
.
dx
+
label
.
size
.
width
;
decoration
.
borderGap
.
start
=
labelX
+
label
.
size
.
width
;
break
;
case
TextDirection
.
ltr
:
decoration
.
borderGap
.
start
=
_boxParentData
(
label
).
offset
.
dx
;
// The value of _InputBorderGap.start is relative to the origin of the
// _BorderContainer which is inset by the icon's width.
decoration
.
borderGap
.
start
=
labelX
-
_boxSize
(
icon
).
width
;
break
;
}
decoration
.
borderGap
.
extent
=
label
.
size
.
width
*
0.75
;
...
...
packages/flutter/test/material/input_decorator_test.dart
View file @
e8bceabb
...
...
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:io'
show
Platform
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
@@ -1428,4 +1430,52 @@ void main() {
),
);
});
testWidgets
(
'InputDecorator OutlineBorder focused label with icon'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/issues/18111
Widget
buildFrame
(
TextDirection
textDirection
)
{
return
new
MaterialApp
(
home:
new
Scaffold
(
body:
new
Container
(
padding:
const
EdgeInsets
.
all
(
16.0
),
alignment:
Alignment
.
center
,
child:
new
Directionality
(
textDirection:
textDirection
,
child:
const
RepaintBoundary
(
child:
const
InputDecorator
(
isFocused:
true
,
isEmpty:
true
,
decoration:
const
InputDecoration
(
icon:
const
Icon
(
Icons
.
insert_link
),
labelText:
'primaryLink'
,
hintText:
'Primary link to story'
,
border:
const
OutlineInputBorder
(),
),
),
),
),
),
),
);
}
await
tester
.
pumpWidget
(
buildFrame
(
TextDirection
.
ltr
));
await
expectLater
(
find
.
byType
(
InputDecorator
),
matchesGoldenFile
(
'input_decorator.outline_icon_label.ltr.png'
),
skip:
!
Platform
.
isLinux
,
);
await
tester
.
pumpWidget
(
buildFrame
(
TextDirection
.
rtl
));
await
expectLater
(
find
.
byType
(
InputDecorator
),
matchesGoldenFile
(
'input_decorator.outline_icon_label.rtl.png'
),
skip:
!
Platform
.
isLinux
,
);
},
skip:
!
Platform
.
isLinux
,
);
}
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