Commit 3c5df69a authored by Adam Barth's avatar Adam Barth

Implement a floating action button in fn

R=rafaelw@chromium.org

Review URL: https://codereview.chromium.org/975913002
parent de7f8a9c
part of widgets;
class FloatingActionButton extends StyleComponent {
static final Style _style = new Style('''
position: absolute;
display: flex;
justify-content: center;
align-items: center;
bottom: 16px;
right: 16px;
width: 56px;
height: 56px;
background-color: #F44336;
color: white;
border-radius: 28px;
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);'''
);
Style get style => _style;
FloatingActionButton({ Object key, Node content }) : super(key: key, content: content);
}
part of widgets;
abstract class StyleComponent extends Component {
Node content;
// Subclasses should implement this getter to provide their style information.
Style get style => null;
StyleComponent({ Object key, this.content }) : super(key: key);
Node render() {
return new Container(
style: style,
children: content == null ? [] : [content]
);
}
}
...@@ -4,7 +4,7 @@ class Toolbar extends Component { ...@@ -4,7 +4,7 @@ class Toolbar extends Component {
List<Node> children; List<Node> children;
static Style _style = new Style(''' static final Style _style = new Style('''
display: flex; display: flex;
align-items: center; align-items: center;
height: 84px; height: 84px;
......
...@@ -20,5 +20,7 @@ part 'menudivider.dart'; ...@@ -20,5 +20,7 @@ part 'menudivider.dart';
part 'menuitem.dart'; part 'menuitem.dart';
part 'radio.dart'; part 'radio.dart';
part 'toolbar.dart'; part 'toolbar.dart';
part 'floating_action_button.dart';
part 'style_component.dart';
typedef void ValueChanged(value); typedef void ValueChanged(value);
...@@ -92,10 +92,20 @@ class StocksApp extends App { ...@@ -92,10 +92,20 @@ class StocksApp extends App {
] ]
); );
var fab = new FloatingActionButton(content: new Icon(
type: 'content/add_white', size: 24));
return new Container( return new Container(
key: 'StocksApp', key: 'StocksApp',
children: [
new Container(
key: 'Content',
style: _style, style: _style,
children: [drawer, toolbar, new Stocklist(stocks: oracle.stocks)] children: [toolbar, new Stocklist(stocks: oracle.stocks)]
),
fab,
drawer,
]
); );
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment