我是一个Flutter 的初学者,在测试了许多解决方案后,我被阻止了. 我想删除我的边界容器和他的子元素图像之间的空间.两者都有边界半径. 下面,我的代码片段结束了图像. 谢谢你的宝贵帮助.


    Container(
                    height: 100,
                    width: double.infinity * screenWidthRatio,
                    margin: const EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 20.0),
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(20),
                      border: Border.all(color: blueColor, width: 3),
                      gradient: const LinearGradient(
                        begin: Alignment.centerRight,
                        end: Alignment.centerLeft,
                        colors: [
                          Colors.black,
                          Colors.black87,
                          Colors.black54,
                          Colors.transparent,
                        ],
                      ),
                    ),
                    child: Row(
                      children: [
                        ClipRRect(
                          borderRadius: const BorderRadius.only(
                              topLeft: Radius.circular(20),
                              bottomLeft: Radius.circular(20)),
                          child: Image.network(
                            'https://img.lemde.fr/2022/02/06/0/0/0/0/580/0/75/0/a8d87fe_5475999-01-06.jpg',
                          ),
                        ),
                        // Future column
                      ],
                    ),
                  )

下面是这个例子

推荐答案

正是因为Border.all(color: Colors.blue, width: 3),才推动了这一形象.在我的 idea 中,如果你使用Stack,你就可以达到你的 idea .

      Stack(
          children: [
            Container(
              height: 100,
              margin: const EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 20.0),
              child: Row(
                children: [
                  ClipRRect(
                    borderRadius: const BorderRadius.only(
                        topLeft: Radius.circular(20),
                        bottomLeft: Radius.circular(20)),
                    child: Image.network(
                      'https://img.lemde.fr/2022/02/06/0/0/0/0/580/0/75/0/a8d87fe_5475999-01-06.jpg',
                    ),
                  ),
                  // Future column
                ],
              ),
            ),
            Container(
            height: 100,
            margin: const EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 20.0),
            decoration: BoxDecoration(
              borderRadius: BorderRadius.circular(20),
              border: Border.all(color: Colors.blue, width: 3),
              gradient: const LinearGradient(
                begin: Alignment.centerRight,
                end: Alignment.centerLeft,
                colors: [
                  Colors.black,
                  Colors.black87,
                  Colors.black54,
                  Colors.transparent,
                ],
              ),
            ),
      ),
          ],
        )

enter image description here happy coding...

Flutter相关问答推荐

Flutter -如何从布局填充(对称水平)中排除小部件?

我如何才能收到每天重复的预定通知?

SupabaseFlutter 集成问题:无法更新行

如何在2024年使用Ffltter将用户数据保存在云FireStore中?

Flutter API请求BadState响应

如何正确处理Flutter 翼中使用火基时发生的碰撞?

将列表<;Events>;从Flutter 应用程序中的函数传回EventLoader属性时出错

上传的图像不能在FireBase中预览.S档案类型为空白,摆动

从图标启动器打开时,VSCode未检测到Web设备

未处理的异常:第1行第5列出现错误:无效的媒体类型:应为/&;.从API获取数据时在Flutter中

Flutter 中的 setState() 内部是如何工作的?

Select 文本时如何更改 Flutter 中的光标 colored颜色 ?

为什么我们需要使用ChangeNotifierProvider而不是仅仅使用ChangeNotifier?

在 Flutter 中,SpinEdit 叫什么?

面对Flutter 中的行和列问题

配置项目:firebase_core时出现问题

Flutter:制作自定义小部件的最佳做法是什么?

如何使用列Flutter 中文本占用的空间来控制svg宽度

在 flutter 中使用 StreamBuilder 在文本字段中键入时显示过滤记录

如何在 ElevatedButton 上设置背景 colored颜色 动画?