FutureBuilder(
                        future: getClaimDetail(""),
                        builder:
                            (BuildContext context, AsyncSnapshot snapshot) {
                          if (snapshot.data != null) {
                            return Container(
                              height: 150,
                              decoration: const BoxDecoration(
                                color: Colors.white,
                                borderRadius:
                                    BorderRadius.all(Radius.circular(15)),
                                boxShadow: null,
                              ),
                              padding: const EdgeInsets.all(20),
                              child: Column(
                                children: [
                                  Row(
                                    children: [
                                      Flexible(
                                        child: FractionallySizedBox(
                                          widthFactor: 1,
                                          child: Text(
                                            'Claim ID',
                                            style: TextStyle(
                                              fontSize: 12,
                                              fontWeight: FontWeight.w500,
                                              color: Color(AppColors.greyText),
                                            ),
                                          ),
                                        ),
                                      ),
                                      Flexible(
                                        child: FractionallySizedBox(
                                          widthFactor: 1,
                                          child: Text(
                                            'Contract No.',
                                            style: TextStyle(
                                              fontSize: 12,
                                              fontWeight: FontWeight.w500,
                                              color: Color(AppColors.greyText),
                                            ),
                                          ),
                                        ),
                                      ),
                                    ],
                                  ),
                                  Row(
                                    children: [
                                      Flexible(
                                        child: FractionallySizedBox(
                                          widthFactor: 1,
                                          child: Text(
                                            widget.claimNumber,
                                            style: const TextStyle(
                                              fontSize: 14,
                                              fontWeight: FontWeight.w600,
                                            ),
                                          ),
                                        ),
                                      ),
                                      const Flexible(
                                        child: FractionallySizedBox(
                                          widthFactor: 1,
                                          child: Text(
                                            'KP2207514735',
                                            style: TextStyle(
                                              fontSize: 14,
                                              fontWeight: FontWeight.w600,
                                            ),
                                          ),
                                        ),
                                      ),
                                    ],
                                  ),
                                  Divider(
                                    color: Color(AppColors.bgColor),
                                    height: 20,
                                    thickness: 1,
                                  ),
                                  Flexible(
                                      //fit: FlexFit.tight,
                                      child: Row(
                                    mainAxisSize: MainAxisSize.min,
                                    children: [
                                      Align(
                                        alignment: Alignment.centerLeft,
                                        child: Container(
                                          height: 59,
                                          width: 59,
                                          decoration: const BoxDecoration(
                                              borderRadius: BorderRadius.all(
                                                  Radius.circular(10)),
                                              image: DecorationImage(
                                                image: AssetImage(
                                                    "lib/Assets/Images/car.png"),
                                                fit: BoxFit.cover,
                                              )),
                                        ),
                                      ),
                                      Flexible(
                                        fit: FlexFit.tight,
                                        child: Column(
                                          mainAxisSize: MainAxisSize.max,
                                          children: [
                                            Row(
                                              children: [
                                                Flexible(
                                                  child: FractionallySizedBox(
                                                    widthFactor: 1,
                                                    child: Padding(
                                                      padding:
                                                          const EdgeInsets.only(
                                                              left: 10,
                                                              bottom: 5),
                                                      child: Text(
                                                        snapshot.data.make +
                                                            " " +
                                                            snapshot.data.model,
                                                        style: const TextStyle(
                                                          fontSize: 16,
                                                          fontWeight:
                                                              FontWeight.w700,
                                                        ),
                                                      ),
                                                    ),
                                                  ),
                                                ),
                                                Flexible(
                                                  child: Expanded(
                                                      child: Align(
                                                    alignment:
                                                        Alignment.centerRight,
                                                    child: Container(
                                                      margin:
                                                          const EdgeInsets.only(
                                                              bottom: 5),
                                                      decoration: BoxDecoration(
                                                          color: Color(AppColors
                                                              .bgColor),
                                                          borderRadius:
                                                              const BorderRadius
                                                                      .all(
                                                                  Radius
                                                                      .circular(
                                                                          5))),
                                                      padding:
                                                          const EdgeInsets.all(
                                                              3),
                                                      child: Text(
                                                        snapshot.data.year,
                                                        style: TextStyle(
                                                            color: Color(AppColors
                                                                .primaryBlueColor),
                                                            fontSize: 10,
                                                            fontWeight:
                                                                FontWeight
                                                                    .w500),
                                                      ),
                                                    ),
                                                  )),
                                                ),
                                              ],
                                            ),
                                            Row(
                                              children: [
                                                Flexible(
                                                  child: FractionallySizedBox(
                                                    widthFactor: 1,
                                                    child: Padding(
                                                      padding:
                                                          const EdgeInsets.only(
                                                              left: 10, top: 5),
                                                      child: Text.rich(TextSpan(
                                                          text: 'Model: ',
                                                          style: TextStyle(
                                                              fontSize: 12,
                                                              fontWeight:
                                                                  FontWeight
                                                                      .w500,
                                                              color: Color(
                                                                  AppColors
                                                                      .greyText)),
                                                          children: <
                                                              InlineSpan>[
                                                            TextSpan(
                                                              text: snapshot
                                                                  .data.model
                                                                  .toString(),
                                                              style: TextStyle(
                                                                  fontSize: 12,
                                                                  fontWeight:
                                                                      FontWeight
                                                                          .w700,
                                                                  color: Color(
                                                                      AppColors
                                                                          .blackText)),
                                                            ),
                                                          ])),
                                                    ),
                                                  ),
                                                ),
                                                Flexible(
                                                  child: FractionallySizedBox(
                                                    widthFactor: 1,
                                                    child: Padding(
                                                      padding:
                                                          const EdgeInsets.only(
                                                              top: 5),
                                                      child: Text.rich(TextSpan(
                                                          text: 'Make: ',
                                                          style: TextStyle(
                                                              fontSize: 12,
                                                              fontWeight:
                                                                  FontWeight
                                                                      .w500,
                                                              color: Color(
                                                                  AppColors
                                                                      .greyText)),
                                                          children: <
                                                              InlineSpan>[
                                                            TextSpan(
                                                              text: snapshot
                                                                  .data.make
                                                                  .toString(),
                                                              style: TextStyle(
                                                                  fontSize: 12,
                                                                  fontWeight:
                                                                      FontWeight
                                                                          .w700,
                                                                  color: Color(
                                                                      AppColors
                                                                          .blackText)),
                                                            )
                                                          ])),
                                                    ),
                                                  ),
                                                ),
                                              ],
                                            ),
                                          ],
                                        ),
                                      )
                                    ],
                                  )),
                                ],
                              ),
                            );
                          } else {
                            return const Center(child: Text(''));
                          }
                        }),

