diff --git a/examples/material_gallery/lib/demo/two_level_list_demo.dart b/examples/material_gallery/lib/demo/two_level_list_demo.dart index 7799592d85d..d6f21f75cc2 100644 --- a/examples/material_gallery/lib/demo/two_level_list_demo.dart +++ b/examples/material_gallery/lib/demo/two_level_list_demo.dart @@ -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: [ - new TwoLevelListItem(title: new Text('Top')), - new TwoLevelSublist( - title: new Text('Sublist'), - children: [ - 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: [ + new TwoLevelListItem(title: new Text('Top')), + new TwoLevelSublist( + title: new Text('Sublist'), + children: [ + 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')) + ] ) ); } diff --git a/packages/flutter/lib/src/gestures/arena.dart b/packages/flutter/lib/src/gestures/arena.dart index 9392e5c69fe..914ae1bae26 100644 --- a/packages/flutter/lib/src/gestures/arena.dart +++ b/packages/flutter/lib/src/gestures/arena.dart @@ -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 it its favour at + /// participants, and if there is one, we resolve the arena in its favor at /// that time. GestureArenaMember eagerWinner; diff --git a/packages/flutter/lib/src/material/list.dart b/packages/flutter/lib/src/material/list.dart index 00be870b1fc..8212cd243af 100644 --- a/packages/flutter/lib/src/material/list.dart +++ b/packages/flutter/lib/src/material/list.dart @@ -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 { - ScrollbarPainter _scrollbarPainter = new ScrollbarPainter(); + ScrollbarPainter _scrollbarPainter; + + @override + void initState() { + super.initState(); + _scrollbarPainter = new ScrollbarPainter( + getThumbColor: () => Theme.of(context).highlightColor + ); + } @override Widget build(BuildContext context) { diff --git a/packages/flutter/lib/src/material/scrollbar_painter.dart b/packages/flutter/lib/src/material/scrollbar_painter.dart index 5098a62d03c..f6bd5836694 100644 --- a/packages/flutter/lib/src/material/scrollbar_painter.dart +++ b/packages/flutter/lib/src/material/scrollbar_painter.dart @@ -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); }