在下面的示例中,我在按下凸起按钮时打开了一个模态底部工作表在打开的工作表中,我有另一个图标可以打开另一个工作表,但我想在打开第二个底部后关闭第一个工作表床单。我怎样才能做到这一点?
import 'package:flutter/material.dart';
class SecondScreen extends StatefulWidget {
@override
_SecondScreenState createState() => _SecondScreenState();
}
class _SecondScreenState extends State<SecondScreen> {
@override
Widget build(BuildContext context) {
return Center(
child: Container(
child:RaisedButton(child: Text('Click'), onPressed: () => _openSheet()),
),
);
}
_openSheet() {
showModalBottomSheet(
context: context,
builder: (BuildContext context)
{
return Column(
children: <Widget>[
Container(
height: MediaQuery.of(context).size.height / 2,
width: MediaQuery.of(context).size.width,
child: IconButton(
icon: Icon(Icons.info),
iconSize: 50.0,
onPressed: () => _openSecondSheet(),
),
),
],
);
});
}
_openSecondSheet() {
showModalBottomSheet(
context: context,
builder: (BuildContext context) {
return Container(
height: MediaQuery.of(context).size.height / 3,
width: MediaQuery.of(context).size.width,
);
});
}
}