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

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

Issue 1187773008: Add FlatButton (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 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/material_button.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/widgets/raised_button.dart
diff --git a/sky/sdk/lib/widgets/raised_button.dart b/sky/sdk/lib/widgets/raised_button.dart
index b3a742a3488afbc748a620870c71f8a8638156f9..29b0e62af6be5acc465cb859f625e830e2707289 100644
--- a/sky/sdk/lib/widgets/raised_button.dart
+++ b/sky/sdk/lib/widgets/raised_button.dart
@@ -5,73 +5,47 @@
import '../theme2/colors.dart';
import '../theme2/edges.dart';
import 'basic.dart';
-import 'button_base.dart';
-import 'ink_well.dart';
-import 'material.dart';
+import 'material_button.dart';
enum RaisedButtonTheme { light, dark }
-class RaisedButton extends ButtonBase {
+class RaisedButton extends MaterialButton {
RaisedButton({
String key,
- this.child,
- this.enabled: true,
- this.onPressed,
+ Widget child,
+ bool enabled: true,
+ Function onPressed,
this.theme: RaisedButtonTheme.light
- }) : super(key: key);
+ }) : super(key: key, child: child, enabled: enabled, onPressed: onPressed);
- Widget child;
- bool enabled;
- Function onPressed;
RaisedButtonTheme theme;
void syncFields(RaisedButton source) {
- child = source.child;
- enabled = source.enabled;
- onPressed = source.onPressed;
theme = source.theme;
super.syncFields(source);
}
- Widget buildContent() {
- Widget contents = new Container(
- padding: new EdgeDims.symmetric(horizontal: 8.0),
- child: new Center(child: child) // TODO(ianh): figure out a way to compell the child to have gray text when disabled...
- );
- Color color;
+ Color get color {
if (enabled) {
switch (theme) {
case RaisedButtonTheme.light:
if (highlight)
- color = Grey[350];
+ return Grey[350];
else
- color = Grey[300];
+ return Grey[300];
break;
case RaisedButtonTheme.dark:
if (highlight)
- color = Blue[700];
+ return Blue[700];
else
- color = Blue[600];
+ return Blue[600];
break;
}
} else {
- color = Grey[350];
+ return Grey[350];
}
- return new EventListenerNode(
- new Container(
- height: 36.0,
- constraints: new BoxConstraints(minWidth: 88.0),
- margin: new EdgeDims.all(4.0),
- child: new Material(
- edge: MaterialEdge.card,
- child: enabled ? new InkWell(child: contents) : contents,
- level: enabled ? (highlight ? 2 : 1) : 0,
- color: color
- )
- ),
- onGestureTap: (_) { if (onPressed != null && enabled) onPressed(); }
- );
}
+ int get level => enabled ? (highlight ? 2 : 1) : 0;
}
« no previous file with comments | « sky/sdk/lib/widgets/material_button.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698