Port Date Picker example to fn3
This commit is contained in:
@@ -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(() {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user