mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt remove sc
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -269,6 +269,10 @@ class _CustomGridViewDelegate extends MultiChildLayoutDelegate {
|
||||
|
||||
@override
|
||||
bool shouldRelayout(_CustomGridViewDelegate oldDelegate) {
|
||||
return space != oldDelegate.space || itemCount != oldDelegate.itemCount;
|
||||
return space != oldDelegate.space ||
|
||||
itemCount != oldDelegate.itemCount ||
|
||||
column != oldDelegate.column ||
|
||||
width != oldDelegate.width ||
|
||||
height != oldDelegate.height;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,13 +23,13 @@ class SuperChatCard extends StatefulWidget {
|
||||
|
||||
class _SuperChatCardState extends State<SuperChatCard> {
|
||||
Timer? _timer;
|
||||
RxInt _remains = 0.obs;
|
||||
RxInt? _remains;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.item.expired) {
|
||||
_onRemove();
|
||||
_remove();
|
||||
return;
|
||||
}
|
||||
final now = DateTime.now().millisecondsSinceEpoch ~/ 1000;
|
||||
@@ -38,10 +38,16 @@ class _SuperChatCardState extends State<SuperChatCard> {
|
||||
_remains = offset.obs;
|
||||
_timer = Timer.periodic(const Duration(seconds: 1), _callback);
|
||||
} else {
|
||||
_onRemove();
|
||||
_remove();
|
||||
}
|
||||
}
|
||||
|
||||
void _remove() {
|
||||
WidgetsBinding.instance.addPostFrameCallback(
|
||||
(_) => Future.delayed(const Duration(seconds: 1), _onRemove),
|
||||
);
|
||||
}
|
||||
|
||||
void _onRemove() {
|
||||
widget
|
||||
..item.expired = true
|
||||
@@ -49,9 +55,9 @@ class _SuperChatCardState extends State<SuperChatCard> {
|
||||
}
|
||||
|
||||
void _callback(_) {
|
||||
final remains = _remains.value;
|
||||
final remains = _remains!.value;
|
||||
if (remains > 0) {
|
||||
_remains.value = remains - 1;
|
||||
_remains!.value = remains - 1;
|
||||
} else {
|
||||
_cancelTimer();
|
||||
_onRemove();
|
||||
@@ -120,12 +126,13 @@ class _SuperChatCardState extends State<SuperChatCard> {
|
||||
],
|
||||
),
|
||||
),
|
||||
Obx(
|
||||
() => Text(
|
||||
_remains.toString(),
|
||||
style: const TextStyle(fontSize: 14, color: Colors.grey),
|
||||
if (_remains != null)
|
||||
Obx(
|
||||
() => Text(
|
||||
_remains.toString(),
|
||||
style: const TextStyle(fontSize: 14, color: Colors.grey),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -254,7 +254,7 @@ class _LiveRoomPageState extends State<LiveRoomPage>
|
||||
"id": Utils.generateRandomString(8),
|
||||
"price": 66,
|
||||
"end_time":
|
||||
DateTime.now().millisecondsSinceEpoch ~/ 1000 + 5,
|
||||
DateTime.now().millisecondsSinceEpoch ~/ 1000 - 5,
|
||||
"message": Utils.generateRandomString(55),
|
||||
"user_info": {
|
||||
"face": "",
|
||||
|
||||
@@ -89,7 +89,7 @@ class LiveRoomChatPanel extends StatelessWidget {
|
||||
"id": Utils.generateRandomString(8),
|
||||
"price": 66,
|
||||
"end_time":
|
||||
DateTime.now().millisecondsSinceEpoch ~/ 1000 + 5,
|
||||
DateTime.now().millisecondsSinceEpoch ~/ 1000 - 5,
|
||||
"message": "message message message message message",
|
||||
"user_info": {
|
||||
"face": "",
|
||||
|
||||
@@ -69,7 +69,6 @@ class SSearchController extends GetxController
|
||||
|
||||
// suggestion
|
||||
final bool searchSuggestion = Pref.searchSuggestion;
|
||||
|
||||
late final RxList<SearchSuggestItem> searchSuggestList;
|
||||
|
||||
// trending
|
||||
|
||||
Reference in New Issue
Block a user