Port Date Picker example to fn3

This commit is contained in:
Adam Barth
2015-09-24 14:46:29 -07:00
parent 878775bb89
commit cefbfa3bea
7 changed files with 28 additions and 22 deletions

View File

@@ -8,7 +8,7 @@ import 'package:sky/src/fn3/framework.dart';
abstract class ButtonState<T extends StatefulComponent> extends ComponentState<T> {
ButtonState(T config) : super(config);
bool highlight;
bool highlight = false;
void _handlePointerDown(_) {
setState(() {

View File

@@ -11,12 +11,14 @@ import 'package:sky/src/fn3/material.dart';
// Rather than using this class directly, please use FlatButton or RaisedButton.
abstract class MaterialButton extends StatefulComponent {
const MaterialButton({
MaterialButton({
Key key,
this.child,
this.enabled: true,
this.onPressed
}) : super(key: key);
}) : super(key: key) {
assert(enabled != null);
}
final Widget child;
final bool enabled;

View File

@@ -17,7 +17,9 @@ class RaisedButton extends MaterialButton {
}) : super(key: key,
child: child,
enabled: enabled,
onPressed: onPressed);
onPressed: onPressed) {
assert(enabled != null);
}
RaisedButtonState createState() => new RaisedButtonState(this);
}

View File

@@ -218,8 +218,9 @@ class ScaffoldElement extends RenderObjectElement<Scaffold> {
super.mount(parent, newSlot);
_children = new Map<ScaffoldSlots, Element>();
for (ScaffoldSlots slot in ScaffoldSlots.values) {
_children[slot] = widget._children[slot].createElement()
..mount(this, slot);
Element newChild = widget._children[slot]?.createElement();
_children[slot] = newChild;
newChild?.mount(this, slot);
}
}

View File

@@ -40,12 +40,7 @@ abstract class Scrollable extends StatefulComponent {
}
abstract class ScrollableState<T extends Scrollable> extends ComponentState<T> {
ScrollableState(T config) : super(config);
AnimatedSimulation _toEndAnimation; // See _startToEndAnimation()
ValueAnimation<double> _toOffsetAnimation; // Started by scrollTo()
void initState(BuildContext context) {
ScrollableState(T config) : super(config) {
if (config.initialScrollOffset is double)
_scrollOffset = config.initialScrollOffset;
_toEndAnimation = new AnimatedSimulation(_setScrollOffset);
@@ -56,6 +51,9 @@ abstract class ScrollableState<T extends Scrollable> extends ComponentState<T> {
});
}
AnimatedSimulation _toEndAnimation; // See _startToEndAnimation()
ValueAnimation<double> _toOffsetAnimation; // Started by scrollTo()
double _scrollOffset = 0.0;
double get scrollOffset => _scrollOffset;