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

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

Issue 1235443002: Support for icon theming (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix analyzer warning 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/theme/theme_data.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/floating_action_button.dart
diff --git a/sky/sdk/lib/widgets/floating_action_button.dart b/sky/sdk/lib/widgets/floating_action_button.dart
index 6c9eb8660e7eea05092d9fe21bb58193e3609f47..3e7a021b0b0c05e21c95a83e8e7e2db73d8a3873 100644
--- a/sky/sdk/lib/widgets/floating_action_button.dart
+++ b/sky/sdk/lib/widgets/floating_action_button.dart
@@ -4,6 +4,7 @@
import 'basic.dart';
import 'button_base.dart';
+import 'icon.dart';
import 'ink_well.dart';
import 'material.dart';
import 'theme.dart';
@@ -17,21 +18,32 @@ class FloatingActionButton extends ButtonBase {
FloatingActionButton({
String key,
this.child,
+ this.backgroundColor,
this.onPressed
}) : super(key: key);
Widget child;
+ Color backgroundColor;
Function onPressed;
void syncFields(FloatingActionButton source) {
super.syncFields(source);
child = source.child;
+ backgroundColor = source.backgroundColor;
onPressed = source.onPressed;
}
Widget buildContent() {
+ IconThemeColor iconThemeColor = IconThemeColor.white;
+ Color materialColor = backgroundColor;
+ if (materialColor == null) {
+ ThemeData themeData = Theme.of(this);
+ materialColor = themeData.accentColor;
+ iconThemeColor = themeData.accentColorBrightness == ThemeBrightness.dark ? IconThemeColor.white : IconThemeColor.black;
+ }
+
return new Material(
- color: Theme.of(this).floatingActionButtonColor,
+ color: materialColor,
type: MaterialType.circle,
level: highlight ? 3 : 2,
child: new ClipOval(
@@ -43,7 +55,14 @@ class FloatingActionButton extends ButtonBase {
child: new Container(
width: _kSize,
height: _kSize,
- child: new InkWell(child: new Center(child: child))
+ child: new InkWell(
+ child: new Center(
+ child: new IconTheme(
+ data: new IconThemeData(color: iconThemeColor),
+ child: child
+ )
+ )
+ )
)
)
)
« no previous file with comments | « sky/sdk/lib/theme/theme_data.dart ('k') | sky/sdk/lib/widgets/icon.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698