【发布时间】:2020-04-14 20:10:03
【问题描述】:
我正在使用https://pub.dev/packages/sliding_up_panel,我想在现有面板上按下按钮后触发新面板的打开。
@override
Widget build(BuildContext context) {
BorderRadiusGeometry radius = BorderRadius.only(
topLeft: Radius.circular(24.0),
topRight: Radius.circular(24.0),
);
return Scaffold(
appBar: AppBar(
title: Text("SlidingUpPanelExample"),
),
body: SlidingUpPanel(
panel: Center(
child: RaisedButton(
child: Text('Show new panel'),
onPressed: () {
**///want to add code
here to trigger the callback of the new panel.**
},
),
),
collapsed: Container(
decoration: BoxDecoration(
color: Colors.blueGrey,
borderRadius: radius
),
child: Center(
child: Text(
"This is the collapsed Widget",
style: TextStyle(color: Colors.white),
),
),
),
body: Center(
child: Text("This is the Widget behind the sliding panel"),
),
borderRadius: radius,
),
);
}
此依赖项能够在控制器的帮助下调用 open() 方法,但我无法理解如何使用它调用新的向上滑动面板(并且显然关闭现有面板)。 这是 open() 操作的代码:
PanelController _pc = new PanelController();
...
RaisedButton(
child: Text("Open"),
onPressed: () => _pc.open(),
),
【问题讨论】:
标签: user-interface flutter dart