draggable_container 0.1.8+5
draggable_container: ^0.1.8+5

Flutter Android iOS web

A Draggable Widget Container. Each children is Draggable, Deletable and Fixable.

example/lib/main.dart

import 'package:flutter/material.dart';

import './demo1.dart';
import './demo2.dart';
import './demo3.dart';
import 'demo4.dart';

void main() {
//  debugPrintGestureArenaDiagnostics = true;
  runApp(MaterialApp(title: 'Draggable Container Demo', home: App()));
}

class App extends StatefulWidget {
  _AppState createState() => _AppState();
}

class _AppState extends State<App> {
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Draggable Container Demo')),
      body: ListView(children: <Widget>[
        Card(
          child: Padding(
            padding: EdgeInsets.only(left: 5, right: 5),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Container(
                  padding: EdgeInsets.only(top: 5),
                  child: Text(
                      'This demo is about the DraggableContainer widget in the Listview widget.\n'
                      'You can drag the children widget and do not scroll the ListView.\n'
                      'btw: Need long press to enter the draggable mode at first.'),
                ),
                RaisedButton(
                  child: Text('Demo 1'),
                  color: Colors.blue,
                  textColor: Colors.white,
                  onPressed: () {
                    Navigator.push(context,
                        MaterialPageRoute(builder: (_) => Demo1()));
                  },
                ),
              ],
            ),
          ),
        ),
        Card(
          child: Padding(
            padding: EdgeInsets.only(left: 5, right: 5),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Container(
                  padding: EdgeInsets.only(top: 5),
                  child: Text('Dynamic to display the functional button.'),
                ),
                RaisedButton(
                  child: Text('Demo 2'),
                  color: Colors.green,
                  textColor: Colors.white,
                  onPressed: () {
                    Navigator.push(context,
                        MaterialPageRoute(builder: (_) => Demo2()));
                  },
                ),
              ],
            ),
          ),
        ),
        Card(
          child: Padding(
            padding: EdgeInsets.only(left: 5, right: 5),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Container(
                  padding: EdgeInsets.only(top: 5),
                  child: Text('Show a confirm dialog before delete item.'),
                ),
                RaisedButton(
                  child: Text('Demo 3'),
                  color: Colors.orange,
                  textColor: Colors.white,
                  onPressed: () {
                    Navigator.push(context,
                        MaterialPageRoute(builder: (_) => Demo3()));
                  },
                ),
              ],
            ),
          ),
        ),
        Card(
          child: Padding(
            padding: EdgeInsets.only(left: 5, right: 5),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.start,
              crossAxisAlignment: CrossAxisAlignment.start,
              children: <Widget>[
                Container(
                  padding: EdgeInsets.only(top: 5),
                  child: Text('Manually add the slot, remove the slot'),
                ),
                RaisedButton(
                  child: Text('Demo 4'),
                  color: Colors.red,
                  textColor: Colors.white,
                  onPressed: () {
                    Navigator.push(context,
                        MaterialPageRoute(builder: (_) => Demo4()));
                  },
                ),
              ],
            ),
          ),
        ),
      ]),
    );
  }
}
0
likes
90
pub points
47%
popularity

A Draggable Widget Container. Each children is Draggable, Deletable and Fixable.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

gzlock88@gmail.com

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on draggable_container