mod: merge tabbar from pilipala

This commit is contained in:
bggRGjQaUbCoE
2024-08-26 20:40:41 +08:00
parent 448d554f03
commit 50c911a6a6
4 changed files with 137 additions and 53 deletions

View File

@@ -1,3 +1,4 @@
import 'package:PiliPalaX/utils/extension.dart';
import 'package:easy_debounce/easy_throttle.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -26,7 +27,7 @@ class VideoReplyController extends GetxController {
String nextOffset = "";
bool isLoadingMore = false;
RxString noMore = ''.obs;
RxInt count = 0.obs;
RxInt count = (-1).obs;
// 当前回复的回复
ReplyItemModel? currentReplyItem;
@@ -77,7 +78,6 @@ class VideoReplyController extends GetxController {
if (res['data'].cursor.isEnd == true) {
noMore.value = '没有更多了';
}
} else {
// 未登录状态replies可能返回null
noMore.value = nextOffset == "" && type == 'init' ? '还没有评论' : '没有更多了';
@@ -126,4 +126,8 @@ class VideoReplyController extends GetxController {
queryReplyList(type: 'init');
});
}
void animToTop() {
scrollController.animToTop();
}
}

View File

@@ -57,9 +57,7 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
VideoReplyController(widget.oid, widget.rpid.toString(), replyLevel),
tag: widget.rpid.toString());
} else {
_videoReplyController = Get.put(
VideoReplyController(widget.oid, '', replyLevel),
tag: heroTag);
_videoReplyController = Get.find<VideoReplyController>(tag: heroTag);
}
fabAnimationCtr = AnimationController(
@@ -135,38 +133,20 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
key: const PageStorageKey<String>('评论'),
slivers: <Widget>[
SliverPersistentHeader(
pinned: true,
floating: false,
pinned: false,
floating: true,
delegate: _MySliverPersistentHeaderDelegate(
child: Container(
height: 45,
height: 40,
padding: const EdgeInsets.fromLTRB(12, 0, 6, 0),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.background,
border: Border(
bottom: BorderSide(
color: Theme.of(context)
.colorScheme
.outline
.withOpacity(0.1)),
),
),
color: Theme.of(context).colorScheme.surface,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Obx(
() => AnimatedSwitcher(
duration: const Duration(milliseconds: 400),
transitionBuilder:
(Widget child, Animation<double> animation) {
return ScaleTransition(
scale: animation, child: child);
},
child: Text(
'${_videoReplyController.count.value}条回复',
key: ValueKey<int>(
_videoReplyController.count.value),
),
() => Text(
'${_videoReplyController.sortTypeLabel.value}评论',
style: const TextStyle(fontSize: 13),
),
),
SizedBox(
@@ -175,10 +155,12 @@ class _VideoReplyPanelState extends State<VideoReplyPanel>
onPressed: () =>
_videoReplyController.queryBySort(),
icon: const Icon(Icons.sort, size: 16),
label: Obx(() => Text(
_videoReplyController.sortTypeLabel.value,
style: const TextStyle(fontSize: 13),
)),
label: Obx(
() => Text(
_videoReplyController.sortTypeLabel.value,
style: const TextStyle(fontSize: 13),
),
),
),
)
],