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

Unified Diff: sky/sdk/lib/widgets/material_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/flat_button.dart ('k') | sky/sdk/lib/widgets/raised_button.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/sdk/lib/widgets/material_button.dart
diff --git a/sky/sdk/lib/widgets/raised_button.dart b/sky/sdk/lib/widgets/material_button.dart
similarity index 54%
copy from sky/sdk/lib/widgets/raised_button.dart
copy to sky/sdk/lib/widgets/material_button.dart
index b3a742a3488afbc748a620870c71f8a8638156f9..4bd7b5a622816ddeeaf6e5fa8134a978f5397ed2 100644
--- a/sky/sdk/lib/widgets/raised_button.dart
+++ b/sky/sdk/lib/widgets/material_button.dart
@@ -2,71 +2,50 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-import '../theme2/colors.dart';
-import '../theme2/edges.dart';
import 'basic.dart';
import 'button_base.dart';
import 'ink_well.dart';
import 'material.dart';
-enum RaisedButtonTheme { light, dark }
+// Rather than using this class directly, please use FlatButton or RaisedButton.
+abstract class MaterialButton extends ButtonBase {
-class RaisedButton extends ButtonBase {
-
- RaisedButton({
+ MaterialButton({
String key,
this.child,
this.enabled: true,
- this.onPressed,
- this.theme: RaisedButtonTheme.light
+ this.onPressed
}) : super(key: key);
Widget child;
bool enabled;
Function onPressed;
- RaisedButtonTheme theme;
- void syncFields(RaisedButton source) {
+ void syncFields(MaterialButton source) {
child = source.child;
enabled = source.enabled;
onPressed = source.onPressed;
- theme = source.theme;
super.syncFields(source);
}
+ Color get color;
+ int get level;
+
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;
- if (enabled) {
- switch (theme) {
- case RaisedButtonTheme.light:
- if (highlight)
- color = Grey[350];
- else
- color = Grey[300];
- break;
- case RaisedButtonTheme.dark:
- if (highlight)
- color = Blue[700];
- else
- color = Blue[600];
- break;
- }
- } else {
- color = Grey[350];
- }
return new EventListenerNode(
new Container(
height: 36.0,
- constraints: new BoxConstraints(minWidth: 88.0),
- margin: new EdgeDims.all(4.0),
+ constraints: new BoxConstraints(minWidth: 88.0,
+ minHeight: 36.0,
+ maxHeight: 36.0),
+ margin: new EdgeDims.all(8.0),
child: new Material(
- edge: MaterialEdge.card,
child: enabled ? new InkWell(child: contents) : contents,
- level: enabled ? (highlight ? 2 : 1) : 0,
+ level: level,
color: color
)
),
« no previous file with comments | « sky/sdk/lib/widgets/flat_button.dart ('k') | sky/sdk/lib/widgets/raised_button.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698