four_swipe_direction 0.0.4 copy "four_swipe_direction: ^0.0.4" to clipboard
four_swipe_direction: ^0.0.4 copied to clipboard

A new Flutter package project.

example/example.dart

import 'package:flutter/material.dart';
import 'package:four_swipe_direction/four_swipe_direction.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key}) : super(key: key);

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child:  Center(
          child: FourSwipeDirection(
            swipeUp: () {
              print('上');
            },
            swipeDown: (){
              print('下');
            },
            swipeLeft: () {
              print('左');
            },
            swipeRight: () {
              print('右');
            },
            child: Container(
              color: Colors.indigo,
              width: 100,
              height: 100,
            ),
          ),
        ),
      ),
    );
  }
}
4
likes
120
pub points
0%
popularity

Publisher

unverified uploader

A new Flutter package project.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on four_swipe_direction