draggable_floating_button 0.1.1

  • README.md
  • Example
  • Installing
  • Versions
  • new78

draggable_floating_button #

We all like the Floating Action Button Widget, but how can it be better?

Well, we made a Draggable Floating Action Button!

You can use it to make the user interact in crazy and unexpected ways with your application.

How Can I Get This Widget? #

  1. Add draggable_floating_button to your pubspec.yaml file
  2. When the notification bar pops up in Android Studio prompting you to get Packages, do so

Get Packages

  1. Add an import statement in your Dart code like so, import 'package:draggable_floating_button/draggable_floating_button.dart';
  2. You are ready to create draggable floating actions buttons

Usage #

          offset: new Offset(200, 200),
          backgroundColor: Theme.of(context).accentColor,
          child: new Icon(
               color: lightDfabColor,
          onPressed: () => foo(),
          appContext: context,
          appBar: appBar,
          data: 'your_data',

The Draggable Floating Action Button (or DFAB), can be created just like the Floating Action Button, but it has a few features in addition:

  • You need to pass in an Offset object, to letting the button know where to position itself

  • You need to pass in the context and appBar of your application in order for the button to calculate correctly which where it has been dragged to across the application.

  • The data field works in a similar fashion it works in a Draggable widget

[0.1.1] - 20/4/2019.

Added support for mini draggable floating button

[0.1.0] - 1/4/2019.

Increased version to 0.1.0 since this project is no longer experimental

[0.0.5] - 31/3/2019.

Shorter description and adding Tomer Ben Rachel as an author

[0.0.3] - 30/3/2019.

Example file was added. Package description has more data


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

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.

  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Draggable FAB Demo',
      home: new MyHomePage(title: 'Flutter Draggable FAB Demo'),

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

  final String title;

  _MyHomePageState createState() => _MyHomePageState();

class _MyHomePageState extends State<MyHomePage> {
  AppBar appBar;
  bool accepted = false;

  Widget build(BuildContext context) {
    appBar = getAppBar();

    return Scaffold(
        appBar: appBar,
        body: Stack(children: <Widget>[
              data: 'dfab_demo',
              offset: new Offset(100, 100),
              backgroundColor: Theme.of(context).accentColor,
              child: new Icon(
                color: Colors.yellow,
              onPressed: () => print('pressed'),
              appContext: context,
              appBar: appBar)

  getAppBar() {
    return AppBar(
      title: Text(widget.title),

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  draggable_floating_button: ^0.1.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:draggable_floating_button/draggable_floating_button.dart';
Version Uploaded Documentation Archive
0.1.1 Apr 19, 2019 Go to the documentation of draggable_floating_button 0.1.1 Download draggable_floating_button 0.1.1 archive
0.1.0 Apr 1, 2019 Go to the documentation of draggable_floating_button 0.1.0 Download draggable_floating_button 0.1.0 archive
0.0.5 Mar 31, 2019 Go to the documentation of draggable_floating_button 0.0.5 Download draggable_floating_button 0.0.5 archive
0.0.4 Mar 31, 2019 Go to the documentation of draggable_floating_button 0.0.4 Download draggable_floating_button 0.0.4 archive
0.0.3 Mar 30, 2019 Go to the documentation of draggable_floating_button 0.0.3 Download draggable_floating_button 0.0.3 archive
0.0.2 Mar 26, 2019 Go to the documentation of draggable_floating_button 0.0.2 Download draggable_floating_button 0.0.2 archive
0.0.1 Mar 26, 2019 Go to the documentation of draggable_floating_button 0.0.1 Download draggable_floating_button 0.0.1 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Apr 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.4.7


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies