未找到材质小部件。我有这样的错误

问题描述 投票:0回答:1

要引入 Material 小部件,您可以直接包含一个,也可以使用包含 Material 本身的小部件,例如 Card、Dialog、Drawer 或 Scaffold。 Error that when I tap product 它显示 RenderFlex 底部溢出了 37 个像素

    const Banner(),
    const Padding(
      padding: EdgeInsets.only(left: 10, top: 10, bottom: 5),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          Text(
            "Kids Plaza",
            textAlign: TextAlign.start,
            style: TextStyle(
                fontSize: 16,
                color: Colors.red,
                fontWeight: FontWeight.bold),
          ),
        ],
      ),
    ),
    const Padding(
      padding: EdgeInsets.only(left: 10, right: 10, top: 5, bottom: 5),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          Flexible(
            child: Text(
              "Play Station 5 Storage 512 Gb with two joysticks Color: White",
              maxLines: 3,
              style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
            ),
          ),
        ],
      ),
    ),
    Container(
      margin: const EdgeInsets.only(left: 10, right: 10),
      padding: const EdgeInsets.all(10),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(15),
        color: Colors.grey.withOpacity(0.1),
      ),
      child: const Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Text(
            "Haryt kody",
            style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
          ),
          Text(
            "483166516516116",
            style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
          ),
        ],
      ),
    ),
    Container(
      margin: const EdgeInsets.only(left: 10, right: 10, top: 5),
      padding: const EdgeInsets.all(10),
      decoration: BoxDecoration(
        borderRadius: BorderRadius.circular(15),
        color: Colors.grey.withOpacity(0.1),
      ),
      child: const Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Text(
            "Nike",
            style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
          ),
          Text(
            "Orginal 100%",
            style: TextStyle(fontSize: 14, fontWeight: FontWeight.w500),
          ),
        ],
      ),
    ),
    Padding(
      padding: const EdgeInsets.all(10),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          const Text(
            "TMT 9990",
            textAlign: TextAlign.start,
            style: TextStyle(
                fontSize: 20,
                color: Colors.red,
                fontWeight: FontWeight.bold),
          ),
          Row(
            children: [
              InkWell(
                onTap: () async {
                  const call = 'tel:+9936126483';
                  if (await canLaunch(call)) {
                    await launch(call);
                  }
                },
                child: Container(
                  padding: EdgeInsets.all(
                      MediaQuery.of(context).getProportionateScreenWidth(6)),
                  decoration: BoxDecoration(
                    color: Colors.transparent,
                    borderRadius: BorderRadius.circular(15),
                    border: Border.all(color: Colors.red.withOpacity(0.3)),
                  ),
                  child: const Padding(
                    padding: EdgeInsets.only(right: 10, left: 10),
                    child: Icon(
                      Icons.phone,
                      color: Colors.green,
                      size: 20,
                    ),
                  ),
                ),
              ),
              SizedBox(
                width:
                MediaQuery.of(context).getProportionateScreenWidth(5),
              ),
              InkWell(
                onTap: () async {
                  const sms = 'sms:+9936126483';
                  if (await canLaunch(sms)) {
                    await launch(sms);
                  }
                },
                child: Container(
                  padding: EdgeInsets.all(
                      MediaQuery.of(context).getProportionateScreenWidth(6)),
                  decoration: BoxDecoration(
                    color: Colors.transparent,
                    borderRadius: BorderRadius.circular(15),
                    border: Border.all(color: Colors.red.withOpacity(0.3)),
                  ),
                  child: const Padding(
                    padding: EdgeInsets.only(right: 10, left: 10),
                    child: Icon(
                      Icons.message,
                      color: Colors.blueAccent,
                      size: 20,
                    ),
                  ),
                ),
              ),
              SizedBox(
                width:
                MediaQuery.of(context).getProportionateScreenWidth(5),
              ),
              Container(
                padding: EdgeInsets.all(
                    MediaQuery.of(context).getProportionateScreenWidth(6)),
                decoration: BoxDecoration(
                  color: Colors.transparent,
                  borderRadius: BorderRadius.circular(15),
                  border: Border.all(color: Colors.red.withOpacity(0.3)),
                ),
                child: const Padding(
                  padding: EdgeInsets.only(right: 10, left: 10),
                  child: Icon(
                    Icons.favorite_border_rounded,
                    color: Colors.red,
                    size: 20,
                  ),
                ),
              ),
              SizedBox(
                width:
                MediaQuery.of(context).getProportionateScreenWidth(5),
              ),
              InkWell(
                child: Container(
                  padding: EdgeInsets.all(
                      MediaQuery.of(context).getProportionateScreenWidth(6)),
                  decoration: BoxDecoration(
                    color: Colors.red,
                    borderRadius: BorderRadius.circular(15),
                    border: Border.all(color: Colors.red),
                  ),
                  child: const Padding(
                    padding: EdgeInsets.only(right: 10, left: 10),
                    child: Icon(
                      Icons.shopping_cart,
                      color: Colors.white,
                      size: 20,
                    ),
                  ),
                ),
                onTap: () {
                  showModalBottomSheet<void>(
                    context: context,
                    builder: (BuildContext context) {
                      return Container(
                        padding: const EdgeInsets.all(12.5),
                        height: 225,
                        color: Colors.grey.withOpacity(0.1),
                        child: Column(
                          crossAxisAlignment: CrossAxisAlignment.center,
                          children: [
                            Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: <Widget>[
                                const Text('TMT 9990', style: TextStyle(color: Colors.red, fontSize: 18, fontWeight: FontWeight.bold),),
                                InkWell(
                                  child: const Icon(Icons.close,size: 25,),
                                  onTap: () => Navigator.pop(context),
                                ),
                              ],
                            ),

                            Container(
                              padding: const EdgeInsets.all(5),
                              child: Row(
                                mainAxisAlignment: MainAxisAlignment.start,
                                children: [
                                  Column(
                                    mainAxisAlignment: MainAxisAlignment.start,
                                    crossAxisAlignment: CrossAxisAlignment.start,
                                    children: [
                                      const Text(
                                        "Reňkler:",
                                        style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
                                      ),
                                      Row(
                                        children: [
                                          Container(
                                            margin: const EdgeInsets.only(right: 5),
                                            padding: const EdgeInsets.all(12.5),
                                            decoration: BoxDecoration(
                                              borderRadius: BorderRadius.circular(15),
                                              border:
                                              Border.all(color: Colors.red.withOpacity(0.3)),
                                              color: Colors.red,
                                            ),
                                          ),
                                          Container(
                                            margin: const EdgeInsets.only(right: 5),
                                            padding: const EdgeInsets.all(12.5),
                                            decoration: BoxDecoration(
                                              borderRadius: BorderRadius.circular(15),
                                              border:
                                              Border.all(color: Colors.red.withOpacity(0.3)),
                                              color: Colors.blue,
                                            ),
                                          ),
                                        ],
                                      ),
                                    ],
                                  ),
                                ],
                              ),
                            ),
                            Container(
                              padding: const EdgeInsets.all(5),
                              child: Row(
                                mainAxisAlignment: MainAxisAlignment.start,
                                children: [
                                  Column(
                                    mainAxisAlignment: MainAxisAlignment.start,
                                    crossAxisAlignment: CrossAxisAlignment.start,
                                    children: [
                                      const Text(
                                        "Razmerler:",
                                        style: TextStyle(fontSize: 18, fontWeight: FontWeight.w500),
                                      ),
                                      Row(
                                        children: [
                                          Container(
                                            margin: const EdgeInsets.only(right: 5),
                                            padding: const EdgeInsets.only(
                                                top: 5, bottom: 5, left: 15, right: 15),
                                            decoration: BoxDecoration(
                                              borderRadius: BorderRadius.circular(15),
                                              border:
                                              Border.all(color: Colors.red.withOpacity(0.3)),
                                              color: Colors.grey.withOpacity(0.1),
                                            ),
                                            child: const Text("L"),
                                          ),
                                          Container(
                                            margin: const EdgeInsets.only(right: 5),
                                            padding: const EdgeInsets.only(
                                                top: 5, bottom: 5, left: 15, right: 15),
                                            decoration: BoxDecoration(
                                              borderRadius: BorderRadius.circular(15),
                                              border:
                                              Border.all(color: Colors.red.withOpacity(0.3)),
                                              color: Colors.grey.withOpacity(0.1),
                                            ),
                                            child: const Text("XL"),
                                          ),
                                          Container(
                                            margin: const EdgeInsets.only(right: 5),
                                            padding: const EdgeInsets.only(
                                                top: 5, bottom: 5, left: 15, right: 15),
                                            decoration: BoxDecoration(
                                              borderRadius: BorderRadius.circular(15),
                                              border:
                                              Border.all(color: Colors.red.withOpacity(0.3)),
                                              color: Colors.grey.withOpacity(0.1),
                                            ),
                                            child: const Text("XXL"),
                                          ),
                                        ],
                                      ),
                                    ],
                                  ),
                                ],
                              ),
                            ),

                            const SizedBox(height: 7.5),
                            Row(
                              mainAxisAlignment: MainAxisAlignment.center,
                              children: [
                                Container(
                                  padding: EdgeInsets.all(MediaQuery.of(context)
                                      .getProportionateScreenWidth(6)),
                                  decoration: BoxDecoration(
                                    color: Colors.red,
                                    borderRadius: BorderRadius.circular(15),
                                    border: Border.all(
                                        color: Colors.red),
                                  ),
                                  child: Padding(
                                      padding: EdgeInsets.only(
                                          right: MediaQuery.of(context)
                                              .getProportionateScreenWidth(12.5),
                                          left: MediaQuery.of(context)
                                              .getProportionateScreenWidth(12.5)),
                                      child: const Text("Satyn al", style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w600),)
                                  ),
                                ),
                                SizedBox(
                                  width: MediaQuery.of(context)
                                      .getProportionateScreenWidth(5),
                                ),
                                Container(
                                  padding: EdgeInsets.all(MediaQuery.of(context)
                                      .getProportionateScreenWidth(6)),
                                  decoration: BoxDecoration(
                                    color: Colors.red,
                                    borderRadius: BorderRadius.circular(15),
                                    border: Border.all(
                                        color: Colors.red),
                                  ),
                                  child: Padding(
                                      padding: EdgeInsets.only(
                                          right: MediaQuery.of(context)
                                              .getProportionateScreenWidth(12.5),
                                          left: MediaQuery.of(context)
                                              .getProportionateScreenWidth(12.5)),
                                      child: const Text("Sebede goş", style: TextStyle(color: Colors.white, fontSize: 16, fontWeight: FontWeight.w600),)
                                  ),
                                ),
                              ],
                            ),
                          ],
                        ),
                      );
                    },
                  );
                },
              ),
            ],
          ),
        ],
      ),
    ),
    const Padding(
      padding: EdgeInsets.only(left: 10, right: 10, top: 5, bottom: 5),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          Flexible(
            child: Text(
              "Play Station 5 Storage 512 Gb with two joysticks Color: White Play Station 5 Storage 512 Gb with two joysticks Color: White Play Station 5 Storage 512 Gb with two joysticks Color: White Play Station 5 Storage 512 Gb with two joysticks Color: White Play Station 5 Storage 512 Gb with two joysticks Color: White Play Station 5 Storage 512 Gb with two joysticks Color: White Play Station 5 Storage 512 Gb with two joysticks Color: White Play Station 5 Storage 512 Gb with two joysticks Color: White",
              textAlign: TextAlign.start,
              style: TextStyle(
                fontSize: 12.5,
                color: Colors.grey,
              ),
            ),
          ),
        ],
      ),
    ),
    const Padding(
      padding: EdgeInsets.all(10),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        children: [
          Text(
            "Maslahat berilýän harytlar",
            textAlign: TextAlign.start,
            style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
          ),
        ],
      ),
    ),
    GridView.count(
      crossAxisCount: 2,
      childAspectRatio: 0.625,
      physics: const NeverScrollableScrollPhysics(),
      shrinkWrap: true,
      children: [
        for (int i = 1; i < 5; i++)
          Padding(
            padding: EdgeInsets.all(
                MediaQuery.of(context).getProportionateScreenWidth(5)),
            child: GestureDetector(
              onTap: () {
                // Navigator.push(
                //     context,
                //     MaterialPageRoute(
                //         builder: (BuildContext context) =>
                //             const ProductRoute()));
              },
              child: Container(
                padding: EdgeInsets.all(
                  MediaQuery.of(context).getProportionateScreenWidth(10),
                ),
                decoration: BoxDecoration(
                    color: Colors.grey.withOpacity(0.1),
                    borderRadius: BorderRadius.circular(15)),
                child: Column(
                  children: [
                    AspectRatio(
                      aspectRatio: 1.1,
                      child: Container(
                        padding: EdgeInsets.all(
                          MediaQuery.of(context)
                              .getProportionateScreenWidth(10),
                        ),
                        decoration: BoxDecoration(
                            color: Colors.white,
                            borderRadius: BorderRadius.circular(15)),
                        child: badges.Badge(
                          position: badges.BadgePosition.topEnd(
                              top: -10, end: -10),
                          showBadge: true,
                          badgeContent: const Center(
                              child: Text(
                            '-20%',
                            style: TextStyle(color: Colors.white),
                          )),
                          ignorePointer: false,
                          badgeStyle: badges.BadgeStyle(
                            badgeColor: Colors.red,
                            shape: badges.BadgeShape.square,
                            borderRadius: BorderRadius.circular(15),
                            padding: const EdgeInsets.all(5),
                          ),
                          child: Image.network(
                              "https://gmedia.playstation.com/is/image/SIEPDC/console-right_@1x?fmt=png-alpha&scl=1"),
                        ),
                      ),
                    ),
                    const SizedBox(height: 7.5),
                    const Text(
                      "Play Station 5",
                      style: TextStyle(fontWeight: FontWeight.bold),
                      maxLines: 1,
                    ),
                    const SizedBox(height: 7.5),
                    const Text(
                      "Play Station 5 Storage 512 Gb with two joysticks Color: White",
                      style: TextStyle(color: Colors.grey, fontSize: 11),
                      maxLines: 2,
                    ),
                    const SizedBox(height: 7.5),
                    Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Text(
                          "TMT 9990",
                          style: TextStyle(
                            color: Colors.red,
                            fontSize: MediaQuery.of(context)
                                .getProportionateScreenWidth(12.5),
                            fontWeight: FontWeight.w600,
                          ),
                        ),
                      ],
                    ),
                    const SizedBox(height: 7.5),
                    Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Container(
                          padding: EdgeInsets.all(MediaQuery.of(context)
                              .getProportionateScreenWidth(6)),
                          decoration: BoxDecoration(
                            color: Colors.transparent,
                            borderRadius: BorderRadius.circular(15),
                            border: Border.all(
                                color: Colors.red.withOpacity(0.3)),
                          ),
                          child: Padding(
                            padding: EdgeInsets.only(
                                right: MediaQuery.of(context)
                                    .getProportionateScreenWidth(12.5),
                                left: MediaQuery.of(context)
                                    .getProportionateScreenWidth(12.5)),
                            child: const Icon(
                              Icons.favorite_border_rounded,
                              color: Colors.red,
                              size: 20,
                            ),
                          ),
                        ),
                        SizedBox(
                          width: MediaQuery.of(context)
                              .getProportionateScreenWidth(5),
                        ),
                        Container(
                          padding: EdgeInsets.all(MediaQuery.of(context)
                              .getProportionateScreenWidth(6)),
                          decoration: BoxDecoration(
                            color: Colors.red,
                            borderRadius: BorderRadius.circular(15),
                            border: Border.all(color: Colors.red),
                          ),
                          child: Padding(
                            padding: EdgeInsets.only(
                                right: MediaQuery.of(context)
                                    .getProportionateScreenWidth(12.5),
                                left: MediaQuery.of(context)
                                    .getProportionateScreenWidth(12.5)),
                            child: const Icon(
                              Icons.shopping_cart,
                              color: Colors.white,
                              size: 20,
                            ),
                          ),
                        ),
                      ],
                    ),
                  ],
                ),
              ),
            ),
          ),
      ],
    ),
  ]),
));

} }

当我点击产品时,我想查看产品的详细信息。至少你可以想出这样的东西或者你可以给我例子

json flutter api listview gridview
1个回答
0
投票

我认为您没有提供完整的代码,这使得找到您的问题变得更加困难。首先,主部件应该包装到 MaterialApp,然后
每个页面都应该有脚手架小部件,以便正常工作并毫无问题地显示 ui

© www.soinside.com 2019 - 2024. All rights reserved.