浏览代码

bottomsheet fix

/main
xingwei.zhu 6 年前
当前提交
06f4ef1d
共有 2 个文件被更改,包括 53 次插入19 次删除
  1. 19
      Runtime/material/scaffold.cs
  2. 53
      Samples/UIWidgetSample/MaterialSample.cs

19
Runtime/material/scaffold.cs


this._snackBarController = SnackBar.createAnimationController(vsync: this);
this._snackBarController.addStatusListener(this._handleSnackBarStatusChange);
}
if (this._snackBars.isEmpty()) {
D.assert(this._snackBarController.isDismissed);
this._snackBarController.forward();

this._currentBottomSheet = this._buildBottomSheet<object>(
(BuildContext context) => this.widget.bottomSheet,
controller,
false);
false,
null);
}
}

PersistentBottomSheetController<T> _buildBottomSheet<T>(WidgetBuilder builder, AnimationController controller,
bool isLocalHistoryEntry) {
bool isLocalHistoryEntry, T resolveValue) {
Promise<T> completer = new Promise<T>();
GlobalKey<_PersistentBottomSheetState> bottomSheetKey = GlobalKey<_PersistentBottomSheetState>.key();
_PersistentBottomSheet bottomSheet = null;

}
this.setState(() => { this._currentBottomSheet = null; });
completer.Done();
completer.Resolve(resolveValue);
}
LocalHistoryEntry entry = isLocalHistoryEntry

isLocalHistoryEntry);
}
PersistentBottomSheetController<object> showBottomSheet(WidgetBuilder builder) {
public PersistentBottomSheetController<object> showBottomSheet(WidgetBuilder builder) {
this._currentBottomSheet = this._buildBottomSheet<object>(builder, controller, true);
this._currentBottomSheet = this._buildBottomSheet<object>(builder, controller, true, null);
});
return this._currentBottomSheet;
}

public readonly Promise<U> _completer;
IPromise<U> closed {
public IPromise<U> closed {
get { return this._completer; }
}

}
class _PersistentBottomSheet : StatefulWidget {
public class _PersistentBottomSheet : StatefulWidget {
public _PersistentBottomSheet(
Key key = null,
AnimationController animationController = null,

}
class PersistentBottomSheetController<T> : ScaffoldFeatureController<_PersistentBottomSheet, T> {
public class PersistentBottomSheetController<T> : ScaffoldFeatureController<_PersistentBottomSheet, T> {
public PersistentBottomSheetController(
_PersistentBottomSheet widget,
Promise<T> completer,

53
Samples/UIWidgetSample/MaterialSample.cs


class MaterialAppBarWidgetState : State<MaterialAppBarWidget> {
Choice _selectedChoice = Choice.choices[0];
GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>.key();
VoidCallback _showBottomSheetCallback;
public override void initState() {
base.initState();
this._showBottomSheetCallback = this._showBottomSheet;
}
void _showBottomSheet() {
this.setState(() => { this._showBottomSheetCallback = null; });
this._scaffoldKey.currentState.showBottomSheet((BuildContext subContext) => {
ThemeData themeData = Theme.of(subContext);
return new Container(
decoration: new BoxDecoration(
border: new Border(
top: new BorderSide(
color: themeData.disabledColor))),
child: new Padding(
padding: EdgeInsets.all(8.0f),
child: new Text("Alert Bottom Sheet",
textAlign: TextAlign.center,
style: new TextStyle(
color: themeData.accentColor,
fontSize: 24.0f))
)
);
}).closed.Then((object obj) => {
if (this.mounted) {
this.setState(() => { this._showBottomSheetCallback = this._showBottomSheet; });
}
return null;
});
}
void _select(Choice choice) {
this.setState(() => { this._selectedChoice = choice; });
}

key: this._scaffoldKey,
appBar: new AppBar(
title: new Text("Basic AppBar"),
actions: new List<Widget> {

padding: EdgeInsets.all(16.0f),
child: new ChoiceCard(choice: this._selectedChoice)
),
floatingActionButton: new Builder(
builder: (BuildContext subContext) => {
return new FloatingActionButton(
child: new Icon(Unity.UIWidgets.material.Icons.add_alert),
onPressed: () => {
Scaffold.of(subContext).showSnackBar(new SnackBar(
content: new Text("Float Alerting !")));
});
}),
floatingActionButton: new FloatingActionButton(
backgroundColor: Colors.redAccent,
child: new Icon(Unity.UIWidgets.material.Icons.add_alert),
onPressed: this._showBottomSheetCallback
),
drawer: new Drawer(
child: new ListView(
padding: EdgeInsets.zero,

}
)
)
);
}
}

正在加载...
取消
保存