Home > database >  I have some errors when i want to pull data from ListView
I have some errors when i want to pull data from ListView

Time:06-05

I have some errors when I want to pull data from ListView

Here are the Errors:

                constraints: MISSING
                semantic boundary
                size: MISSING

════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by rendering library ═════════════════════════════════ RenderBox was not laid out: RenderRepaintBoundary#f3b69 NEEDS-LAYOUT NEEDS-PAINT 'package:flutter/src/rendering/box.dart': package:flutter/…/rendering/box.dart:1 Failed assertion: line 1982 pos 12: 'hasSize'

The relevant error-causing widget was Column lib\…\hotel\hotel5yildiz.dart:41 ════════════════════════════════════════════════════════════════════════════════ Reloaded 1 of 706 libraries in 2.713ms. I/flutter ( 9320): 4.3 W/System ( 9320): Ignoring header X-Firebase-Locale because its value was null. D/FirebaseAuth( 9320): Notifying id token listeners about user ( wzpAI4NY7wbpkrLsEVXMDU0kjAl2 ).

Here is code

Scaffold(
    appBar: appbarekle(context, "5 Yıldızlı Hoteller"),
    backgroundColor: Color(0xffE7EEF5),
    body: SingleChildScrollView(
      child: Column(children: [
        SizedBox(
          height: 40,
        ),
        Column(
          children: [
            Expanded(
              child: StreamBuilder<QuerySnapshot>(
                stream: kategoriRef.snapshots(),
                builder: (BuildContext context,
                    AsyncSnapshot<QuerySnapshot> asyncSnapshot) {
                  if (!asyncSnapshot.hasData) {
                    return Center(
                      child: CircularProgressIndicator(),
                    );
                  } else {
                    var querySnappshot = asyncSnapshot.data;
                    var hoteller = querySnappshot!.docs;
                    var mapdata = hoteller.forEach((doc) async {
                      var veri = doc.data() as Map<String, dynamic>;
                      hotel5yildiz.add(veri);
                    });

                    print(hotel5yildiz[0]["puan"]);
                    return ListView.builder(
                        itemCount: hotel5yildiz.length,
                        itemBuilder: (context, index) {
                          return hotelekle(
                              hotel5yildiz[index]["fotograf"],
                              hotel5yildiz[index]["adi"],
                              hotel5yildiz[index]["puan"]);
                        });
                  }
                },
              ),
            ),
          ],
        ),
      ]),
    ),
  ),

CodePudding user response:

You're using a SingleChildScrollView, but then inside one of your child Columns, you're wrapping some of your widgets with Expanded

You need to provide vertical constraints to your widgets, so they have a limited height

You can achieve this by simply removing your Expanded widget

  • Related