flutter corner radius with transparent background

后端 未结 11 1207
鱼传尺愫
鱼传尺愫 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:17

    It's an old question. But for those who come across this question...

    The white background behind the rounded corners is not actually the container. That is the canvas color of the app.

    TO FIX: Change the canvas color of your app to Colors.transparent

    Example:

    return new MaterialApp(
      title: 'My App',
      theme: new ThemeData(
        primarySwatch: Colors.green,
        canvasColor: Colors.transparent, //----Change to this------------
        accentColor: Colors.blue,
      ),
      home: new HomeScreen(),
    );
    

提交回复
热议问题