Draggable Fab generated with Chat GPT

pub package Test codecov License: MIT


Drag the fab wherever you want.

Getting started

Add draggable fab to your pubspec

draggable_fab: 0.0.2


use like normal fab :

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

  final String title;

  State<MyHomePage> createState() => _MyHomePageState();

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

  void _incrementCounter() {
    setState(() {

  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:',
              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.