0
0

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

みなさん こんにちわ。 いせきです。

Flutterをやり始めてから2ヶ月くらい経過しています。長期インターンからSwiftからFlutterに切り替えました。
仕事の業務だけでなく、個人開発をすることでどんどん成長している気がします。。

手っ取り早く書きますね。

上下左右にフリックする方法

Flutterのパッケージには色々な種類がありました。その中でも上下左右フリックができるものを紹介します。

swipe_gesture_recognizer

①インストールする

  dependencies:
  swipe_gesture_recognizer: ^0.0.2

記載後に 「 pub get 」 を押すこと(押さないと、反映されない。)

②インポートする

 import 'package:swipe_gesture_recognizer/swipe_gesture_recognizer.dart';

使用するファイルにインポートする。

③実際に使ってみる。

SwipeGestureRecognizer(


   onSwipeLeft: () {
    //左にスワイプした時の動作
    },
   onSwipeRight: () {
    //右にスワイプした時の動作
    },
   onSwipeUp: () {
    //上にスワイプした時の動作
   },
   onSwipeDown: () {
    //したにスワイプした時の動作
   },
),

⑤最後に

おそらく、そのまま使ったら、どこかがエラーになるかもしれないので、Containerとかを追加してから直してみてね。始めたばかりですが、どんどん書いていこうと思うので、暖かく見守ってください。

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?