* fix: 1080p

* opt: import export

* opt: downloader

* opt: skeleton

* opt: parseColor

* tweak

* opt: sb seek

* opt: rxn
This commit is contained in:
My-Responsitories
2026-05-08 12:50:43 +00:00
committed by GitHub
parent b7b40c557e
commit f5dbfcec79
30 changed files with 258 additions and 376 deletions

View File

@@ -18,13 +18,13 @@ class DynTopicController
int sortBy = 0;
String offset = '';
Rx<TopicSortByConf?> topicSortByConf = Rx<TopicSortByConf?>(null);
final topicSortByConf = Rxn<TopicSortByConf>();
double? appbarOffset;
// top
Rx<bool?> isFav = Rx<bool?>(null);
Rx<bool?> isLike = Rx<bool?>(null);
final isFav = false.obs;
final isLike = false.obs;
Rx<LoadingState<TopDetails?>> topState =
LoadingState<TopDetails?>.loading().obs;
@@ -42,8 +42,8 @@ class DynTopicController
if (topState.value case Success(:final response)) {
final topicItem = response!.topicItem!;
topicName = topicItem.name;
isFav.value = topicItem.isFav;
isLike.value = topicItem.isLike;
isFav.value = topicItem.isFav ?? false;
isLike.value = topicItem.isLike ?? false;
}
}
@@ -96,7 +96,7 @@ class DynTopicController
SmartDialog.showToast('账号未登录');
return;
}
bool isFav = this.isFav.value ?? false;
final isFav = this.isFav.value;
final res = isFav
? await FavHttp.delFavTopic(topicId)
: await FavHttp.addFavTopic(topicId);
@@ -117,7 +117,7 @@ class DynTopicController
SmartDialog.showToast('账号未登录');
return;
}
bool isLike = this.isLike.value ?? false;
final isLike = this.isLike.value;
final res = await FavHttp.likeTopic(topicId, isLike);
if (res.isSuccess) {
if (isLike) {

View File

@@ -45,7 +45,7 @@ class _DynTopicPageState extends State<DynTopicPage> with DynMixin {
@override
Widget build(BuildContext context) {
final ThemeData theme = Theme.of(context);
final colorScheme = ColorScheme.of(context);
final padding = MediaQuery.viewPaddingOf(context);
return Scaffold(
resizeToAvoidBottomInset: false,
@@ -74,7 +74,7 @@ class _DynTopicPageState extends State<DynTopicPage> with DynMixin {
slivers: [
Obx(
() => _buildAppBar(
theme,
colorScheme,
padding,
_controller.topState.value,
),
@@ -83,7 +83,7 @@ class _DynTopicPageState extends State<DynTopicPage> with DynMixin {
final allSortBy = _controller.topicSortByConf.value?.allSortBy;
if (allSortBy != null && allSortBy.isNotEmpty) {
return SliverPinnedHeader(
backgroundColor: theme.colorScheme.surface,
backgroundColor: colorScheme.surface,
child: Padding(
padding: EdgeInsets.only(
left: 12 + padding.left,
@@ -93,8 +93,8 @@ class _DynTopicPageState extends State<DynTopicPage> with DynMixin {
child: Builder(
builder: (context) {
return ToggleButtons(
fillColor: theme.colorScheme.secondaryContainer,
selectedColor: theme.colorScheme.onSecondaryContainer,
fillColor: colorScheme.secondaryContainer,
selectedColor: colorScheme.onSecondaryContainer,
constraints: const BoxConstraints(
minWidth: 54,
minHeight: 24,
@@ -148,7 +148,7 @@ class _DynTopicPageState extends State<DynTopicPage> with DynMixin {
}
Widget _buildAppBar(
ThemeData theme,
ColorScheme colorScheme,
EdgeInsets padding,
LoadingState<TopDetails?> topState,
) {
@@ -205,7 +205,7 @@ class _DynTopicPageState extends State<DynTopicPage> with DynMixin {
),
Text(
' 发起',
style: TextStyle(color: theme.colorScheme.outline),
style: TextStyle(color: colorScheme.outline),
),
],
),
@@ -221,7 +221,7 @@ class _DynTopicPageState extends State<DynTopicPage> with DynMixin {
const SizedBox(height: 6),
SelectableText(
response.topicItem!.description!,
style: TextStyle(color: theme.colorScheme.onSurfaceVariant),
style: TextStyle(color: colorScheme.onSurfaceVariant),
),
const SizedBox(height: 10),
Row(
@@ -230,7 +230,7 @@ class _DynTopicPageState extends State<DynTopicPage> with DynMixin {
'${NumUtils.numFormat(response.topicItem!.view)}浏览 · ${NumUtils.numFormat(response.topicItem!.discuss)}讨论',
style: TextStyle(
fontSize: 13,
color: theme.colorScheme.outline,
color: colorScheme.outline,
),
),
const Spacer(),
@@ -238,13 +238,11 @@ class _DynTopicPageState extends State<DynTopicPage> with DynMixin {
style: OutlinedButton.styleFrom(
side: BorderSide(
width: 1,
color: theme.colorScheme.outline.withValues(
alpha: 0.2,
),
color: colorScheme.outline.withValues(alpha: 0.2),
),
foregroundColor: _controller.isLike.value == true
foregroundColor: _controller.isLike.value
? null
: theme.colorScheme.onSurfaceVariant,
: colorScheme.onSurfaceVariant,
padding: const EdgeInsets.symmetric(horizontal: 10),
visualDensity: const VisualDensity(
horizontal: -4,
@@ -253,7 +251,7 @@ class _DynTopicPageState extends State<DynTopicPage> with DynMixin {
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
onPressed: _controller.onLike,
icon: _controller.isLike.value == true
icon: _controller.isLike.value
? const Icon(FontAwesomeIcons.solidThumbsUp, size: 13)
: const Icon(FontAwesomeIcons.thumbsUp, size: 13),
label: Text(
@@ -267,22 +265,17 @@ class _DynTopicPageState extends State<DynTopicPage> with DynMixin {
style: OutlinedButton.styleFrom(
side: BorderSide(
width: 1,
color: theme.colorScheme.outline.withValues(
alpha: 0.2,
),
color: colorScheme.outline.withValues(alpha: 0.2),
),
foregroundColor: _controller.isFav.value == true
foregroundColor: _controller.isFav.value
? null
: theme.colorScheme.onSurfaceVariant,
: colorScheme.onSurfaceVariant,
padding: const EdgeInsets.symmetric(horizontal: 10),
visualDensity: const VisualDensity(
horizontal: -4,
vertical: -4,
),
visualDensity: const .new(horizontal: -4, vertical: -4),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
onPressed: _controller.onFav,
icon: _controller.isFav.value == true
icon: _controller.isFav.value
? const Icon(FontAwesomeIcons.solidStar, size: 13)
: const Icon(FontAwesomeIcons.star, size: 13),
label: Text(
@@ -311,7 +304,7 @@ class _DynTopicPageState extends State<DynTopicPage> with DynMixin {
PopupMenuItem(
onTap: _controller.onFav,
child: Text(
'${_controller.isFav.value == true ? '取消' : ''}收藏',
'${_controller.isFav.value ? '取消' : ''}收藏',
),
),
PopupMenuItem(
@@ -322,7 +315,7 @@ class _DynTopicPageState extends State<DynTopicPage> with DynMixin {
return;
}
PageUtils.inAppWebview(
'https://www.bilibili.com/h5/topic-active/topic-report?topic_id=${_controller.topicId}&topic_name=${_controller.topicName}&${ThemeUtils.themeUrl(theme.isDark)}',
'https://www.bilibili.com/h5/topic-active/topic-report?topic_id=${_controller.topicId}&topic_name=${_controller.topicName}&${ThemeUtils.themeUrl(colorScheme.isDark)}',
);
},
),