extend_gesture_area 1.0.1 copy "extend_gesture_area: ^1.0.1" to clipboard
extend_gesture_area: ^1.0.1 copied to clipboard

Handling gestures outside the widget area

This package allows you to process gestures even if they were outside the widget (with a given padding), without changing widget size

Usage #

  1. Wrap gesture widget with ExtendGestureAreaConsumer and set gesturePadding

    import 'package:extend_gesture_area/extend_gesture_area.dart';
       
    ExtendGestureAreaConsumer(
           gesturePadding: 30,
           child: FloatingActionButton(
             onPressed: _incrementCounter,
             tooltip: 'Increment',
             child: const Icon(Icons.add),
           ),
         ),
    
  2. Wrap parent with ExtendGestureAreaDetector.
    Note: Parent should contain gesture widget and area around it (gesturePadding)

    import 'package:extend_gesture_area/extend_gesture_area.dart';
    
    @override
    Widget build(BuildContext context) {
    // Wrap Scaffold, because this widget is a parent of FloatingActionButton
    // and owns area around it
    return ExtendGestureAreaDetector(
       child: Scaffold(
         appBar: AppBar(
           title: Text(widget.title),
         ),
         body: Center(
           child: Column(
             mainAxisAlignment: MainAxisAlignment.center,
             children: [
    
    
               const Text(
                 'You have pushed the button this many times:',
               ),
               Text(
                 '$_counter',
                 style: Theme
                     .of(context)
                     .textTheme
                     .headlineMedium,
               ),
             ],
           ),
         ),
    floatingActionButton: ExtendGestureAreaConsumer(
           gesturePadding: 30,  // set gesture padding
           child: FloatingActionButton(
             onPressed: _incrementCounter,
             tooltip: 'Increment',
             child: const Icon(Icons.add),
           ),
         ),
       ),
     );
    }
    
7
likes
130
pub points
13%
popularity

Publisher

unverified uploader

Handling gestures outside the widget area

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on extend_gesture_area