如何向小部件添加深色效果

问题描述 投票:-1回答:1

如何为此小部件添加阴影效果这是我的代码结果enter image description here这就是我所需要的enter image description here

flutter flutter-layout
1个回答
0
投票
@override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("First Page"),
      ),
      body: Center(
        child: Container(
        width:MediaQuery.of(context).size.width-50,
        height:300,
          child:Column(
          mainAxisSize:MainAxisSize.min,
            children:[
              Stack(
                children: [
                  Container(
                height:180,
                    width:double.infinity,
                color:Colors.grey,
             child:Text('Video Thumbnail')
                ),
                Positioned(
                top:80,
                left:(MediaQuery.of(context).size.width-50)/2,
                child:Icon(Icons.play_arrow)
                )],
              ),
              ListTile(
              title:Text('Video Title'),
              subtitle:Text('Description goes here'),
              trailing:IconButton(
              icon:Icon(Icons.share),
              onPressed:(){
               //TODO
              })
              )
            ]
          )
        )
      ),
    );
  }

Screenshot

© www.soinside.com 2019 - 2024. All rights reserved.