【问题标题】:Flutter Bottom Sheet Like Google Calendar像谷歌日历一样颤动底页
【发布时间】:2020-11-23 06:50:39
【问题描述】:

我如何像谷歌日历一样创建底页? (下图), 我无法制作像图片中那样突出的个人资料照片。 谁能帮我, 谢谢你。。

【问题讨论】:

    标签: flutter


    【解决方案1】:

    可以通过使用堆栈小部件来实现

    class MyHomePage extends StatefulWidget {
      MyHomePage({Key key, this.title}) : super(key: key);
      final String title;
    
      @override
      _MyHomePageState createState() => _MyHomePageState();
    }
    
    class _MyHomePageState extends State<MyHomePage> {
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          body: Center(
            child: RaisedButton(
              onPressed: () {
                _settingModalBottomSheet();
              },
              child: Text('Show Bottom Sheet'),
            ),
          ),
        );
      }
    
      void _settingModalBottomSheet() {
        final double imageRadius = 50;
        showModalBottomSheet(
          context: context,
          backgroundColor: Colors.transparent,
          builder: (BuildContext bc) {
            return Column(
              mainAxisSize: MainAxisSize.min,
              children: [
                Stack(
                  children: [
                    Container(
                      margin: EdgeInsets.only(top: imageRadius),
                      padding: EdgeInsets.only(top: imageRadius),
                      decoration: BoxDecoration(
                        borderRadius: BorderRadius.only(
                          topLeft: Radius.circular(16),
                          topRight: Radius.circular(16),
                        ),
                        color: Colors.white,
                      ),
                      child: Column(
                        children: [
                          Text('asdfsdf asdfasdf'),
                          Row(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: [
                              IconButton(
                                icon: Icon(Icons.message),
                                onPressed: () {},
                              ),
                              SizedBox(
                                width: 16,
                              ),
                              IconButton(
                                icon: Icon(Icons.message),
                                onPressed: () {},
                              ),
                              SizedBox(
                                width: 16,
                              ),
                              IconButton(
                                icon: Icon(Icons.message),
                                onPressed: () {},
                              )
                            ],
                          ),
                        ],
                      ),
                    ),
                    Align(
                      alignment: Alignment.topCenter,
                      child: CircleAvatar(
                        radius: imageRadius,
                      ),
                    ),
                  ],
                )
              ],
            );
          },
        );
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2015-06-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-03-22
      • 1970-01-01
      相关资源
      最近更新 更多