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
a77388e6
Unverified
Commit
a77388e6
authored
Feb 05, 2021
by
Hans Muller
Committed by
GitHub
Feb 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ToggleButtons focus,highlight,hoverElevation = 0 (#75454)
parent
da6528cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
3 deletions
+52
-3
toggle_buttons.dart
packages/flutter/lib/src/material/toggle_buttons.dart
+4
-3
toggle_buttons_test.dart
packages/flutter/test/material/toggle_buttons_test.dart
+48
-0
No files found.
packages/flutter/lib/src/material/toggle_buttons.dart
View file @
a77388e6
...
...
@@ -910,12 +910,13 @@ class _ToggleButton extends StatelessWidget {
),
constraints:
currentConstraints
,
elevation:
0.0
,
highlightElevation:
0.0
,
fillColor:
currentFillColor
,
focusColor:
currentFocusColor
,
highlightColor:
highlightColor
??
theme
.
colorScheme
.
surface
.
withOpacity
(
0.0
),
focusElevation:
0
,
highlightColor:
highlightColor
??
theme
.
colorScheme
.
surface
.
withOpacity
(
0.0
),
highlightElevation:
0.0
,
hoverColor:
currentHoverColor
,
hoverElevation:
0
,
splashColor:
currentSplashColor
,
focusNode:
focusNode
,
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
...
...
packages/flutter/test/material/toggle_buttons_test.dart
View file @
a77388e6
...
...
@@ -1649,4 +1649,52 @@ void main() {
expect
(
RendererBinding
.
instance
!.
mouseTracker
.
debugDeviceActiveCursor
(
1
),
SystemMouseCursors
.
basic
);
});
testWidgets
(
'ToggleButtons focus, hover, and highlight elevations are 0'
,
(
WidgetTester
tester
)
async
{
final
List
<
FocusNode
>
focusNodes
=
<
FocusNode
>[
FocusNode
(),
FocusNode
()];
await
tester
.
pumpWidget
(
Material
(
child:
boilerplate
(
child:
ToggleButtons
(
isSelected:
const
<
bool
>[
true
,
false
],
onPressed:
(
int
index
)
{
},
focusNodes:
focusNodes
,
children:
const
<
Widget
>[
Text
(
'one'
),
Text
(
'two'
)],
),
),
),
);
double
toggleButtonElevation
(
String
text
)
{
return
tester
.
widget
<
Material
>(
find
.
widgetWithText
(
Material
,
text
).
first
).
elevation
;
}
// Default toggle button elevation
expect
(
toggleButtonElevation
(
'one'
),
0
);
// highlighted
expect
(
toggleButtonElevation
(
'two'
),
0
);
// not highlighted
// Hovered button elevation
final
TestGesture
hoverGesture
=
await
tester
.
createGesture
(
kind:
PointerDeviceKind
.
mouse
);
await
hoverGesture
.
addPointer
();
await
hoverGesture
.
moveTo
(
tester
.
getCenter
(
find
.
text
(
'one'
)));
await
tester
.
pumpAndSettle
();
expect
(
toggleButtonElevation
(
'one'
),
0
);
await
hoverGesture
.
moveTo
(
tester
.
getCenter
(
find
.
text
(
'two'
)));
await
tester
.
pumpAndSettle
();
expect
(
toggleButtonElevation
(
'two'
),
0
);
// Focused button elevation
focusNodes
[
0
].
requestFocus
();
await
tester
.
pumpAndSettle
();
expect
(
focusNodes
[
0
].
hasFocus
,
isTrue
);
expect
(
focusNodes
[
1
].
hasFocus
,
isFalse
);
expect
(
toggleButtonElevation
(
'one'
),
0
);
focusNodes
[
1
].
requestFocus
();
await
tester
.
pumpAndSettle
();
expect
(
focusNodes
[
0
].
hasFocus
,
isFalse
);
expect
(
focusNodes
[
1
].
hasFocus
,
isTrue
);
expect
(
toggleButtonElevation
(
'two'
),
0
);
await
hoverGesture
.
removePointer
();
});
}
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