use ReorderableDelayedDragStartListener for mobile

Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
21pages 2023-06-21 13:58:25 +08:00
parent eababdcf79
commit 0894ae554e
2 changed files with 11 additions and 2 deletions

View File

@ -37,7 +37,6 @@ class _MyGroupState extends State<MyGroup> {
});
Future<Widget> buildBody(BuildContext context) async {
gFFI.groupModel.pull();
return Obx(() {
if (gFFI.groupModel.groupLoading.value ||
gFFI.groupModel.peerLoading.value) {

View File

@ -125,6 +125,16 @@ class _PeerTabPageState extends State<PeerTabPage>
}
Widget _createSwitchBar(BuildContext context) {
getListener({required Key key, required Widget child, required int index}) {
if (isMobile) {
return ReorderableDelayedDragStartListener(
key: key, child: child, index: index);
} else {
return ReorderableDragStartListener(
key: key, child: child, index: index);
}
}
final model = Provider.of<PeerTabModel>(context);
int indexCounter = -1;
return ReorderableListView(
@ -137,7 +147,7 @@ class _PeerTabPageState extends State<PeerTabPage>
scrollController: model.sc,
children: model.visibleOrderedTabs.map((t) {
indexCounter++;
return ReorderableDragStartListener(
return getListener(
key: ValueKey(t),
index: indexCounter,
child: VisibilityDetector(