Realank/draggable_flutter_list

The ItemList overlaps the appbar

Closed this issue · 3 comments

When i drag a item and move to appbar, the item overlaps.

I tested iOS and android platform, both normal.
which operation system and version did you use for test?
and please show your codes in build() method

I tested in Android 5.1

screen-android

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

void main() {
  runApp(new TestApp());
}

class TestApp extends StatelessWidget {
  TestApp({Key key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(primarySwatch: Colors.blue),
      home: new MyHomePage(
        title: 'Flutter Demo Home Page',
        key: key,
      ),
    );
  }
}

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

  @override
  MyHomePageState createState() => new MyHomePageState();
}

class MyHomePageState extends State<MyHomePage> {
  List<String> items = [
    '0',
    '1',
    'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.',
    '3',
    '4',
    'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.',
    '6',
    '7',
    '8',
    '9',
    '10',
    '11',
    '12',
    '13',
    '14',
    '15',
  ];
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text(widget.title),
      ),
      body: new DragAndDropList(
        items.length,
        itemBuilder: (BuildContext context, index) {
          return new SizedBox(
            child: new Card(
              child: Column(
                children: <Widget>[
                  ListTile(
                    dense: true,
                    isThreeLine: true,
                    trailing: Icon(
                        Icons.menu,
                        color: Colors.blue.shade300,
                      ),
                    leading: CircleAvatar(
                      backgroundColor: Colors.brown,
                      child: Text(
                        'AH',
                        style: TextStyle(
                          color: Colors.white,
                        ),
                      ),
                    ),
                    title: Text("Some Text"),
                    subtitle: Text("Some Text"),
                  ),
                ],
              ),
            ),
          );
        },
        onDragFinish: (before, after) {
          print('on drag finish $before $after');
          String data = items[before];
          items.removeAt(before);
          items.insert(after, data);
        },
        canDrag: (index) {
          print('can drag $index');
          return index != 3; //disable drag for index 3
        },
        canBeDraggedTo: (one, two) => true,
        dragElevation: 8.0,
      ),
    );
  }
} ```

hi @Kami-Juan , I updated codes, and hopefully can fix this issue, please try it