Flutter: Listview inside a scrollable column does not work in AlertDialog

I am trying to include a listview in an already scrollable Column inside an AlertDialog. I saw that if I used NeverScrollablePhysics(), shrinkWrap: true & a SingleChildScrollView() it should work.

I tried solutions I saw on multiple other questions here on StackOverflow & Medium but none of them work here, I suspect the fact it is into a Dialog to cause the issue.

Here is the code of my showDialog method:

    showDialog(
      context: context,
      builder: (context) {
        return AlertDialog(
          scrollable: true,
          insetPadding: EdgeInsets.symmetric(
            // vertical: context.height * 0.05,
            horizontal: context.width * 0.05,
          ),
          contentPadding: EdgeInsets.symmetric(
            vertical: context.height * 0.02,
            horizontal: context.width * 0.05,
          ),
          title: Text(
            "Booster '${post.title}'",
            style: TextStyle(
              color: context.thirdColor,
              fontSize: context.width * 0.05,
              fontWeight: FontWeight.bold,
            ),
          ),
          content: StatefulBuilder(builder: (context, refresh) {
            return SingleChildScrollView(
              physics: ScrollPhysics(),
              child: Column(
                mainAxisSize: MainAxisSize.min,
                mainAxisAlignment: MainAxisAlignment.start,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Container(
                    height: context.height * 0.06,
                    width: context.width,
                    padding: EdgeInsets.symmetric(
                      horizontal: context.width * 0.02,
                    ),
                    child: Text(
                      "Choisissez parmi nos offres pour booster votre annonce",
                      style: TextStyle(
                        color: const Color.fromARGB(
                          255,
                          87,
                          87,
                          87,
                        ),
                        fontSize: context.height * 0.017,
                        fontWeight: FontWeight.w500,
                      ),
                    ),
                  ),
                  Container(
                    height: context.width * 0.06,
                    child: Text(
                      "Les boosts",
                      style: TextStyle(
                        color: context.secondaryColor,
                        fontSize: context.height * 0.02,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                  ),
                  Expanded(
                    // constraints: BoxConstraints(
                    //   minHeight: context.height * 0.15,
                    // ),
                    // width: context.width * 0.9,
                    child: ListView.builder(
                      itemCount: getBoosts().length,
                      physics: NeverScrollableScrollPhysics(),
                      shrinkWrap: true,
                      itemBuilder: (context, index) {
                        Map<String, dynamic> boost = getBoosts()[index];
                        return ListTile(
                          contentPadding: EdgeInsets.zero,
                          dense: true,
                          tileColor: boost["name"] == selectedBoost["name"]
                              ? context.thirdColor.withOpacity(0.1)
                              : Colors.transparent,
                          onTap: () {
                            if (boost["name"] != selectedBoost["name"]) {
                              selectedBoost = boost;
                              refresh(() {});
                            } else {
                              selectedBoost = {};
                              refresh(() {});
                            }
                          },
                          leading: //radio selected if boost["name"] == selectedBoost["name"]
                              SizedBox(
                                  width: context.width * 0.05,
                                  child: Icon(
                                    Icons.arrow_right_rounded,
                                    color: Colors.grey,
                                  )),
                          title: Text(
                            boost["name"],
                            style: TextStyle(
                              color: Colors.black,
                              fontSize: context.height * 0.017,
                              fontWeight: FontWeight.bold,
                            ),
                          ),
                          subtitle: Text(
                            boost["price"] + " FCFA",
                            style: TextStyle(
                              color: Colors.grey,
                              // color: context.thirdColor,
                              fontWeight: FontWeight.bold,
                              fontSize: context.height * 0.015,
                            ),
                          ),
                          trailing: //if boost["name"] == selectedBoost["name"] then show check icon
                              selectedBoost["name"] == boost["name"]
                                  ? Icon(
                                      Icons.check,
                                      color: context.thirdColor,
                                    )
                                  : null,
                        );
                      },
                    ),
                  ),
                  Container(
                    height: context.width * 0.06,
                    width: context.width * 0.9,
                    child: Text(
                      "Les publicités",
                      style: TextStyle(
                        color: context.secondaryColor,
                        fontSize: context.height * 0.02,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                  ),
                  Expanded(
                    child: ListView.builder(
                      itemCount: getAds().length,
                      physics: NeverScrollableScrollPhysics(),
                      shrinkWrap: true,
                      itemBuilder: (context, index) {
                        Map<String, dynamic> ad = getAds()[index];
                        return ListTile(
                          dense: true,
                          minVerticalPadding: 0,
                          contentPadding: EdgeInsets.zero,
                          onTap: () {
                            if (ad["name"] != selectedAd["name"]) {
                              selectedAd = ad;
                              refresh(() {});
                            } else {
                              selectedAd = {};
                              refresh(() {});
                            }
                          },
                          tileColor: ad["name"] == selectedAd["name"]
                              ? context.thirdColor.withOpacity(0.1)
                              : Colors.transparent,
                          leading: //radio selected if ad["name"] == selectedAd["name"]
                              SizedBox(
                            width: context.width * 0.05,
                            child: Icon(
                              Icons.arrow_right_rounded,
                              color: Colors.grey,
                            ),
                          ),
                          title: Text(
                            ad["name"],
                            style: TextStyle(
                              color: Colors.black,
                              fontSize: context.height * 0.017,
                              fontWeight: FontWeight.bold,
                            ),
                          ),
                          subtitle: Text(
                            ad["price"] + " FCFA",
                            style: TextStyle(
                              color: Colors.grey,
                              // color: context.thirdColor,
                              fontWeight: FontWeight.bold,
                              fontSize: context.height * 0.015,
                            ),
                          ),
                          trailing: //if ad["name"] == selectedAd["name"] then show check icon
                              selectedAd["name"] == ad["name"]
                                  ? Icon(
                                      Icons.check,
                                      color: context.thirdColor,
                                    )
                                  : null,
                        );
                      },
                    ),
                  ),
                ],
              ),
            );
          }),
          actions: [
            TextButton(
              onPressed: () {
                Navigator.pop(context);
              },
              child: Text(
                "Annuler",
                style: TextStyle(
                  color: context.primaryColor,
                  fontSize: context.height * 0.02,
                  fontWeight: FontWeight.bold,
                ),
              ),
            ),
            ElevatedButton(
              onPressed: () {
                showDialog(
                  context: context,
                  //invisible background
                  barrierColor: Colors.transparent,
                  builder: (context) {
                    return Center(
                      child: CircularProgressIndicator(),
                    );
                  },
                );
                int total = 0;
                String details = "";
                if (selectedAd.isEmpty & selectedBoost.isEmpty) {
                  return;
                }
                if (selectedAd.isNotEmpty) {
                  total += int.parse(selectedAd["price"]);
                  details += selectedAd["name"];
                }
                if (selectedBoost.isNotEmpty) {
                  total += int.parse(selectedBoost["price"]);
                  if (details.isNotEmpty) {
                    details += " n|| ";
                  }
                  details += selectedBoost["name"];
                }

                CreateBoostPaymentUseCase()
                    .execute(
                  post,
                  total,
                  details,
                  categoryAd: selectedBoost["value"] ?? null,
                  homepageAd: selectedAd["value"] ?? null,
                )
                    .then((value) {
                  Navigator.pop(context);
                });
              },
              style: ElevatedButton.styleFrom(
                backgroundColor: context.primaryColor,
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.circular(10),
                ),
              ),
              child: Text(
                "Valider",
                style: TextStyle(
                  color: Colors.white,
                  fontSize: context.height * 0.02,
                  fontWeight: FontWeight.bold,
                ),
              ),
            ),
          ],
        );
      },
    );

Maybe the problem is due to the way I use the AlertDialog but I’m actually confused on what caused the error. Here is the complete error I have:

he following assertion was thrown during performLayout():
RenderShrinkWrappingViewport does not support returning intrinsic dimensions.
Calculating the intrinsic dimensions would require instantiating every child of the viewport, which defeats the point of viewports being lazy.
If you are merely trying to shrink-wrap the viewport in the main axis direction, you should be able to achieve that effect by just giving the viewport loose constraints, without needing to measure its intrinsic dimensions.

The relevant error-causing widget was:
    AlertDialog AlertDialog:file:///Users/pulsar/development/flutter_workspace/smxew-mobile/lib/core/services.dart:1018:16

When the exception was thrown, this was the stack:

I skipped the stacktrace…

════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderIntrinsicWidth#3f98f relayoutBoundary=up5 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2165 pos 12: 'hasSize'
The relevant error-causing widget was:
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: _RenderInkFeatures#597aa relayoutBoundary=up4 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2165 pos 12: 'hasSize'
The relevant error-causing widget was:
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderCustomPaint#4fa77 relayoutBoundary=up3 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2165 pos 12: 'hasSize'
The relevant error-causing widget was:
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderPhysicalShape#e022d relayoutBoundary=up2 NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2165 pos 12: 'hasSize'
The relevant error-causing widget was:
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════
'package:flutter/src/rendering/shifted_box.dart': Failed assertion: line 345 pos 12: 'child!.hasSize': is not true.
The relevant error-causing widget was:
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════
RenderBox was not laid out: RenderPhysicalShape#e022d relayoutBoundary=up2
'package:flutter/src/rendering/box.dart':
Failed assertion: line 2165 pos 12: 'hasSize'
The relevant error-causing widget was:

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật