相关疑难解决方法(0)

如何在Flutter中调整BottomSheet的高度和borderRadius?

我可能在这里遗漏了一些明显的东西,但是我的BottomSheet只占据了屏幕的下半部分,即使其中的小部件占用更多空间.所以现在BottomSheet中有滚动行为.我希望能够增加BottomSheet,以便用户不必滚动太多.

我还想在我的BottomSheet的顶部添加一个borderRadius,这样它看起来更像"模态"-y或"tab".

码:

void _showBottomSheet(BuildContext context) {
    showModalBottomSheet<Null>(
      context: context,
      builder: (BuildContext context) {
        return _bottomSheetScreen; // defined earlier on
      },
    );
}
Run Code Online (Sandbox Code Playgroud)

我试过了:

showModalBottomSheet<Null>(
  context: context,
  builder: (BuildContext context) {
    return Container(
      decoration: BoxDecoration(
        borderRadius: _borderRadius,
      ),
      height: 1000.0,
      child: _bottomSheetScreen,
    );
  },
);
Run Code Online (Sandbox Code Playgroud)

但似乎只会影响BottomSheet中的内容,并且不会自定义BottomSheet本身.

material-design flutter bottom-sheet

7
推荐指数
10
解决办法
7484
查看次数

很难在颤振中实现圆边模态底部片材

大家好,我正在尝试在 flutter 中实现圆角 modalbottomsheet,这是我的代码

void _showModalSheet(){
    showModalBottomSheet(
        context: context,
        builder: (context){
          return  ClipRRect(
            borderRadius: BorderRadius.only(topLeft: Radius.circular(20.0), topRight:Radius.circular(20.0))

            ,child: Container(
              height: 350.0,
              padding: EdgeInsets.all(10.0),

              decoration: BoxDecoration(
                color: Color(0xFF01579B),

              ),

              child : new Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: <Widget>[
                  new SizedBox(height: 20.0,),
                  new Row(
                    mainAxisAlignment: MainAxisAlignment.spaceAround,
                    children: <Widget>[
                      GestureDetector(
                        child: new Container(
                          height: 80.0,
                          width: 100.0,

                          child: new Column(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: <Widget>[
                              new Icon(Icons.directions_car, size: 30.0,color: Colors.white,),
                              new SizedBox(height: 10.0),
                              new Text('Emergency', style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),)
                            ],
                          ),
                          decoration: BoxDecoration(
                            borderRadius: …
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-layout

1
推荐指数
1
解决办法
3526
查看次数