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
8d545e93
Unverified
Commit
8d545e93
authored
Oct 09, 2018
by
jslavitz
Committed by
GitHub
Oct 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add disabledThumbColor and other properties from Switch to SwitchListTile final (#22823)
* added missing properties
parent
d954ae68
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
0 deletions
+82
-0
switch_list_tile.dart
packages/flutter/lib/src/material/switch_list_tile.dart
+21
-0
switch_list_tile_test.dart
packages/flutter/test/material/switch_list_tile_test.dart
+61
-0
No files found.
packages/flutter/lib/src/material/switch_list_tile.dart
View file @
8d545e93
...
@@ -74,6 +74,9 @@ class SwitchListTile extends StatelessWidget {
...
@@ -74,6 +74,9 @@ class SwitchListTile extends StatelessWidget {
@required
this
.
value
,
@required
this
.
value
,
@required
this
.
onChanged
,
@required
this
.
onChanged
,
this
.
activeColor
,
this
.
activeColor
,
this
.
activeTrackColor
,
this
.
inactiveThumbColor
,
this
.
inactiveTrackColor
,
this
.
activeThumbImage
,
this
.
activeThumbImage
,
this
.
inactiveThumbImage
,
this
.
inactiveThumbImage
,
this
.
title
,
this
.
title
,
...
@@ -123,6 +126,21 @@ class SwitchListTile extends StatelessWidget {
...
@@ -123,6 +126,21 @@ class SwitchListTile extends StatelessWidget {
/// Defaults to accent color of the current [Theme].
/// Defaults to accent color of the current [Theme].
final
Color
activeColor
;
final
Color
activeColor
;
/// The color to use on the track when this switch is on.
///
/// Defaults to [ThemeData.toggleableActiveColor] with the opacity set at 50%.
final
Color
activeTrackColor
;
/// The color to use on the thumb when this switch is off.
///
/// Defaults to the colors described in the Material design specification.
final
Color
inactiveThumbColor
;
/// The color to use on the track when this switch is off.
///
/// Defaults to the colors described in the Material design specification.
final
Color
inactiveTrackColor
;
/// An image to use on the thumb of this switch when the switch is on.
/// An image to use on the thumb of this switch when the switch is on.
final
ImageProvider
activeThumbImage
;
final
ImageProvider
activeThumbImage
;
...
@@ -173,6 +191,9 @@ class SwitchListTile extends StatelessWidget {
...
@@ -173,6 +191,9 @@ class SwitchListTile extends StatelessWidget {
activeThumbImage:
activeThumbImage
,
activeThumbImage:
activeThumbImage
,
inactiveThumbImage:
inactiveThumbImage
,
inactiveThumbImage:
inactiveThumbImage
,
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
materialTapTargetSize:
MaterialTapTargetSize
.
shrinkWrap
,
activeTrackColor:
activeTrackColor
,
inactiveTrackColor:
inactiveTrackColor
,
inactiveThumbColor:
inactiveThumbColor
,
);
);
return
MergeSemantics
(
return
MergeSemantics
(
child:
ListTileTheme
.
merge
(
child:
ListTileTheme
.
merge
(
...
...
packages/flutter/test/material/switch_list_tile_test.dart
0 → 100644
View file @
8d545e93
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'../rendering/mock_canvas.dart'
;
void
main
(
)
{
testWidgets
(
'SwitchListTile has the right colors'
,
(
WidgetTester
tester
)
async
{
bool
value
=
false
;
await
tester
.
pumpWidget
(
MediaQuery
(
data:
const
MediaQueryData
(
padding:
EdgeInsets
.
all
(
8.0
)),
child:
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
StatefulBuilder
(
builder:
(
BuildContext
context
,
StateSetter
setState
)
{
return
Material
(
child:
SwitchListTile
(
value:
value
,
onChanged:
(
bool
newValue
)
{
setState
(()
{
value
=
newValue
;
});
},
activeColor:
Colors
.
red
[
500
],
activeTrackColor:
Colors
.
green
[
500
],
inactiveThumbColor:
Colors
.
yellow
[
500
],
inactiveTrackColor:
Colors
.
blue
[
500
],
),
);
},
),
),
),
);
expect
(
find
.
byType
(
Switch
),
paints
..
rrect
(
color:
Colors
.
blue
[
500
])
..
circle
(
color:
const
Color
(
0x33000000
))
..
circle
(
color:
const
Color
(
0x24000000
))
..
circle
(
color:
const
Color
(
0x1f000000
))
..
circle
(
color:
Colors
.
yellow
[
500
])
);
await
tester
.
tap
(
find
.
byType
(
Switch
));
await
tester
.
pumpAndSettle
();
expect
(
Material
.
of
(
tester
.
element
(
find
.
byType
(
Switch
))),
paints
..
rrect
(
color:
Colors
.
green
[
500
])
..
circle
(
color:
const
Color
(
0x33000000
))
..
circle
(
color:
const
Color
(
0x24000000
))
..
circle
(
color:
const
Color
(
0x1f000000
))
..
circle
(
color:
Colors
.
red
[
500
])
);
});
}
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