如何在颤抖上制作子类别

发布于 2025-01-27 03:32:55 字数 3676 浏览 2 评论 0原文

当我单击当前图片中出现的类别组(肥料,药物等)时,我将举一个例子,它将显示4个子类别,当然,当我再次按下时,它将关闭。如何以最方便的方式做到这一点?谢谢大家,

当我单击当前图片中出现的类别组(肥料,药物等)时,我将举一个例子,它将显示4个子类别,当然,当我按下时,它将关闭再一次。如何以最方便的方式做到这一点?谢谢大家提前

“在此处输入图像描述”

Container(
          alignment: Alignment.center,
          padding: EdgeInsets.only(left: Dimensions.width10),
          child: Flex(
            direction: Axis.horizontal,
            children: [Expanded(
              child: SingleChildScrollView(
                scrollDirection: Axis.horizontal,
                child: Row(
                  children: [
                    TextButton.icon(
                      onPressed: () {
                        setState(() {
                          _selectedPage = Page.el_makasi;
                        });
                      },
                      icon: Icon(
                        Icons.arrow_drop_down,
                        color:
                            _selectedPage == Page.el_makasi ? active : notActive,
                      ),
                      label: const Text(
                        "Tohum",
                        style: TextStyle(color: AppColor.mainColor),
                      ),
                    ),
                    TextButton.icon(
                      onPressed: () {
                        setState(() {
                          _selectedPage = Page.gubre;
                        });
                      },
                      icon: Icon(
                        Icons.arrow_drop_down,
                        color: _selectedPage == Page.gubre ? active : notActive,
                      ),
                      label: const Text("Gübre",
                          style: TextStyle(color: AppColor.mainColor)),
                    ),
                    TextButton.icon(
                      onPressed: () {
                        setState(() {
                          _selectedPage = Page.ilac;
                        });
                      },
                      icon: Icon(
                        Icons.arrow_drop_down,
                        color: _selectedPage == Page.ilac ? active : notActive,
                      ),
                      label: const Text("İlaç",
                          style: TextStyle(color: AppColor.mainColor)),
                    ),
                    TextButton.icon(
                      onPressed: () {
                        setState(() {
                          _selectedPage = Page.tohum;
                        });
                      },
                      icon: Icon(
                        Icons.arrow_drop_down,
                        color: _selectedPage == Page.tohum ? active : notActive,
                      ),
                      label: const Text("Makineler",
                          style: TextStyle(color: AppColor.mainColor)),
                    ),
                    TextButton.icon(
                      onPressed: () {
                        setState(() {
                          _selectedPage = Page.makine;
                        });
                      },
                      icon: Icon(
                        Icons.arrow_drop_down,
                        color: _selectedPage == Page.makine ? active : notActive,
                      ),
                      label: const Text("El makası",
                          style: TextStyle(color: AppColor.mainColor)),
                    ),
                  ],
                ),
              ),
            ),]
          ),
        ),

I am giving an example when I click on the category group (fertilizer, medicine, etc.) that appears in the current picture, it will show 4 sub-categories, of course, it will be closed when I press it again. How can I do this in the most convenient way? Thank you everyone in advance

I am giving an example when I click on the category group (fertilizer, medicine, etc.) that appears in the current picture, it will show 4 sub-categories, of course, it will be closed when I press it again. How can I do this in the most convenient way? Thank you everyone in advance

enter image description here

Container(
          alignment: Alignment.center,
          padding: EdgeInsets.only(left: Dimensions.width10),
          child: Flex(
            direction: Axis.horizontal,
            children: [Expanded(
              child: SingleChildScrollView(
                scrollDirection: Axis.horizontal,
                child: Row(
                  children: [
                    TextButton.icon(
                      onPressed: () {
                        setState(() {
                          _selectedPage = Page.el_makasi;
                        });
                      },
                      icon: Icon(
                        Icons.arrow_drop_down,
                        color:
                            _selectedPage == Page.el_makasi ? active : notActive,
                      ),
                      label: const Text(
                        "Tohum",
                        style: TextStyle(color: AppColor.mainColor),
                      ),
                    ),
                    TextButton.icon(
                      onPressed: () {
                        setState(() {
                          _selectedPage = Page.gubre;
                        });
                      },
                      icon: Icon(
                        Icons.arrow_drop_down,
                        color: _selectedPage == Page.gubre ? active : notActive,
                      ),
                      label: const Text("Gübre",
                          style: TextStyle(color: AppColor.mainColor)),
                    ),
                    TextButton.icon(
                      onPressed: () {
                        setState(() {
                          _selectedPage = Page.ilac;
                        });
                      },
                      icon: Icon(
                        Icons.arrow_drop_down,
                        color: _selectedPage == Page.ilac ? active : notActive,
                      ),
                      label: const Text("İlaç",
                          style: TextStyle(color: AppColor.mainColor)),
                    ),
                    TextButton.icon(
                      onPressed: () {
                        setState(() {
                          _selectedPage = Page.tohum;
                        });
                      },
                      icon: Icon(
                        Icons.arrow_drop_down,
                        color: _selectedPage == Page.tohum ? active : notActive,
                      ),
                      label: const Text("Makineler",
                          style: TextStyle(color: AppColor.mainColor)),
                    ),
                    TextButton.icon(
                      onPressed: () {
                        setState(() {
                          _selectedPage = Page.makine;
                        });
                      },
                      icon: Icon(
                        Icons.arrow_drop_down,
                        color: _selectedPage == Page.makine ? active : notActive,
                      ),
                      label: const Text("El makası",
                          style: TextStyle(color: AppColor.mainColor)),
                    ),
                  ],
                ),
              ),
            ),]
          ),
        ),

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

神经大条 2025-02-03 03:32:55

在页面中列出列表,然后在Onpressed中选择索引。

make a list within pages and select them with index in onPressed.

画骨成沙 2025-02-03 03:32:55

扩展是以有效方式进行此事情的最佳方法。

ExpansionTile(
                  title: Text("Ilac",
                      style: TextStyle(color:AppColor.mainColor)),
                  children: [
                    // here show 4 sub-categories, as pre UI design
                    Container(),
                    Container(),
                  ],
                ),

ExpansionTile is the best way to do this thing in an effective manner.

ExpansionTile(
                  title: Text("Ilac",
                      style: TextStyle(color:AppColor.mainColor)),
                  children: [
                    // here show 4 sub-categories, as pre UI design
                    Container(),
                    Container(),
                  ],
                ),
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文