Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
dom
2026-05-06 14:14:19 +08:00
parent 1a8c348af1
commit 07843a5e77
239 changed files with 3175 additions and 13237 deletions

View File

@@ -5,6 +5,7 @@ import 'package:PiliPlus/common/widgets/flutter/refresh_indicator.dart';
import 'package:PiliPlus/common/widgets/image/network_img_layer.dart';
import 'package:PiliPlus/common/widgets/loading_widget/http_error.dart';
import 'package:PiliPlus/common/widgets/pair.dart';
import 'package:PiliPlus/common/widgets/scaffold.dart';
import 'package:PiliPlus/common/widgets/sliver/sliver_pinned_header.dart';
import 'package:PiliPlus/http/loading_state.dart';
import 'package:PiliPlus/models/common/image_type.dart';
@@ -13,11 +14,11 @@ import 'package:PiliPlus/models_new/dynamic/dyn_topic_top/top_details.dart';
import 'package:PiliPlus/pages/dynamics/widgets/dynamic_panel.dart';
import 'package:PiliPlus/pages/dynamics_create/view.dart';
import 'package:PiliPlus/pages/dynamics_topic/controller.dart';
import 'package:PiliPlus/pages/webview/view.dart';
import 'package:PiliPlus/utils/extension/num_ext.dart';
import 'package:PiliPlus/utils/extension/theme_ext.dart';
import 'package:PiliPlus/utils/global_data.dart';
import 'package:PiliPlus/utils/num_utils.dart';
import 'package:PiliPlus/utils/page_utils.dart';
import 'package:PiliPlus/utils/share_utils.dart';
import 'package:PiliPlus/utils/theme_utils.dart';
import 'package:PiliPlus/utils/utils.dart';
@@ -47,102 +48,112 @@ class _DynTopicPageState extends State<DynTopicPage> with DynMixin {
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
final padding = MediaQuery.viewPaddingOf(context);
return Scaffold(
resizeToAvoidBottomInset: false,
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
if (_controller.isLogin) {
CreateDynPanel.onCreateDyn(
context,
topic: Pair(
first: int.parse(_controller.topicId),
second: _controller.topicName,
),
);
} else {
SmartDialog.showToast('账号未登录');
}
},
icon: const Icon(CustomIcons.topic_tag, size: 20),
label: const Text('参与话题'),
),
body: refreshIndicator(
onRefresh: _controller.onRefresh,
child: CustomScrollView(
controller: _controller.scrollController,
physics: const AlwaysScrollableScrollPhysics(),
slivers: [
Obx(
() => _buildAppBar(
theme,
padding,
_controller.topState.value,
),
),
Obx(() {
final allSortBy = _controller.topicSortByConf.value?.allSortBy;
if (allSortBy != null && allSortBy.isNotEmpty) {
return SliverPinnedHeader(
backgroundColor: theme.colorScheme.surface,
child: Padding(
padding: EdgeInsets.only(
left: 12 + padding.left,
top: 6,
bottom: 6,
),
child: Builder(
builder: (context) {
return ToggleButtons(
fillColor: theme.colorScheme.secondaryContainer,
selectedColor: theme.colorScheme.onSecondaryContainer,
constraints: const BoxConstraints(
minWidth: 54,
minHeight: 24,
),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
borderRadius: const .all(.circular(25)),
onPressed: (index) {
_controller.onSort(allSortBy[index].sortBy!);
(context as Element).markNeedsBuild();
},
isSelected: allSortBy
.map((e) => e.sortBy == _controller.sortBy)
.toList(),
children: allSortBy.map((e) {
return Text(
e.sortName!,
style: const TextStyle(
fontSize: 13,
height: 1,
),
strutStyle: const StrutStyle(
height: 1,
leading: 0,
fontSize: 13,
),
textScaler: TextScaler.noScaling,
);
}).toList(),
);
},
),
return scaffold(
body: Stack(
clipBehavior: .none,
children: [
refreshIndicator(
onRefresh: _controller.onRefresh,
child: CustomScrollView(
controller: _controller.scrollController,
physics: const AlwaysScrollableScrollPhysics(),
slivers: [
Obx(
() => _buildAppBar(
theme,
padding,
_controller.topState.value,
),
);
}
return const SliverToBoxAdapter();
}),
SliverPadding(
padding: EdgeInsets.only(
left: padding.left,
right: padding.right,
bottom: padding.bottom + 100,
),
sliver: buildPage(
Obx(() => _buildBody(_controller.loadingState.value)),
),
),
Obx(() {
final allSortBy =
_controller.topicSortByConf.value?.allSortBy;
if (allSortBy != null && allSortBy.isNotEmpty) {
return SliverPinnedHeader(
backgroundColor: theme.colorScheme.surface,
child: Padding(
padding: EdgeInsets.only(
left: 12 + padding.left,
top: 6,
bottom: 6,
),
child: Builder(
builder: (context) {
return ToggleButtons(
fillColor: theme.colorScheme.secondaryContainer,
selectedColor:
theme.colorScheme.onSecondaryContainer,
constraints: const BoxConstraints(
minWidth: 54,
minHeight: 24,
),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
borderRadius: const .all(.circular(25)),
onPressed: (index) {
_controller.onSort(allSortBy[index].sortBy!);
(context as Element).markNeedsBuild();
},
isSelected: allSortBy
.map((e) => e.sortBy == _controller.sortBy)
.toList(),
children: allSortBy.map((e) {
return Text(
e.sortName!,
style: const TextStyle(
fontSize: 13,
height: 1,
),
strutStyle: const StrutStyle(
height: 1,
leading: 0,
fontSize: 13,
),
textScaler: TextScaler.noScaling,
);
}).toList(),
);
},
),
),
);
}
return const SliverToBoxAdapter();
}),
SliverPadding(
padding: EdgeInsets.only(
left: padding.left,
right: padding.right,
bottom: padding.bottom + 100,
),
sliver: buildPage(
Obx(() => _buildBody(_controller.loadingState.value)),
),
),
],
),
],
),
),
Positioned(
right: kFloatingActionButtonMargin,
bottom: padding.bottom + kFloatingActionButtonMargin,
child: FloatingActionButton.extended(
onPressed: () {
if (_controller.isLogin) {
CreateDynPanel.onCreateDyn(
context,
topic: Pair(
first: int.parse(_controller.topicId),
second: _controller.topicName,
),
);
} else {
SmartDialog.showToast('账号未登录');
}
},
icon: const Icon(CustomIcons.topic_tag, size: 20),
label: const Text('参与话题'),
),
),
],
),
);
}
@@ -321,7 +332,7 @@ class _DynTopicPageState extends State<DynTopicPage> with DynMixin {
SmartDialog.showToast('账号未登录');
return;
}
PageUtils.inAppWebview(
WebViewPage.toWebView(
'https://www.bilibili.com/h5/topic-active/topic-report?topic_id=${_controller.topicId}&topic_name=${_controller.topicName}&${ThemeUtils.themeUrl(theme.isDark)}',
);
},