我想创建一个带有圆角的持久BottomSheet,但是无法实现想要的效果。我已经尝试了链接中提供的代码 "How to create a modal bottomsheet with circular corners in Flutter?" 但它实现的是模态底部面板。
我已经尝试了持久性底部面板,但没有成功。请帮忙告诉我如何做到这一点。
下面的代码可以工作并显示底部面板,但是边角没有变成圆角。
我已经尝试了持久性底部面板,但没有成功。请帮忙告诉我如何做到这一点。
下面的代码可以工作并显示底部面板,但是边角没有变成圆角。
void _showBottomSheet() {
_scaffoldKey.currentState.showBottomSheet<void>((BuildContext context) {
final ThemeData themeData = Theme.of(context);
return new Container(
padding: const EdgeInsets.all(0),
width: double.infinity,
color: Colors.transparent,
decoration: BoxDecoration(
borderRadius: new BorderRadius.only(
bottomLeft: const Radius.circular(10.0),
bottomRight: const Radius.circular(10.0)),
),
child: new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
BottomNavigationBar(
currentIndex: 0, // this will be set when a new tab is tapped
items: [
BottomNavigationBarItem(
icon: new Icon(Icons.share),
title: new Text('Share'),
),
BottomNavigationBarItem(
icon: Icon(Icons.bookmark),
title: Text('Bookmark')
)
],
onTap: (index)
{
if(index ==0)
{
final RenderBox box = context.findRenderObject();
Share.share('Hello this is a test',
sharePositionOrigin:
box.localToGlobal(Offset.zero) & box.size);
}
},
),
])
);
})
.closed.whenComplete(() {
if (mounted) {
setState(() { // re-enable the button
_showBottomSheetCallback = _showBottomSheet;
print ("_showBottomSheetCallback enable");
});
}
});
}