LoginSignup
29
15

More than 5 years have passed since last update.

【Flutter】任意のWidgetにクリックイベントをつける

Last updated at Posted at 2018-04-01

Flutterアプリで任意のWidgetにクリックイベントをつけるやり方メモです。

結論

GestureDetector widgetを使う。

サンプルコード

GestureDetector(
  onTap: () {
    print("onTap called.");
  },
  child: Text("foo"),
),

環境

  • Flutter 0.1.5
  • Dart 2.0.0-dev.28.0

Link

user interface - Flutter - Container onPressed? - Stack Overflow
https://stackoverflow.com/questions/43692923/flutter-container-onpressed

29
15
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
29
15