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
07d015d4
Unverified
Commit
07d015d4
authored
Feb 07, 2019
by
xster
Committed by
GitHub
Feb 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let text selection toolbar buttons be independent from theme (#27573)
parent
dc1eefa9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
1 deletion
+70
-1
text_selection.dart
packages/flutter/lib/src/cupertino/text_selection.dart
+8
-1
text_field_test.dart
packages/flutter/test/cupertino/text_field_test.dart
+62
-0
No files found.
packages/flutter/lib/src/cupertino/text_selection.dart
View file @
07d015d4
...
...
@@ -8,6 +8,7 @@ import 'package:flutter/widgets.dart';
import
'package:flutter/rendering.dart'
;
import
'button.dart'
;
import
'colors.dart'
;
import
'localizations.dart'
;
// Padding around the line at the edge of the text selection that has 0 width and
...
...
@@ -33,9 +34,11 @@ const EdgeInsets _kToolbarButtonPadding = EdgeInsets.symmetric(vertical: 10.0, h
const
BorderRadius
_kToolbarBorderRadius
=
BorderRadius
.
all
(
Radius
.
circular
(
7.5
));
const
TextStyle
_kToolbarButtonFontStyle
=
TextStyle
(
inherit:
false
,
fontSize:
14.0
,
letterSpacing:
-
0.11
,
fontWeight:
FontWeight
.
w300
,
color:
CupertinoColors
.
white
,
);
/// Paints a triangle below the toolbar.
...
...
@@ -113,8 +116,12 @@ class _TextSelectionToolbar extends StatelessWidget {
ClipRRect
(
borderRadius:
_kToolbarBorderRadius
,
child:
DecoratedBox
(
decoration:
const
BoxDecoration
(
decoration:
BoxDecoration
(
color:
_kToolbarDividerColor
,
borderRadius:
_kToolbarBorderRadius
,
// Add a hairline border with the button color to avoid
// antialiasing artifacts.
border:
Border
.
all
(
color:
_kToolbarBackgroundColor
,
width:
0
),
),
child:
Row
(
mainAxisSize:
MainAxisSize
.
min
,
children:
items
),
),
...
...
packages/flutter/test/cupertino/text_field_test.dart
View file @
07d015d4
...
...
@@ -702,6 +702,68 @@ void main() {
expect
(
controller
.
text
,
'abcdef'
);
});
testWidgets
(
'toolbar has the same visual regardless of theming'
,
(
WidgetTester
tester
)
async
{
final
TextEditingController
controller
=
TextEditingController
(
text:
"j'aime la poutine"
,
);
await
tester
.
pumpWidget
(
CupertinoApp
(
home:
Column
(
children:
<
Widget
>[
CupertinoTextField
(
controller:
controller
,
),
],
),
),
);
await
tester
.
longPressAt
(
tester
.
getTopRight
(
find
.
text
(
"j'aime la poutine"
))
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
200
));
Text
text
=
tester
.
widget
<
Text
>(
find
.
text
(
'Paste'
));
expect
(
text
.
style
.
color
,
CupertinoColors
.
white
);
expect
(
text
.
style
.
fontSize
,
14
);
expect
(
text
.
style
.
letterSpacing
,
-
0.11
);
expect
(
text
.
style
.
fontWeight
,
FontWeight
.
w300
);
// Change the theme.
await
tester
.
pumpWidget
(
CupertinoApp
(
theme:
const
CupertinoThemeData
(
brightness:
Brightness
.
dark
,
textTheme:
CupertinoTextThemeData
(
textStyle:
TextStyle
(
fontSize:
100
,
fontWeight:
FontWeight
.
w800
),
),
),
home:
Column
(
children:
<
Widget
>[
CupertinoTextField
(
controller:
controller
,
),
],
),
),
);
await
tester
.
longPressAt
(
tester
.
getTopRight
(
find
.
text
(
"j'aime la poutine"
))
);
await
tester
.
pump
();
await
tester
.
pump
(
const
Duration
(
milliseconds:
200
));
text
=
tester
.
widget
<
Text
>(
find
.
text
(
'Paste'
));
// The toolbar buttons' text are still the same style.
expect
(
text
.
style
.
color
,
CupertinoColors
.
white
);
expect
(
text
.
style
.
fontSize
,
14
);
expect
(
text
.
style
.
letterSpacing
,
-
0.11
);
expect
(
text
.
style
.
fontWeight
,
FontWeight
.
w300
);
});
testWidgets
(
'copy paste'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
CupertinoApp
(
...
...
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