mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
@@ -3,35 +3,18 @@ import 'package:PiliPlus/grpc/bilibili/main/community/reply/v1.pb.dart'
|
||||
import 'package:PiliPlus/grpc/reply.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/pages/common/reply_controller.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class MainReplyController extends ReplyController<MainListReply>
|
||||
with GetSingleTickerProviderStateMixin {
|
||||
class MainReplyController extends ReplyController<MainListReply> {
|
||||
late final int oid;
|
||||
late final int replyType;
|
||||
|
||||
@override
|
||||
int get sourceId => oid;
|
||||
|
||||
bool _showFab = true;
|
||||
|
||||
late final AnimationController _fabAnimationCtr;
|
||||
late final Animation<Offset> fabAnim;
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
_fabAnimationCtr = AnimationController(
|
||||
vsync: this,
|
||||
duration: const Duration(milliseconds: 300),
|
||||
)..forward();
|
||||
fabAnim = _fabAnimationCtr.drive(
|
||||
Tween<Offset>(
|
||||
begin: const Offset(0.0, 2.0),
|
||||
end: Offset.zero,
|
||||
).chain(CurveTween(curve: Curves.easeInOut)),
|
||||
);
|
||||
final args = Get.arguments;
|
||||
oid = args['oid'];
|
||||
replyType = args['replyType'];
|
||||
@@ -39,20 +22,6 @@ class MainReplyController extends ReplyController<MainListReply>
|
||||
queryData();
|
||||
}
|
||||
|
||||
void showFab() {
|
||||
if (!_showFab) {
|
||||
_showFab = true;
|
||||
_fabAnimationCtr.forward();
|
||||
}
|
||||
}
|
||||
|
||||
void hideFab() {
|
||||
if (_showFab) {
|
||||
_showFab = false;
|
||||
_fabAnimationCtr.reverse();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<LoadingState<MainListReply>> customGetData() => ReplyGrpc.mainList(
|
||||
type: replyType,
|
||||
@@ -64,10 +33,4 @@ class MainReplyController extends ReplyController<MainListReply>
|
||||
|
||||
@override
|
||||
List<ReplyInfo>? getDataList(MainListReply response) => response.replies;
|
||||
|
||||
@override
|
||||
void onClose() {
|
||||
_fabAnimationCtr.dispose();
|
||||
super.onClose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user