问题是在对话框中增加对话框的宽度

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

trying to replicate the image contents seen here

我似乎无法在每个卡列表视图的末尾输入图标的尾行。有没有办法使用相同的卡代码解决此问题,还是应该使用另一种方法?

                  showDialog(
                            context: context,
                            builder: (BuildContext context) {
                              return AlertDialog(

我减少了填充量,以增加警报对话框区域内的可用空间。

                                contentPadding: EdgeInsets.all(5.0),
                                shape: RoundedRectangleBorder(
                                  borderRadius: BorderRadius.all(
                                    Radius.circular(10.0),
                                  ),
                                ),
                                content: Stack(
                                  overflow: Overflow.visible,
                                  children: <Widget>[
                                    Positioned(
                                      right: -40.0,
                                      top: -40.0,
//                                      width: 600.0,
                                      child: InkResponse(
                                        onTap: () {
                                          Navigator.of(context).pop();
                                        },
                                        child: CircleAvatar(
                                          child: Icon(
                                            Icons.close,
                                            color: Colors.white,
                                          ),
                                          backgroundColor: Colors.red,
                                          maxRadius: 20.0,
                                        ),
                                      ),
                                    ),
                                    Form(
                                      key: _formKey,
                                      child: Column(
                                        mainAxisSize: MainAxisSize.min,
                                        children: <Widget>[
                                          Text(
                                            'Choose a Submission Type',
                                            style: TextStyle(
                                                fontFamily: 'OpenSans',
                                                fontSize: 18.0),
                                          ),
                                          Divider(
                                            height: 10.0,
                                          ),
                                          Text(
                                            'This campaign is available to creators with 3000 or more followers.',
                                            textAlign: TextAlign.center,
                                            style: TextStyle(
                                              fontFamily: 'OpenSans',
                                              fontSize: 14.0,
                                            ),
                                          ),
                                          Card(
                                            margin: EdgeInsets.zero,
                                            child: Column(
                                              mainAxisSize: MainAxisSize.min,
                                              children: <Widget>[
                                                ListTile(
                                                  leading:
                                                      const Icon(Icons.image),
                                                  title: Text(
                                                    'Post',
                                                    style: TextStyle(
                                                      fontFamily: 'OpenSans',
                                                      fontSize: 16.0,
                                                      fontWeight:
                                                          FontWeight.bold,
                                                    ),
                                                  ),
                                                  subtitle: Text(
                                                    'Single media file',
                                                    style: TextStyle(
                                                      fontFamily: 'OpenSans',
                                                      fontSize: 14.0,
                                                    ),
                                                  ),

这是目前我的代码所在的地方。我无法编辑代码以包含两个其他图标。在这些区域中包含这些尾随图标的最佳解决方案是什么。

//                                                  trailing: Row(
//                                                    children: <Widget>[
//                                                      Icon(
//                                                        FontAwesomeIcons
//                                                            .instagram,
//                                                        size: 10.0,
//                                                      ),
////                                                      Icon(
////                                                        FontAwesomeIcons
////                                                            .facebook,
////                                                        size: 10.0,
////                                                      ),
//                                                    ],
//                                                  ),
                                                ),
                                              ],
                                            ),
                                          ),
flutter flutter-layout
1个回答
1
投票

您需要做的就是像这样将mainAxisSize: MainAxisSize.min,添加到Row

trailing: Row(
    mainAxisSize: MainAxisSize.min,
    children: <Widget>[
      Icon(
        FontAwesomeIcons.instagram,
        size: 10.0,
      ),
      SizedBox(
        width: 5, 
      ),
      Icon(
        FontAwesomeIcons.facebook,
        size: 10.0,
      ),
    ],
  ),

让我知道这是否是您想要的。我还添加了SizedBox,如果那不是您不希望将其取出的外观

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