Flutter 如何在颤振中创建具有圆形拐角的持久底板?

Flutter 如何在颤振中创建具有圆形拐角的持久底板?,flutter,flutter-layout,Flutter,Flutter Layout,我想创建一个具有圆角的持久性底部表单,但无法实现结果。我已经尝试了代码放弃链接“”,但它实现了模式表 我已经试过了,但是运气不好。请帮助我怎么做 下面的代码可以工作并显示一个底图,但是这些角并不是圆的 void _showBottomSheet() { _scaffoldKey.currentState.showBottomSheet<void>((BuildContext context) { final ThemeData themeData = Theme.

我想创建一个具有圆角的持久性底部表单,但无法实现结果。我已经尝试了代码放弃链接“”,但它实现了模式表

我已经试过了,但是运气不好。请帮助我怎么做

下面的代码可以工作并显示一个底图,但是这些角并不是圆的

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");
        });
      }

    });
  }
void\u showBottomSheet(){
_scaffoldKey.currentState.showBottomSheet((构建上下文){
最终主题数据主题数据=Theme.of(上下文);
退回新货柜(
填充:常量边集。全部(0),
宽度:double.infinity,
颜色:颜色。透明,
装饰:盒子装饰(
borderRadius:仅限新的borderRadius(
左下角:常数半径。圆形(10.0),
右下角:常数半径。圆形(10.0)),
),
子:新列(
mainAxisSize:mainAxisSize.min,
儿童:[
底部导航栏(
currentIndex:0,//点击新选项卡时将设置此项
项目:[
底部导航气压计(
图标:新图标(Icons.share),
标题:新文本(“共享”),
),
底部导航气压计(
图标:图标(图标.书签),
标题:文本(“书签”)
)
],
onTap:(索引)
{
如果(索引==0)
{
final RenderBox=context.findenderObject();
Share.Share('您好,这是一个测试',
共享位置来源:
localToGlobal(Offset.zero)和box.size);
}
},
),
])
);
})
.关闭。完成时(){
如果(已安装){
设置状态((){//重新启用按钮
_showBottomSheet回调=_showBottomSheet;
打印(“_showBottomSheetCallbackenable”);
});
}
});
}

您可以使用-
ClipRRect
小部件

void _showBottomSheet() {
    _scaffoldKey.currentState
        .showBottomSheet<void>((BuildContext context) {
          final ThemeData themeData = Theme.of(context);
          return Theme(
            data: themeData.copyWith(canvasColor: Colors.orangeAccent,),
            child: DecoratedBox(
              decoration: BoxDecoration(color: Colors.transparent),
              child: ClipRRect(
                borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(22.0),
                    topRight: Radius.circular(22.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");
//        });
          }
        });
  }
void\u showBottomSheet(){
_scaffoldKey.currentState
.showBottomSheet((构建上下文){
最终主题数据主题数据=Theme.of(上下文);
返回主题(
数据:themeData.copyWith(画布颜色:Colors.orangeAccent,),
孩子:装饰盒(
装饰:盒子装饰(颜色:彩色。透明),
孩子:ClipRRect(
borderRadius:仅限borderRadius(
左上:半径。圆形(22.0),
右上角:半径。圆形(22.0)),
儿童:
新列(mainAxisSize:mainAxisSize.min,子项:[
底部导航栏(
currentIndex:0,//点击新选项卡时将设置此项
项目:[
底部导航气压计(
图标:新图标(Icons.share),
标题:新文本(“共享”),
),
底部导航气压计(
图标:图标(图标.书签),
标题:文本(“书签”)
],
onTap:(索引){
如果(索引==0){
final RenderBox=context.findenderObject();
//Share.Share('您好,这是一个测试',
//共享位置来源:
//localToGlobal(Offset.zero)和box.size);
}
},
),
]),
),
),
);
})
关闭
.完成时(){
如果(已安装){
//设置状态((){//重新启用按钮
//\u showBottomSheet回调=\u showBottomSheet;
//打印(“_showBottomSheetCallbackenable”);
//        });
}
});
}
输出:


您能用您尝试过的代码更新您的问题吗?结果如何?是的,我已经更新了密码。但它不在拐角处。您是否试图使左下角和右下角变圆?或者你是说左上和右上?