flutter corner radius with transparent background

后端 未结 11 1043
鱼传尺愫
鱼传尺愫 2021-01-30 15:28

Below is my code which I expect to render a round-corner container with a transparent background.

return new Container(
                //padding: const EdgeIn         


        
11条回答
  •  长情又很酷
    2021-01-30 16:11

    /// Create the bottom sheet UI
      Widget bottomSheetBuilder(){
        return Container(
          color: Color(0xFF737373), // This line set the transparent background
          child: Container(
            decoration: BoxDecoration(
              color: Colors.white,
                borderRadius: BorderRadius.only(
                    topLeft: Radius.circular(16.0),
                    topRight: Radius.circular( 16.0)
                )
            ),
            child: Center( child: Text("Hi everyone!"),)
          ),
        );
      }
    

    Call this to show the BotoomSheet with corners:

    /// Show the bottomSheet when called
      Future _onMenuPressed() async {
        showModalBottomSheet(
            context: context,
            builder: (widgetBuilder) => bottomSheetBuilder()
        );
      }
    

提交回复
热议问题