Flutter ListTile in ListView green in release iOS

ru9i0ody  于 2023-05-19  发布在  Flutter
关注(0)|答案(2)|浏览(114)

当我在iOS上构建Flutter项目时,当ListView中出现ListTile时,我得到的是一个灰色容器,而不是实际的listTile。我怀疑这与ListView的大小有关。

e7arh2l6

e7arh2l61#

将手机连接到笔记本电脑,并在终端中运行以下内容
Flutter释放
然后打开这个屏幕。我相信你会在航站楼找到一些东西

dzjeubhm

dzjeubhm2#

SizedBox(
                                  width: 100.w,
                                  child: Obx(() {
                                    return ListView.builder(
                                        shrinkWrap: true,
                                        itemCount: splitBillingController
                                            .splitUsers.length,
                                        itemBuilder: (context, int index) {
                                          return Padding(
                                            padding: const EdgeInsets.symmetric(
                                                vertical: 8),
                                            child: splitBillingController
                                                    .isLoading.value
                                                ? const Center(
                                                    child:
                                                        CircularProgressIndicator(
                                                      color: primaryColor,
                                                    ),
                                                  )
                                                : Dismissible(
                                                    direction: DismissDirection
                                                        .endToStart,
                                                    confirmDismiss:
                                                        (direction) async {
                                                      // return null;
                                                      return await splitBillingController
                                                          .removeSplitter(
                                                              splitBillingController
                                                                          .splitUsers[
                                                                      index]![
                                                                  "userId"]);
                                                    background: Container(
                                                      padding: const EdgeInsets
                                                              .symmetric(
                                                          horizontal: 30),
                                                      alignment:
                                                          AlignmentDirectional
                                                              .centerEnd,
                                                      color: Colors.red,
                                                      child: const Icon(
                                                        Icons.delete,
                                                        color: Colors.white,
                                                      ),
                                                    ),
                                                    key: Key(
                                                        splitBillingController
                                                                .splitUsers[
                                                            index]!["userId"]),
                                                    child: ListTile(
                                                      textColor: buttonColor,
                                                      selected:
                                                          splitBillingController
                                                                      .splitUsers[
                                                                  index]![
                                                              "isUnlocked"],
                                                      selectedColor:
                                                          Colors.white,
                                                      selectedTileColor:
                                                          buttonColor,
                                                      onTap: () async {
                                                        await splitBillingController
                                                            .approveUser(
                                                                splitBillingController
                                                                        .splitUsers[
                                                                    index]);
                                                      },
                                                      shape:
                                                          RoundedRectangleBorder(
                                                        borderRadius:
                                                            BorderRadius
                                                                .circular(24),
                                                      ),
                                                      tileColor: Colors.white,
                                                      // const Icon(Icons.credit_card),
                                                      leading:
                                                          CircularProfileAvatar(
                                                        splitBillingController
                                                                .splitUsers[
                                                            index]!["photo"],
                                                        radius: 20,
                                                        borderWidth: 0,
                                                        placeHolder: (context,
                                                                url) =>
                                                            SvgPicture.asset(
                                                          'assets/images/armadillo.svg',
                                                          height: 20,
                                                        ),
                                                      ),
                                                      title: Text(
                                                        splitBillingController
                                                                .splitUsers[
                                                            index]!["userName"],
                                                        style: const TextStyle(
                                                            fontFamily:
                                                                mainFontBold),
                                                      ),
                                                      subtitle: const Text(
                                                          "Passenger"),
                                                      trailing: Text(
                                                        "${splitBillingController.splitUsers[index]!["amount"].toStringAsFixed(2)}€",
                                                        style: const TextStyle(
                                                          fontSize: 22,
                                                          fontFamily:
                                                              mainFontBold,
                                                        ),
                                                      ),
                                                    ),
                                                  ),
                                          );
                                        });
                                  }),
                                ),```

相关问题