How to create a hyperlink in Flutter widget?

后端 未结 7 1145
一个人的身影
一个人的身影 2020-12-02 10:47

I would like to create a hyperlink to display in my Flutter app.

The hyper link should be embedded in a Text or similar text views like:

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-02 11:26

    You can wrap your Text in GestureDetector and handle click in onTap().

    GestureDetector(
      child: Text("Click here", style: TextStyle(decoration: TextDecoration.underline, color: Colors.blue)),
      onTap: () {
        // do what you need to do when "Click here" gets clicked
      }
    )
    

提交回复
热议问题