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

A Flutter package for detecting left-edge swipe gestures with a curved line animation and back button.

example/lib/main.dart

// ignore_for_file: deprecated_member_use

import 'dart:ui';

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

void main() => runApp(
      MaterialApp(
        home: HomePage(),
        theme: ThemeData.light(),
        scrollBehavior: const MaterialScrollBehavior().copyWith(
          dragDevices: {
            PointerDeviceKind.touch,
            PointerDeviceKind.mouse,
            PointerDeviceKind.trackpad,
          },
        ),
      ),
    );

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

  @override
  State<HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Edge Swipe Example'),
        centerTitle: true,
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            ElevatedButton(
              onPressed: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(
                    builder: (context) => Scaffold(
                      body: EdgeSwipe(
                        curvedLineColor:
                            Theme.of(context).brightness == Brightness.dark
                                ? Theme.of(context).colorScheme.surface
                                : Colors.white,
                        curvedLineShadowColor: Theme.of(context)
                            .colorScheme
                            .secondary
                            .withOpacity(.2),
                        onSwipeLeft: () {
                          Navigator.pop(context);
                        },
                        child: const Center(
                          child: Text(
                            'Swipe left to go back',
                            style: TextStyle(
                              fontSize: 24,
                            ),
                          ),
                        ),
                      ),
                    ),
                  ),
                );
              },
              child: const Text(
                'Go to Example',
                style: TextStyle(
                  fontSize: 24,
                ),
              ),
              style: ElevatedButton.styleFrom(
                padding: const EdgeInsets.symmetric(
                  horizontal: 24,
                  vertical: 12,
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
4
likes
155
points
40
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package for detecting left-edge swipe gestures with a curved line animation and back button.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on edge_swipe