We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem: After dragging, scroll to the top
want : After dragging, don't scroll to the top
import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_draggable_gridview/flutter_draggable_gridview.dart'; class TPPinJieHomePage extends StatefulWidget { const TPPinJieHomePage({super.key}); @override State<TPPinJieHomePage> createState() => _TPPinJieHomePageState(); } class _TPPinJieHomePageState extends State<TPPinJieHomePage> { final List<int> _datalist = []; @override void initState() { super.initState(); for (int i = 0; i < 50; i++) { _datalist.add(i); } } @override Widget build(BuildContext context) { return Scaffold( appBar: const CupertinoNavigationBar( middle: Text("drag"), ), body: DraggableGridViewBuilder( gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 4, crossAxisSpacing: 1, mainAxisSpacing: 1, ), dragCompletion: (List<DraggableGridItem> list, int beforeIndex, int afterIndex) { print('onDragAccept: $beforeIndex -> $afterIndex'); int one = _datalist[beforeIndex]; if (afterIndex > beforeIndex) { _datalist.insert(afterIndex + 1, one); _datalist.removeAt(beforeIndex); } else if (afterIndex < beforeIndex) { _datalist.insert(afterIndex, _datalist[beforeIndex]); _datalist.removeAt(beforeIndex + 1); } }, children: _getItems(), dragFeedback: (List<DraggableGridItem> list, int index) { return SizedBox( width: 100, height: 100, child: Container( decoration: BoxDecoration( border: Border.all(color: Colors.red, width: 2), ), child: list[index].child), ); }, )); } List<DraggableGridItem> _getItems() { List<DraggableGridItem> items = []; for (var one in _datalist) { items.add(DraggableGridItem( isDraggable: true, child: Container( color: Colors.orange, padding: const EdgeInsets.all(10), child: Center(child: Text("$one")), ), )); } items.add(DraggableGridItem( child: Container( color: Colors.orange, padding: const EdgeInsets.all(10), child: const Center(child: Text("picker")), ), )); return items; } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Problem: After dragging, scroll to the top
want : After dragging, don't scroll to the top
The text was updated successfully, but these errors were encountered: