【问题标题】:flutter show text when button is pressed按下按钮时颤动显示文本
【发布时间】:2021-04-26 20:30:55
【问题描述】:

我有一排文字写着terms of use 和一个按钮。我想显示一些数据,但也许我没有使用正确的关键字。我得到的只是如何更改按钮单击时的文本。

无论如何,我应该怎么做才能让用户在点击按钮时看到使用条款?

      Container(
        padding: EdgeInsets.only(top: 20),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: <Widget>[
            Text(
              "Terms of Use",
              style: TextStyle(
                color: Color(0xff18172b),
                fontSize: 18,
                fontFamily: "Poppins",
                fontWeight: FontWeight.w400,
              ),
            ),
            IconButton(
                iconSize: 18,
                onPressed: () {},
                icon: Icon(Icons.arrow_forward_ios))
          ],
        ),
      ),

【问题讨论】:

    标签: flutter


    【解决方案1】:

    您可以导航到包含条款或显示模式的另一个页面,如下所示:

                IconButton(
                    iconSize: 18,
                    onPressed: () async {
                      await showDialog(
                          barrierColor: Colors.black12.withOpacity(.6),
                          context: context,
                          builder: (_) {
                            return Dialog(
                              elevation: 0,
                              backgroundColor: Colors.transparent,
                              child: Container(
                                child: Text("TERMS"),
                              ),
                            );
                          });
                    },
                    icon: Icon(Icons.arrow_forward_ios))
    

    【讨论】:

    • 这将很好地显示条款
    • 是否可以在同一页面中进行?一旦应用程序与后端挂钩,所有数据都将来自protobuf 对象。我只想在container 下显示一些模拟数据。我也会为按钮添加一些动画。比如:right_arrow 会变成 down_arrow 等等。
    • @FahimHoque 你当然可以..检查我编辑的答案。
    猜你喜欢
    • 2020-04-07
    • 1970-01-01
    • 2021-10-18
    • 1970-01-01
    • 1970-01-01
    • 2023-03-17
    • 1970-01-01
    • 2021-05-26
    • 1970-01-01
    相关资源
    最近更新 更多