Draggable Fab generated with Chat GPT

pub package Test codecov License: MIT

Features

Drag the fab wherever you want.

Getting started

Add draggable fab to your pubspec

draggable_fab: 0.0.2

Usage

use like normal fab :

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  final String title;

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

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            const Text(
              'You have pushed the button this many times:',
            ),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headline4,
            ),
          ],
        ),
      ),
      floatingActionButton: DraggableFab(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        iconData: Icons.add,
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Libraries

gpt_draggable_fab