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
890e6cce
Unverified
Commit
890e6cce
authored
Sep 25, 2020
by
Hans Muller
Committed by
GitHub
Sep 25, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced obsolete use of FlatButton with TextButton (#66597)
parent
db6e2d8a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
21 deletions
+24
-21
text_selection.dart
packages/flutter/lib/src/material/text_selection.dart
+14
-11
text_field_test.dart
packages/flutter/test/material/text_field_test.dart
+5
-5
selectable_text_test.dart
packages/flutter/test/widgets/selectable_text_test.dart
+5
-5
No files found.
packages/flutter/lib/src/material/text_selection.dart
View file @
890e6cce
...
...
@@ -11,15 +11,14 @@ import 'package:flutter/scheduler.dart';
import
'package:flutter/services.dart'
;
import
'package:flutter/widgets.dart'
;
import
'button_theme.dart'
;
import
'colors.dart'
;
import
'constants.dart'
;
import
'debug.dart'
;
import
'flat_button.dart'
;
import
'icon_button.dart'
;
import
'icons.dart'
;
import
'material.dart'
;
import
'material_localizations.dart'
;
import
'text_button.dart'
;
import
'text_selection_theme.dart'
;
import
'theme.dart'
;
...
...
@@ -84,22 +83,26 @@ class _TextSelectionToolbarState extends State<_TextSelectionToolbar> with Ticke
Widget
_getItem
(
_ItemData
itemData
,
bool
isFirst
,
bool
isLast
)
{
assert
(
isFirst
!=
null
);
assert
(
isLast
!=
null
);
return
ButtonTheme
.
fromButtonThemeData
(
data:
ButtonTheme
.
of
(
context
).
copyWith
(
height:
kMinInteractiveDimension
,
minWidth:
kMinInteractiveDimension
,
),
child:
FlatButton
(
onPressed:
itemData
.
onPressed
,
// TODO(hansmuller): Should be colorScheme.onSurface
final
ThemeData
theme
=
Theme
.
of
(
context
);
final
bool
isDark
=
theme
.
colorScheme
.
brightness
==
Brightness
.
dark
;
final
Color
primary
=
isDark
?
Colors
.
white
:
Colors
.
black87
;
return
TextButton
(
style:
TextButton
.
styleFrom
(
primary:
primary
,
shape:
const
RoundedRectangleBorder
(),
minimumSize:
const
Size
(
kMinInteractiveDimension
,
kMinInteractiveDimension
),
padding:
EdgeInsets
.
only
(
// These values were eyeballed to match the native text selection menu
// on a Pixel 2 running Android 10.
left:
9.5
+
(
isFirst
?
5.0
:
0.0
),
right:
9.5
+
(
isLast
?
5.0
:
0.0
),
),
shape:
Border
.
all
(
width:
0.0
,
color:
Colors
.
transparent
),
child:
Text
(
itemData
.
label
),
),
onPressed:
itemData
.
onPressed
,
child:
Text
(
itemData
.
label
),
);
}
...
...
packages/flutter/test/material/text_field_test.dart
View file @
890e6cce
...
...
@@ -6172,7 +6172,7 @@ void main() {
);
// But don't trigger the toolbar.
expect
(
find
.
byType
(
Fla
tButton
),
findsNothing
);
expect
(
find
.
byType
(
Tex
tButton
),
findsNothing
);
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
android
,
TargetPlatform
.
fuchsia
,
TargetPlatform
.
linux
,
TargetPlatform
.
windows
}));
testWidgets
(
...
...
@@ -6297,7 +6297,7 @@ void main() {
);
// Selected text shows 4 toolbar buttons: cut, copy, paste, select all
expect
(
find
.
byType
(
Fla
tButton
),
findsNWidgets
(
4
));
expect
(
find
.
byType
(
Tex
tButton
),
findsNWidgets
(
4
));
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
android
,
TargetPlatform
.
fuchsia
,
TargetPlatform
.
linux
,
TargetPlatform
.
windows
}));
testWidgets
(
...
...
@@ -6346,7 +6346,7 @@ void main() {
);
// Selected text shows 4 toolbar buttons: cut, copy, paste, select all
expect
(
find
.
byType
(
Fla
tButton
),
findsNWidgets
(
4
));
expect
(
find
.
byType
(
Tex
tButton
),
findsNWidgets
(
4
));
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
android
,
TargetPlatform
.
fuchsia
,
TargetPlatform
.
linux
,
TargetPlatform
.
windows
}));
testWidgets
(
...
...
@@ -6628,7 +6628,7 @@ void main() {
);
// Collapsed toolbar shows 4 buttons: cut, copy, paste, select all
expect
(
find
.
byType
(
Fla
tButton
),
findsNWidgets
(
4
));
expect
(
find
.
byType
(
Tex
tButton
),
findsNWidgets
(
4
));
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
android
,
TargetPlatform
.
fuchsia
,
TargetPlatform
.
linux
,
TargetPlatform
.
windows
}));
testWidgets
(
...
...
@@ -7006,7 +7006,7 @@ void main() {
await
gesture
.
up
();
await
tester
.
pump
();
expect
(
find
.
byType
(
Fla
tButton
),
findsNothing
);
expect
(
find
.
byType
(
Tex
tButton
),
findsNothing
);
},
variant:
const
TargetPlatformVariant
(<
TargetPlatform
>{
TargetPlatform
.
android
,
TargetPlatform
.
fuchsia
,
TargetPlatform
.
linux
,
TargetPlatform
.
windows
}));
testWidgets
(
'force press selects word'
,
(
WidgetTester
tester
)
async
{
...
...
packages/flutter/test/widgets/selectable_text_test.dart
View file @
890e6cce
...
...
@@ -2442,7 +2442,7 @@ void main() {
);
// But don't trigger the toolbar.
expect
(
find
.
byType
(
Fla
tButton
),
findsNothing
);
expect
(
find
.
byType
(
Tex
tButton
),
findsNothing
);
},
);
...
...
@@ -2564,7 +2564,7 @@ void main() {
);
// Selected text shows 2 toolbar buttons: copy, select all
expect
(
find
.
byType
(
Fla
tButton
),
findsNWidgets
(
2
));
expect
(
find
.
byType
(
Tex
tButton
),
findsNWidgets
(
2
));
},
);
...
...
@@ -2613,7 +2613,7 @@ void main() {
);
// Selected text shows 2 toolbar buttons: copy, select all
expect
(
find
.
byType
(
Fla
tButton
),
findsNWidgets
(
2
));
expect
(
find
.
byType
(
Tex
tButton
),
findsNWidgets
(
2
));
},
);
...
...
@@ -2769,7 +2769,7 @@ void main() {
);
// Collapsed toolbar shows 2 buttons: copy, select all
expect
(
find
.
byType
(
Fla
tButton
),
findsNWidgets
(
2
));
expect
(
find
.
byType
(
Tex
tButton
),
findsNWidgets
(
2
));
},
);
...
...
@@ -3175,7 +3175,7 @@ void main() {
await
gesture
.
up
();
await
tester
.
pump
();
expect
(
find
.
byType
(
Fla
tButton
),
findsNothing
);
expect
(
find
.
byType
(
Tex
tButton
),
findsNothing
);
});
testWidgets
(
'force press selects word'
,
(
WidgetTester
tester
)
async
{
...
...
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