Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Unified Diff: sky/sdk/lib/widgets/drawer_item.dart

Issue 1236043004: Improve drawer performance (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: cache paint Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/sdk/lib/widgets/basic.dart ('k') | sky/sdk/lib/widgets/icon.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/widgets/drawer_item.dart
diff --git a/sky/sdk/lib/widgets/drawer_item.dart b/sky/sdk/lib/widgets/drawer_item.dart
index 8b517116775bba6ee286356c0d5aece167bcb2e9..d807bd89c72da7d57feb6138a5c16b7babd6231d 100644
--- a/sky/sdk/lib/widgets/drawer_item.dart
+++ b/sky/sdk/lib/widgets/drawer_item.dart
@@ -46,26 +46,24 @@ class DrawerItem extends ButtonBase {
return colors.transparent;
}
+ sky.ColorFilter _getColorFilter(ThemeData themeData) {
+ if (selected)
+ return new sky.ColorFilter.mode(themeData.primaryColor, sky.TransferMode.srcATop);
+ return new sky.ColorFilter.mode(const Color(0x73000000), sky.TransferMode.dstIn);
+ }
+
Widget buildContent() {
ThemeData themeData = Theme.of(this);
List<Widget> flexChildren = new List<Widget>();
if (icon != null) {
- Widget child = new Icon(type: icon, size: 24);
- if (selected) {
- child = new ColorFilter(
- color: themeData.primaryColor,
- transferMode: sky.TransferMode.srcATop,
- child: child
- );
- }
flexChildren.add(
- new Opacity(
- opacity: selected ? 1.0 : 0.45,
- child: new Padding(
- padding: const EdgeDims.symmetric(horizontal: 16.0),
- child: child
- )
+ new Padding(
+ padding: const EdgeDims.symmetric(horizontal: 16.0),
+ child: new Icon(
+ type: icon,
+ size: 24,
+ colorFilter: _getColorFilter(themeData))
)
);
}
« no previous file with comments | « sky/sdk/lib/widgets/basic.dart ('k') | sky/sdk/lib/widgets/icon.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698