设计这张卡片最好的方法是什么?我对行和列进行了操作,但当键盘出现时,当我点击此功能构建器下方的文本字段时,会导致像素溢出等问题.汽车图像后的弹性排导致溢出,我不知道为什么!它已经在灵活的窗口小部件中了.如果我不点击Textfield,它就可以正常工作.请给我带路.FutureBuilder构建器位于主列中,该列也包装在一个容器中,而该容器位于SingleChiledScrollView中.

它给出了这些错误

════════ Exception caught by rendering library ═════════════════════════════════
A RenderFlex overflowed by 25 pixels on the bottom.
The relevant error-causing widget was
Column  
=> (its the flexible column inside the row with flexfit.tight)

Exception has occurred.
_AssertionError ('package:flutter/src/widgets/framework.dart': Failed assertion: line 5186 pos 16: 'child is! ParentDataElement<ParentData>': is not true.)

enter image description here

推荐答案

试试这个:

Container(
                decoration: const BoxDecoration(
                  color: Colors.white,
                  borderRadius: BorderRadius.all(Radius.circular(15)),
                  boxShadow: null,
                ),
                padding: const EdgeInsets.all(20),
                child: Column(
                  children: [
                    Row(
                      children: [
                        Expanded(
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Text(
                                'Claim ID',
                                style: TextStyle(
                                  fontSize: 12,
                                  fontWeight: FontWeight.w500,
                                  color: Colors.grey,
                                ),
                              ),
                              Padding(
                                padding: const EdgeInsets.only(top: 4.0),
                                child: Text(
                                  'widget.claimNumber',
                                  style: const TextStyle(
                                    fontSize: 14,
                                    fontWeight: FontWeight.w600,
                                  ),
                                ),
                              ),
                            ],
                          ),
                        ),
                        SizedBox(
                          width: 16,
                        ),
                        Expanded(
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: [
                              Text(
                                'Contract No.',
                                style: TextStyle(
                                  fontSize: 12,
                                  fontWeight: FontWeight.w500,
                                  color: Colors.grey,
                                ),
                              ),
                              Padding(
                                padding: const EdgeInsets.only(top: 4.0),
                                child: Text(
                                  'KP2207514735',
                                  style: TextStyle(
                                    fontSize: 14,
                                    fontWeight: FontWeight.w600,
                                  ),
                                ),
                              ),
                            ],
                          ),
                        ),
                      ],
                    ),
                    Divider(
                      color: Colors.black,
                      height: 20,
                      thickness: 1,
                    ),
                    Row(
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        Container(
                          height: 59,
                          width: 59,
                          decoration: const BoxDecoration(
                              borderRadius:
                                  BorderRadius.all(Radius.circular(10)),
                              color: Colors.blueAccent
                              // image: DecorationImage(
                              //   image: AssetImage("lib/Assets/Images/car.png"),
                              //   fit: BoxFit.cover,
                              // ),
                              ),
                        ),
                        SizedBox(
                          width: 12,
                        ),
                        Expanded(
                          child: Column(
                            mainAxisSize: MainAxisSize.max,
                            children: [
                              Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: [
                                  Expanded(
                                    child: Text(
                                      'Toyota yaris',
                                      overflow: TextOverflow.fade,
                                      style: const TextStyle(
                                        fontSize: 16,
                                        fontWeight: FontWeight.w700,
                                      ),
                                    ),
                                  ),
                                  Container(
                                    margin: const EdgeInsets.only(left: 16),
                                    decoration: BoxDecoration(
                                        color: Colors.black,
                                        borderRadius: const BorderRadius.all(
                                            Radius.circular(5))),
                                    padding: const EdgeInsets.all(3),
                                    child: Text(
                                      '2019',
                                      style: TextStyle(
                                          color: Colors.blueAccent,
                                          fontSize: 10,
                                          fontWeight: FontWeight.w500),
                                    ),
                                  ),
                                ],
                              ),
                              SizedBox(
                                height: 12,
                              ),
                              Row(
                                children: [
                                  Expanded(
                                    child: Text.rich(
                                      softWrap: false,
                                      overflow: TextOverflow.fade,
                                      TextSpan(
                                          text: 'Model: ',
                                          style: TextStyle(
                                              fontSize: 12,
                                              fontWeight: FontWeight.w500,
                                              color: Colors.grey),
                                          children: <InlineSpan>[
                                            TextSpan(
                                              text: 'snapshot.data.model',
                                              style: TextStyle(
                                                  fontSize: 12,
                                                  fontWeight: FontWeight.w700,
                                                  color: Colors.black),
                                            ),
                                          ]),
                                    ),
                                  ),
                                  SizedBox(
                                    width: 16,
                                  ),
                                  Expanded(
                                    child: Text.rich(
                                        softWrap: false,
                                        overflow: TextOverflow.fade,
                                        TextSpan(
                                            text: 'Make: ',
                                            style: TextStyle(
                                                fontSize: 12,
                                                fontWeight: FontWeight.w500,
                                                color: Colors.grey),
                                            children: <InlineSpan>[
                                              TextSpan(
                                                text: 'snapshot.data.make',
                                                style: TextStyle(
                                                    fontSize: 12,
                                                    fontWeight: FontWeight.w700,
                                                    color: Colors.black),
                                              )
                                            ])),
                                  ),
                                ],
                              ),
                            ],
                          ),
                        )
                      ],
                    ),
                  ],
                ),
              )

enter image description here

Flutter相关问答推荐

如何将图像从顶部和底部半向外设置为飘动

下拉图标未居中

无法将Flutter 连接到Firebase

在保持标高=1的情况下更改AppBar立面 colored颜色 /遮罩

遇到图像路径格式问题

为什么我的页面控制器在使用Riverpod时没有更改我的页面视图?

Flutter 块消费者仅对特定的状态属性更改做出react

Android工作室Flutter 热重新加载更新后不工作

如何在flutter中使用youtube_explod_start加载下一页

要禁用按钮上的通知声音,请点击Flutter

Dart:未捕获错误:RangeError(索引):索引超出范围:索引应小于 7:7

在 Flutter 中解码 BLE 设备负载

Riverpod 2.3.6:AutoDisposeNotifier和ref.onDispose自动处理

splash_screen 没有被推送到登录页面

Flutter ImagePicker - 在 onPressed 中异步获取图像显示 lint 警告

Firebase Auth - 有没有办法为新用户预先生成 UID?

如何建立最近的文件列表?

Flutter - 定义按钮的优雅方式

如何修复int类型不是String类型的子类型

如何在Flutter 中制作自定义微调器?