mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
To accomplish this, I made the following changes:
1) Material is now in charge of drawing the material shadows.
2) In order to mix in the style for the shadow, Element now takes a list of
Styles instead of a single style.
3) Update all clients of Element#style to understand that we now have a list.
4) Update components that drawer shadows to have Material do that work instead.
a) One exception: FloatingActionButton draws its own shadow because of its
crazy clip requirements. We'll probably want to find a better way for
FloatingActionButton to clip in the future.
I've also added a widgets-fn example to demo the fn material widgets.
This CL introduces a bug into Drawer whereby you can get ink splashes
everywhere in the drawer. In the future, we'll need to separate out the
different material aspects to get non-splashable materials.
R=rafaelw@chromium.org
Review URL: https://codereview.chromium.org/1003553002
36 lines
797 B
Dart
36 lines
797 B
Dart
// Copyright 2015 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import '../fn.dart';
|
|
import '../theme/shadows.dart';
|
|
import 'material.dart';
|
|
|
|
class Button extends Component {
|
|
static final Style _style = new Style('''
|
|
display: inline-flex;
|
|
transform: translateX(0);
|
|
-webkit-user-select: none;
|
|
justify-content: center;
|
|
align-items: center;
|
|
height: 36px;
|
|
min-width: 64px;
|
|
padding: 0 8px;
|
|
margin: 4px;
|
|
border-radius: 2px;'''
|
|
);
|
|
|
|
Node content;
|
|
int level;
|
|
|
|
Button({ Object key, this.content, this.level }) : super(key: key);
|
|
|
|
Node build() {
|
|
return new Material(
|
|
styles: [_style],
|
|
children: [content],
|
|
level: level
|
|
);
|
|
}
|
|
}
|