5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Flutterでテキスト内リンクを作る

Posted at

#はじめに
業務でテキスト内リンクを作成するためにRichTextを使ったので、備忘録代わりにまとめてみます。

#動作イメージ
スクリーンショット 2021-02-26 16.19.09.png

#実装

RichText(
    text: TextSpan(children: [
  const TextSpan(
      text: 'お問合わせは',
      style: TextStyle(color: Colors.black)),
  TextSpan(
      text: 'こちら',
      style: const TextStyle(color: Colors.blue),
      recognizer: TapGestureRecognizer()
        ..onTap = () {
          // タップ時
        }),
  const TextSpan(
      text: 'からお願いします。',
      style: TextStyle(color: Colors.black))
]))

#その他
テキストの一部をイタリック体にしたり、下線を引くこともできるようです。

5
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?