title: Flutter Tab view in the middle of the screen
body: <p>I was trying to achiving something like that in the image.
  But when i try to do that this error is getting.</p>
  <p>The following assertion was thrown while applying parent data.:
  Incorrect use of ParentDataWidget.</p>
  <p><em>The ParentDataWidget Expanded(flex: 1) wants to apply ParentData of type FlexParentData to a RenderObject, which has been set up to accept ParentData of incompatible type ParentData.</em></p>
  <p>and the screen is going grey.</p>
  <p>What i have done so far is :-</p>
  <pre><code>GestureDetector(
        onTap: () {
          Navigator.push(
              context, MaterialPageRoute(builder: (context) =&gt; Detailedview(id)));
        },
        child: Container(
          decoration: BoxDecoration(
            boxShadow: [
              BoxShadow(
                color: Colors.grey.withOpacity(0.5), //color of shadow
                spreadRadius: 1, //spread radius
                blurRadius: 1,
                // blurStyle: BlurStyle.normal,
                // blur radius
                offset: const Offset(0, 0),
              ),
            ],
            color: Colors.white,
            borderRadius: const BorderRadius.all(Radius.circular(15)),
          ),
          margin: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 5),
          width: 190.0,
          child: Stack(
            // mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: [
              //image
              Container(
                height: MediaQuery.of(context).size.height * 0.145,
                width: MediaQuery.of(context).size.width * 0.9,
                // height: MediaQuery.of(context).size.height * 0.09,
                // width: MediaQuery.of(context).size.width * 0.35,
                decoration: BoxDecoration(
                  borderRadius: const BorderRadius.all(Radius.circular(15)),
                  image: DecorationImage(
                      fit: BoxFit.cover,
                      image: CachedNetworkImageProvider(
                          &quot;http://192.168.20.52:8081/uploads/&quot; + image)),
                ),
              ),
              //black shadow
              Container(
                height: MediaQuery.of(context).size.height * 0.145,
                width: double.infinity,
                // height: MediaQuery.of(context).size.height * 0.09,
                // width: MediaQuery.of(context).size.width * 0.35,
                decoration: BoxDecoration(
                  borderRadius: const BorderRadius.all(Radius.circular(15)),
                  gradient: LinearGradient(
                      colors: [Colors.black.withOpacity(0.4), Colors.transparent],
                      begin: FractionalOffset.topCenter,
                      end: FractionalOffset.bottomCenter),
                ),
              ),
              //book mark
              GestureDetector(
                onTap: () async {
                  if (bookmark == &quot;False&quot;) {
                    await makebookmark(userid, id);
                  }
  
                  if (bookmark == &quot;True&quot;) {
                    await deletebookmark(userid, id);
                  }
  
                  setState(() {
                    popularpackages = fetchpopularpackagebyid(userid);
                  });
                },
                child: Padding(
                    padding: EdgeInsets.only(
                        top: MediaQuery.of(context).size.height * 0.115,
                        left: MediaQuery.of(context).size.width * 0.35),
                    child: Container(
                      height: 44,
                      width: 44,
                      decoration: BoxDecoration(
                        color: Colors.grey[300]?.withOpacity(0.6),
                        borderRadius: const BorderRadius.all(Radius.circular(50)),
                      ),
                      child: Padding(
                        padding: const EdgeInsets.all(5.0),
                        child: Container(
                          decoration: BoxDecoration(
                            color: bookmark == &quot;False&quot;
                                ? Colors.white
                                : const Color(Const.secondary),
                            borderRadius:
                                const BorderRadius.all(Radius.circular(50)),
                          ),
                          child: Icon(
                            Icons.bookmark_add,
                            color: bookmark == &quot;False&quot;
                                ? const Color(Const.secondary)
                                : Colors.white,
                          ),
                        ),
                      ),
                    )),
              ),
              //place name
              Padding(
                padding: EdgeInsets.only(
                    top: MediaQuery.of(context).size.height * 0.16, left: 10),
                child: Text(
                  package,
                  overflow: TextOverflow.ellipsis,
                  maxLines: 1,
                  style: GoogleFonts.lato(
                    color: Colors.black,
                    textStyle: Theme.of(context).textTheme.headline4,
                    fontSize: 14,
                    fontWeight: FontWeight.w700,
                    fontStyle: FontStyle.normal,
                  ),
                ),
              ),
              //district
              Padding(
                padding: EdgeInsets.only(
                    top: MediaQuery.of(context).size.height * 0.180, left: 10),
                child: Align(
                  alignment: Alignment.centerLeft,
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Row(
                        mainAxisAlignment: MainAxisAlignment.start,
                        children: [
                          const Icon(
                            Icons.location_on_outlined,
                            size: 20,
                            color: Color(Const.secondary),
                          ),
                          Padding(
                            padding: const EdgeInsets.all(5.0),
                            child: SizedBox(
                              width: MediaQuery.of(context).size.width * 0.18,
                              child: Text(
                                tourPlace,
                                overflow: TextOverflow.ellipsis,
                                // 'Kochi',
                                style: GoogleFonts.spartan(
                                  color: const Color(Const.secondary),
                                  textStyle:
                                      Theme.of(context).textTheme.headline4,
                                  fontSize: 12,
                                  fontWeight: FontWeight.w600,
                                  fontStyle: FontStyle.normal,
                                ),
                              ),
                            ),
                          ),
                        ],
                      ),
                      //price
                      Padding(
                        padding: const EdgeInsets.only(right: 15),
                        child: Text(
                          '\$ ' + rate,
                          overflow: TextOverflow.ellipsis,
                          style: GoogleFonts.spartan(
                            color: const Color(Const.secondary),
                            textStyle: Theme.of(context).textTheme.headline4,
                            fontSize: 12,
                            fontWeight: FontWeight.w400,
                            fontStyle: FontStyle.normal,
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
              //book now
              Padding(
                padding: const EdgeInsets.all(8.0),
                child: GestureDetector(
                  onTap: () {
                    Navigator.push(
                      context,
                      MaterialPageRoute(builder: (context) =&gt; Booknow(id)),
                    );
                  },
                  child: Container(
                      height: 25,
                      width: 70,
                      decoration: const BoxDecoration(
                        color: Color(Const.secondary),
                        borderRadius: BorderRadius.all(Radius.circular(25)),
                      ),
                      child: Center(
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.center,
                          children: [
                            Padding(
                              padding: const EdgeInsets.all(0.0),
                              child: Text(
                                'Book Now',
                                style: GoogleFonts.spartan(
                                  color: Colors.white,
                                  textStyle:
                                      Theme.of(context).textTheme.headline4,
                                  fontSize: 10,
                                  fontWeight: FontWeight.w600,
                                  fontStyle: FontStyle.normal,
                                ),
                              ),
                            ),
                          ],
                        ),
                      )),
                ),
              )
            ],
          ),
        ),
      );
  </code></pre>
  <p><a href="https://i.stack.imgur.com/EjakI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EjakI.png" alt="enter image description here" /></a></p>