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
cc72a8e5
Commit
cc72a8e5
authored
Mar 24, 2016
by
Hans Muller
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2884 from HansMuller/scrollbar_thumb
Scrollbar thumb color, etc
parents
51b6f0ea
d89ccc4a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
25 deletions
+35
-25
two_level_list_demo.dart
examples/material_gallery/lib/demo/two_level_list_demo.dart
+15
-18
arena.dart
packages/flutter/lib/src/gestures/arena.dart
+1
-1
list.dart
packages/flutter/lib/src/material/list.dart
+10
-1
scrollbar_painter.dart
packages/flutter/lib/src/material/scrollbar_painter.dart
+9
-5
No files found.
examples/material_gallery/lib/demo/two_level_list_demo.dart
View file @
cc72a8e5
...
...
@@ -9,24 +9,21 @@ class TwoLevelListDemo extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
appBar:
new
AppBar
(
title:
new
Text
(
'Expand/Collapse List Control'
)),
body:
new
Padding
(
padding:
const
EdgeInsets
.
all
(
0.0
),
child:
new
TwoLevelList
(
type:
MaterialListType
.
oneLine
,
items:
<
Widget
>[
new
TwoLevelListItem
(
title:
new
Text
(
'Top'
)),
new
TwoLevelSublist
(
title:
new
Text
(
'Sublist'
),
children:
<
Widget
>[
new
TwoLevelListItem
(
title:
new
Text
(
'One'
)),
new
TwoLevelListItem
(
title:
new
Text
(
'Two'
)),
new
TwoLevelListItem
(
title:
new
Text
(
'Free'
)),
new
TwoLevelListItem
(
title:
new
Text
(
'Four'
))
]
),
new
TwoLevelListItem
(
title:
new
Text
(
'Bottom'
))
]
)
body:
new
TwoLevelList
(
type:
MaterialListType
.
oneLine
,
items:
<
Widget
>[
new
TwoLevelListItem
(
title:
new
Text
(
'Top'
)),
new
TwoLevelSublist
(
title:
new
Text
(
'Sublist'
),
children:
<
Widget
>[
new
TwoLevelListItem
(
title:
new
Text
(
'One'
)),
new
TwoLevelListItem
(
title:
new
Text
(
'Two'
)),
new
TwoLevelListItem
(
title:
new
Text
(
'Free'
)),
new
TwoLevelListItem
(
title:
new
Text
(
'Four'
))
]
),
new
TwoLevelListItem
(
title:
new
Text
(
'Bottom'
))
]
)
);
}
...
...
packages/flutter/lib/src/gestures/arena.dart
View file @
cc72a8e5
...
...
@@ -54,7 +54,7 @@ class _GestureArena {
/// If a gesture attempts to win while the arena is still open, it becomes the
/// "eager winnner". We look for an eager winner when closing the arena to new
/// participants, and if there is one, we resolve the arena i
t its favou
r at
/// participants, and if there is one, we resolve the arena i
n its favo
r at
/// that time.
GestureArenaMember
eagerWinner
;
...
...
packages/flutter/lib/src/material/list.dart
View file @
cc72a8e5
...
...
@@ -6,6 +6,7 @@ import 'package:flutter/widgets.dart';
import
'constants.dart'
;
import
'scrollbar_painter.dart'
;
import
'theme.dart'
;
enum
MaterialListType
{
oneLine
,
...
...
@@ -44,7 +45,15 @@ class MaterialList extends StatefulWidget {
}
class
_MaterialListState
extends
State
<
MaterialList
>
{
ScrollbarPainter
_scrollbarPainter
=
new
ScrollbarPainter
();
ScrollbarPainter
_scrollbarPainter
;
@override
void
initState
()
{
super
.
initState
();
_scrollbarPainter
=
new
ScrollbarPainter
(
getThumbColor:
()
=>
Theme
.
of
(
context
).
highlightColor
);
}
@override
Widget
build
(
BuildContext
context
)
{
...
...
packages/flutter/lib/src/material/scrollbar_painter.dart
View file @
cc72a8e5
...
...
@@ -10,16 +10,20 @@ const double _kMinScrollbarThumbLength = 18.0;
const
double
_kScrollbarThumbGirth
=
6.0
;
const
Duration
_kScrollbarThumbFadeDuration
=
const
Duration
(
milliseconds:
300
);
typedef
Color
GetThumbColor
(
);
class
ScrollbarPainter
extends
ScrollableListPainter
{
ScrollbarPainter
({
GetThumbColor
getThumbColor
})
{
this
.
getThumbColor
=
getThumbColor
??
_defaultThumbColor
;
}
GetThumbColor
getThumbColor
;
double
_opacity
=
0.0
;
int
get
_alpha
=>
(
_opacity
*
0xFF
).
round
();
// TODO(hansmuller): thumb color should come from ThemeData.
Color
get
thumbColor
=>
const
Color
(
0xFF9E9E9E
);
Color
_defaultThumbColor
()
=>
const
Color
(
0xFF9E9E9E
);
void
paintThumb
(
PaintingContext
context
,
Rect
thumbBounds
)
{
final
Paint
paint
=
new
Paint
()..
color
=
thumbColor
.
withAlpha
(
_alpha
);
final
Paint
paint
=
new
Paint
()..
color
=
getThumbColor
().
withOpacity
(
_opacity
);
context
.
canvas
.
drawRect
(
thumbBounds
,
paint
);
}
...
...
@@ -54,7 +58,7 @@ class ScrollbarPainter extends ScrollableListPainter {
@override
void
paint
(
PaintingContext
context
,
Offset
offset
)
{
if
(
_
alpha
==
0
)
if
(
_
opacity
==
0.
0
)
return
;
paintScrollbar
(
context
,
offset
);
}
...
...
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