mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-22 18:16:54 +08:00
opt slide dismiss
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:PiliPlus/utils/storage.dart';
|
import 'package:PiliPlus/utils/storage.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
@@ -58,7 +60,7 @@ abstract class CommonSlidePageState<T extends CommonSlidePage> extends State<T>
|
|||||||
|
|
||||||
void onDismiss() {
|
void onDismiss() {
|
||||||
if (isSliding == true) {
|
if (isSliding == true) {
|
||||||
if (_animController!.value * maxWidth >= 100) {
|
if (_animController!.value * maxWidth + downPos!.dx >= 100) {
|
||||||
Get.back();
|
Get.back();
|
||||||
} else {
|
} else {
|
||||||
_animController!.reverse();
|
_animController!.reverse();
|
||||||
@@ -82,11 +84,11 @@ abstract class CommonSlidePageState<T extends CommonSlidePage> extends State<T>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (isSliding == true) {
|
} else if (isSliding == true) {
|
||||||
if (localPosition.dx < downPos!.dx) {
|
if (localPosition.dx < 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_animController!.value =
|
_animController!.value =
|
||||||
(localPosition.dx - downPos!.dx) / maxWidth;
|
max(0, (localPosition.dx - downPos!.dx)) / maxWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user