mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-19 08:36:17 +08:00
opt follow tab
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -3,6 +3,9 @@ import 'package:flutter/material.dart';
|
||||
|
||||
Widget get loadingWidget => const Center(child: CircularProgressIndicator());
|
||||
|
||||
Widget get linearLoading =>
|
||||
const SliverToBoxAdapter(child: LinearProgressIndicator());
|
||||
|
||||
Widget errorWidget({errMsg, onReload}) => HttpError(
|
||||
isSliver: false,
|
||||
errMsg: errMsg,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||
import 'package:PiliPlus/pages/fan/view.dart';
|
||||
import 'package:PiliPlus/pages/follow/child_view.dart';
|
||||
import 'package:PiliPlus/pages/follow/child/child_view.dart';
|
||||
import 'package:PiliPlus/pages/follow_search/view.dart';
|
||||
import 'package:PiliPlus/pages/share/view.dart' show UserModel;
|
||||
import 'package:PiliPlus/services/account_service.dart';
|
||||
|
||||
@@ -8,7 +8,6 @@ import 'package:PiliPlus/models/dynamics/up.dart';
|
||||
import 'package:PiliPlus/models_new/follow/list.dart';
|
||||
import 'package:PiliPlus/pages/common/common_controller.dart';
|
||||
import 'package:PiliPlus/pages/dynamics_tab/controller.dart';
|
||||
import 'package:PiliPlus/pages/dynamics_tab/view.dart';
|
||||
import 'package:PiliPlus/services/account_service.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
@@ -27,7 +26,6 @@ class DynamicsController extends GetxController
|
||||
RxInt mid = (-1).obs;
|
||||
late TabController tabController;
|
||||
Set<int> tempBannedList = <int>{};
|
||||
late List<Widget> tabsPageList;
|
||||
List<UpItem> hasUpdatedUps = <UpItem>[];
|
||||
int allFollowedUpsPage = 1;
|
||||
int allFollowedUpsTotal = 0;
|
||||
@@ -57,9 +55,6 @@ class DynamicsController extends GetxController
|
||||
initialIndex: GStorage.setting
|
||||
.get(SettingBoxKey.defaultDynamicType, defaultValue: 0),
|
||||
);
|
||||
tabsPageList = DynamicsTabType.values
|
||||
.map((e) => DynamicsTabPage(dynamicsType: e))
|
||||
.toList();
|
||||
|
||||
queryFollowUp();
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:PiliPlus/models/common/dynamic/up_panel_position.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/controller.dart';
|
||||
import 'package:PiliPlus/pages/dynamics/widgets/up_panel.dart';
|
||||
import 'package:PiliPlus/pages/dynamics_create/view.dart';
|
||||
import 'package:PiliPlus/pages/dynamics_tab/view.dart';
|
||||
import 'package:PiliPlus/utils/storage.dart';
|
||||
import 'package:easy_debounce/easy_throttle.dart';
|
||||
import 'package:flutter/material.dart' hide DraggableScrollableSheet;
|
||||
@@ -164,7 +165,9 @@ class _DynamicsPageState extends State<DynamicsPage>
|
||||
Expanded(
|
||||
child: videoTabBarView(
|
||||
controller: _dynamicsController.tabController,
|
||||
children: _dynamicsController.tabsPageList,
|
||||
children: DynamicsTabType.values
|
||||
.map((e) => DynamicsTabPage(dynamicsType: e))
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
||||
import 'package:PiliPlus/common/widgets/loading_widget/loading_widget.dart';
|
||||
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models_new/dynamic/dyn_topic_top/topic_item.dart';
|
||||
@@ -43,7 +44,7 @@ class _DynTopicRcmdPageState extends State<DynTopicRcmdPage> {
|
||||
|
||||
Widget _buildBody(LoadingState<List<TopicItem>?> loadingState) {
|
||||
return switch (loadingState) {
|
||||
Loading() => const SliverToBoxAdapter(child: LinearProgressIndicator()),
|
||||
Loading() => linearLoading,
|
||||
Success(:var response) => response?.isNotEmpty == true
|
||||
? SliverList.builder(
|
||||
itemCount: response!.length,
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/common/follow_order_type.dart';
|
||||
import 'package:PiliPlus/models_new/follow/list.dart';
|
||||
import 'package:PiliPlus/pages/follow/child_controller.dart';
|
||||
import 'package:PiliPlus/pages/follow/child/child_controller.dart';
|
||||
import 'package:PiliPlus/pages/follow/controller.dart';
|
||||
import 'package:PiliPlus/pages/follow/widgets/follow_item.dart';
|
||||
import 'package:PiliPlus/pages/share/view.dart' show UserModel;
|
||||
@@ -15,12 +15,14 @@ import 'package:get/get.dart';
|
||||
class FollowChildPage extends StatefulWidget {
|
||||
const FollowChildPage({
|
||||
super.key,
|
||||
this.tag,
|
||||
this.controller,
|
||||
required this.mid,
|
||||
this.tagid,
|
||||
this.onSelect,
|
||||
});
|
||||
|
||||
final String? tag;
|
||||
final FollowController? controller;
|
||||
final int mid;
|
||||
final int? tagid;
|
||||
@@ -34,7 +36,8 @@ class _FollowChildPageState extends State<FollowChildPage>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
late final _followController = Get.put(
|
||||
FollowChildController(widget.controller, widget.mid, widget.tagid),
|
||||
tag: Utils.generateRandomString(8));
|
||||
tag: '${widget.tag ?? Utils.generateRandomString(8)}${widget.tagid}',
|
||||
);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -62,6 +65,7 @@ class _FollowChildPageState extends State<FollowChildPage>
|
||||
Widget get _child => refreshIndicator(
|
||||
onRefresh: _followController.onRefresh,
|
||||
child: CustomScrollView(
|
||||
controller: _followController.scrollController,
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
slivers: [
|
||||
SliverPadding(
|
||||
@@ -3,7 +3,8 @@ import 'package:PiliPlus/common/widgets/loading_widget/loading_widget.dart';
|
||||
import 'package:PiliPlus/common/widgets/scroll_physics.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models/member/tags.dart';
|
||||
import 'package:PiliPlus/pages/follow/child_view.dart';
|
||||
import 'package:PiliPlus/pages/follow/child/child_controller.dart';
|
||||
import 'package:PiliPlus/pages/follow/child/child_view.dart';
|
||||
import 'package:PiliPlus/pages/follow/controller.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -18,10 +19,9 @@ class FollowPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _FollowPageState extends State<FollowPage> {
|
||||
final FollowController _followController = Get.put(
|
||||
FollowController(),
|
||||
tag: Utils.generateRandomString(8),
|
||||
);
|
||||
final _tag = Utils.generateRandomString(8);
|
||||
late final FollowController _followController =
|
||||
Get.put(FollowController(), tag: _tag);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -69,11 +69,17 @@ class _FollowPageState extends State<FollowPage> {
|
||||
),
|
||||
body: _followController.isOwner
|
||||
? Obx(() => _buildBody(_followController.followState.value))
|
||||
: FollowChildPage(
|
||||
controller: _followController, mid: _followController.mid),
|
||||
: _childPage(),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _childPage([MemberTagItemModel? item]) => FollowChildPage(
|
||||
tag: _tag,
|
||||
controller: _followController,
|
||||
mid: _followController.mid,
|
||||
tagid: item?.tagid,
|
||||
);
|
||||
|
||||
bool _isCustomTag(int? tagid) {
|
||||
return tagid != null && tagid != 0 && tagid != -10 && tagid != -2;
|
||||
}
|
||||
@@ -97,7 +103,11 @@ class _FollowPageState extends State<FollowPage> {
|
||||
int? count = item.count;
|
||||
if (_isCustomTag(item.tagid)) {
|
||||
return GestureDetector(
|
||||
onLongPress: () => _onHandleTag(index, item),
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onLongPress: () {
|
||||
Feedback.forLongPress(context);
|
||||
_onHandleTag(index, item);
|
||||
},
|
||||
child: Tab(
|
||||
child: Row(
|
||||
children: [
|
||||
@@ -117,9 +127,13 @@ class _FollowPageState extends State<FollowPage> {
|
||||
onTap: (value) {
|
||||
if (!_followController.tabController!.indexIsChanging) {
|
||||
final item = _followController.tabs[value];
|
||||
if (_isCustomTag(item.tagid)) {
|
||||
_onHandleTag(value, item);
|
||||
}
|
||||
// if (_isCustomTag(item.tagid)) {
|
||||
// _onHandleTag(value, item);
|
||||
// }
|
||||
try {
|
||||
Get.find<FollowChildController>(tag: '$_tag${item.tagid}')
|
||||
.animateToTop();
|
||||
} catch (_) {}
|
||||
}
|
||||
},
|
||||
),
|
||||
@@ -129,24 +143,13 @@ class _FollowPageState extends State<FollowPage> {
|
||||
color: Colors.transparent,
|
||||
child: tabBarView(
|
||||
controller: _followController.tabController,
|
||||
children: _followController.tabs
|
||||
.map(
|
||||
(item) => FollowChildPage(
|
||||
controller: _followController,
|
||||
mid: _followController.mid,
|
||||
tagid: item.tagid,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
children: _followController.tabs.map(_childPage).toList(),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Error() => FollowChildPage(
|
||||
controller: _followController,
|
||||
mid: _followController.mid,
|
||||
),
|
||||
Error() => _childPage(),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
||||
import 'package:PiliPlus/common/widgets/loading_widget/loading_widget.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models_new/coin_log/list.dart';
|
||||
import 'package:PiliPlus/pages/member_coin_log/controller.dart';
|
||||
@@ -45,7 +46,7 @@ class _MemberCoinLogPageState extends State<MemberCoinLogPage> {
|
||||
|
||||
Widget _buildBody(LoadingState<List<CoinLogItem>?> loadingState) {
|
||||
return switch (loadingState) {
|
||||
Loading() => const SliverToBoxAdapter(child: LinearProgressIndicator()),
|
||||
Loading() => linearLoading,
|
||||
Success(:var response) => response?.isNotEmpty == true
|
||||
? Builder(
|
||||
builder: (context) {
|
||||
|
||||
@@ -205,7 +205,7 @@ class _PgcIndexPageState extends State<PgcIndexPage>
|
||||
|
||||
Widget _buildList(LoadingState<List<PgcIndexItem>?> loadingState) {
|
||||
return switch (loadingState) {
|
||||
Loading() => const SliverToBoxAdapter(child: LinearProgressIndicator()),
|
||||
Loading() => linearLoading,
|
||||
Success(:var response) => response?.isNotEmpty == true
|
||||
? SliverGrid(
|
||||
gridDelegate: SliverGridDelegateWithExtentAndRatio(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
|
||||
import 'package:PiliPlus/common/widgets/loading_widget/loading_widget.dart';
|
||||
import 'package:PiliPlus/common/widgets/refresh_indicator.dart';
|
||||
import 'package:PiliPlus/http/loading_state.dart';
|
||||
import 'package:PiliPlus/models_new/search/search_trending/list.dart';
|
||||
@@ -148,7 +149,7 @@ class _SearchTrendingPageState extends State<SearchTrendingPage> {
|
||||
color: theme.colorScheme.outline.withValues(alpha: 0.1),
|
||||
);
|
||||
return switch (loadingState) {
|
||||
Loading() => const SliverToBoxAdapter(child: LinearProgressIndicator()),
|
||||
Loading() => linearLoading,
|
||||
Success(:var response) => response?.isNotEmpty == true
|
||||
? SliverList.separated(
|
||||
itemCount: response!.length,
|
||||
|
||||
@@ -149,6 +149,9 @@ class _LogsPageState extends State<LogsPage> {
|
||||
? SafeArea(
|
||||
bottom: false,
|
||||
child: ListView.separated(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.paddingOf(context).bottom + 80,
|
||||
),
|
||||
itemCount: logsContent.length,
|
||||
itemBuilder: (context, index) {
|
||||
final log = logsContent[index];
|
||||
|
||||
Reference in New Issue
Block a user