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
bfa4bdbf
Unverified
Commit
bfa4bdbf
authored
Oct 07, 2021
by
Yash Johri
Committed by
GitHub
Oct 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SwitchListTile] Adds hoverColor to SwitchListTile (#91046)
parent
0a3ae081
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
0 deletions
+48
-0
switch_list_tile.dart
packages/flutter/lib/src/material/switch_list_tile.dart
+6
-0
switch_list_tile_test.dart
packages/flutter/test/material/switch_list_tile_test.dart
+42
-0
No files found.
packages/flutter/lib/src/material/switch_list_tile.dart
View file @
bfa4bdbf
...
...
@@ -146,6 +146,7 @@ class SwitchListTile extends StatelessWidget {
this
.
visualDensity
,
this
.
focusNode
,
this
.
enableFeedback
,
this
.
hoverColor
,
})
:
_switchListTileType
=
_SwitchListTileType
.
material
,
assert
(
value
!=
null
),
assert
(
isThreeLine
!=
null
),
...
...
@@ -191,6 +192,7 @@ class SwitchListTile extends StatelessWidget {
this
.
visualDensity
,
this
.
focusNode
,
this
.
enableFeedback
,
this
.
hoverColor
,
})
:
_switchListTileType
=
_SwitchListTileType
.
adaptive
,
assert
(
value
!=
null
),
assert
(
isThreeLine
!=
null
),
...
...
@@ -342,6 +344,9 @@ class SwitchListTile extends StatelessWidget {
/// * [Feedback] for providing platform-specific feedback to certain actions.
final
bool
?
enableFeedback
;
/// The color for the tile's [Material] when a pointer is hovering over it.
final
Color
?
hoverColor
;
@override
Widget
build
(
BuildContext
context
)
{
final
Widget
control
;
...
...
@@ -410,6 +415,7 @@ class SwitchListTile extends StatelessWidget {
visualDensity:
visualDensity
,
focusNode:
focusNode
,
enableFeedback:
enableFeedback
,
hoverColor:
hoverColor
,
),
),
);
...
...
packages/flutter/test/material/switch_list_tile_test.dart
View file @
bfa4bdbf
...
...
@@ -4,6 +4,7 @@
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
@@ -519,4 +520,45 @@ void main() {
expect
(
feedback
.
hapticCount
,
0
);
});
});
testWidgets
(
'SwitchListTile respects hoverColor'
,
(
WidgetTester
tester
)
async
{
const
Key
key
=
Key
(
'test'
);
await
tester
.
pumpWidget
(
wrap
(
child:
Center
(
child:
StatefulBuilder
(
builder:
(
BuildContext
context
,
StateSetter
setState
)
{
return
Container
(
width:
100
,
height:
100
,
color:
Colors
.
white
,
child:
SwitchListTile
(
value:
false
,
key:
key
,
hoverColor:
Colors
.
orange
[
500
],
title:
const
Text
(
'A'
),
onChanged:
(
bool
?
value
)
{},
),
);
}),
),
),
);
// Start hovering
final
TestGesture
gesture
=
await
tester
.
createGesture
(
kind:
PointerDeviceKind
.
mouse
);
addTearDown
(
gesture
.
removePointer
);
await
gesture
.
moveTo
(
tester
.
getCenter
(
find
.
byKey
(
key
)));
await
tester
.
pump
();
await
tester
.
pumpAndSettle
();
expect
(
Material
.
of
(
tester
.
element
(
find
.
byKey
(
key
))),
paints
..
rect
(
color:
Colors
.
orange
[
500
],
rect:
const
Rect
.
fromLTRB
(
350.0
,
250.0
,
450.0
,
350.0
),
)
);
});
}
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