flutter corner radius with transparent background

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

    class MyApp2 extends StatelessWidget {
    
      @override
      Widget build(BuildContext context) { 
        return MaterialApp( 
          debugShowCheckedModeBanner: false,
          theme: ThemeData(
            appBarTheme: AppBarTheme(
              elevation: 0,
              color: Colors.blueAccent,
            )
          ),
          title: 'Welcome to flutter ',
          home: HomePage()
        );
      }
    }
    
    class HomePage extends StatefulWidget {
      @override
      _HomePageState createState() => _HomePageState();
    }
    
    class _HomePageState extends State {
    
      int number = 0;
      void _increment(){
       setState(() {
          number ++;
       });
      }
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
            backgroundColor: Colors.blueAccent,
            appBar: AppBar(
              title: Text('MyApp2'), 
              leading: Icon(Icons.menu),
              // backgroundColor: Colors.blueAccent,
    
              ),
            body: Container(
              decoration: BoxDecoration(
                borderRadius: BorderRadius.only(
                  topLeft: Radius.circular(200.0),
                  topRight: Radius.circular(200)
                ), 
                color: Colors.white,
              ),
            )
          );
      }
    }
    

提交回复
热议问题