feat: pm: share video

Closes #693

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-25 11:52:12 +08:00
parent 738cd61825
commit afe812e2be
33 changed files with 7972 additions and 111 deletions

View File

@@ -16,7 +16,7 @@ extension OrderTypeExt on OrderType {
class FollowChildController
extends CommonListController<FollowDataModel, FollowItemModel> {
FollowChildController(this.controller, this.mid, this.tagid);
final FollowController controller;
final FollowController? controller;
final int? tagid;
final int mid;
@@ -35,15 +35,17 @@ class FollowChildController
@override
bool customHandleResponse(bool isRefresh, Success<FollowDataModel> response) {
try {
if (controller.isOwner &&
tagid == null &&
isRefresh &&
controller.followState.value is Success) {
controller.tabs[0].count = response.response.total;
controller.tabs.refresh();
}
} catch (_) {}
if (controller != null) {
try {
if (controller!.isOwner &&
tagid == null &&
isRefresh &&
controller!.followState.value is Success) {
controller!.tabs[0].count = response.response.total;
controller!.tabs.refresh();
}
} catch (_) {}
}
return false;
}

View File

@@ -6,6 +6,7 @@ import 'package:PiliPlus/models/follow/result.dart';
import 'package:PiliPlus/pages/follow/child_controller.dart';
import 'package:PiliPlus/pages/follow/controller.dart';
import 'package:PiliPlus/pages/follow/widgets/follow_item.dart';
import 'package:PiliPlus/pages/video/detail/share/view.dart' show UserModel;
import 'package:PiliPlus/utils/utils.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -13,14 +14,16 @@ import 'package:get/get.dart';
class FollowChildPage extends StatefulWidget {
const FollowChildPage({
super.key,
required this.controller,
this.controller,
required this.mid,
this.tagid,
this.onSelect,
});
final FollowController controller;
final FollowController? controller;
final int mid;
final int? tagid;
final ValueChanged<UserModel>? onSelect;
@override
State<FollowChildPage> createState() => _FollowChildPageState();
@@ -35,7 +38,8 @@ class _FollowChildPageState extends State<FollowChildPage>
@override
Widget build(BuildContext context) {
super.build(context);
if (widget.controller.isOwner && widget.tagid == null) {
if (widget.onSelect != null ||
(widget.controller?.isOwner == true && widget.tagid == null)) {
return Scaffold(
backgroundColor: Colors.transparent,
body: _child,
@@ -90,7 +94,8 @@ class _FollowChildPageState extends State<FollowChildPage>
}
return FollowItem(
item: loadingState.response![index],
isOwner: widget.controller.isOwner,
isOwner: widget.controller?.isOwner,
onSelect: widget.onSelect,
callback: (attr) {
List<FollowItemModel> list =
(_followController.loadingState.value as Success)
@@ -113,5 +118,6 @@ class _FollowChildPageState extends State<FollowChildPage>
}
@override
bool get wantKeepAlive => widget.controller.tabController != null;
bool get wantKeepAlive =>
widget.onSelect != null || widget.controller?.tabController != null;
}

View File

@@ -1,3 +1,4 @@
import 'package:PiliPlus/pages/video/detail/share/view.dart' show UserModel;
import 'package:PiliPlus/utils/request_utils.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -10,12 +11,14 @@ class FollowItem extends StatelessWidget {
final FollowItemModel item;
final bool? isOwner;
final ValueChanged? callback;
final ValueChanged<UserModel>? onSelect;
const FollowItem({
super.key,
required this.item,
this.callback,
this.isOwner,
this.onSelect,
});
@override
@@ -23,9 +26,19 @@ class FollowItem extends StatelessWidget {
String heroTag = Utils.makeHeroTag(item.mid);
return ListTile(
onTap: () {
feedBack();
Get.toNamed('/member?mid=${item.mid}',
arguments: {'face': item.face, 'heroTag': heroTag});
if (onSelect != null) {
onSelect!.call(
UserModel(
mid: item.mid!,
name: item.uname!,
avatar: item.face!,
),
);
} else {
feedBack();
Get.toNamed('/member?mid=${item.mid}',
arguments: {'face': item.face, 'heroTag': heroTag});
}
},
leading: Stack(
clipBehavior: Clip.none,