mod: option show dyn actionbar

Closes #412

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-03-09 21:12:16 +08:00
parent 35a53bc8ac
commit 95e50e436b
6 changed files with 556 additions and 431 deletions

View File

@@ -19,6 +19,7 @@ class DynamicDetailController extends ReplyController {
int? floor; int? floor;
late final horizontalPreview = GStorage.horizontalPreview; late final horizontalPreview = GStorage.horizontalPreview;
late final showDynActionBar = GStorage.showDynActionBar;
@override @override
dynamic get sourceId => dynamic get sourceId =>

View File

@@ -458,211 +458,272 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
parent: _fabAnimationCtr!, parent: _fabAnimationCtr!,
curve: Curves.easeInOut, curve: Curves.easeInOut,
)), )),
child: Column( child: Builder(
mainAxisSize: MainAxisSize.min, builder: (context) {
crossAxisAlignment: CrossAxisAlignment.end, Widget button() => FloatingActionButton(
children: [ heroTag: null,
Padding( onPressed: () {
padding: const EdgeInsets.only(right: 14, bottom: 14), feedBack();
child: FloatingActionButton( _dynamicDetailController.onReply(
heroTag: null, context,
onPressed: () { oid: _dynamicDetailController.oid,
feedBack(); replyType: ReplyType.values[replyType],
_dynamicDetailController.onReply( );
context, },
oid: _dynamicDetailController.oid, tooltip: '评论动态',
replyType: ReplyType.values[replyType], child: const Icon(Icons.reply),
); );
}, return _dynamicDetailController.showDynActionBar.not
tooltip: '评论动态', ? Align(
child: const Icon(Icons.reply), alignment: Alignment.bottomRight,
), child: Padding(
), padding: EdgeInsets.only(
Container( right: 14,
decoration: BoxDecoration( bottom:
color: Theme.of(context).colorScheme.surface, MediaQuery.paddingOf(context).bottom + 14,
border: Border( ),
top: BorderSide( child: button(),
color: Theme.of(context) ),
.colorScheme )
.outline : Column(
.withOpacity(0.08), mainAxisSize: MainAxisSize.min,
), crossAxisAlignment: CrossAxisAlignment.end,
), children: [
), Padding(
padding: EdgeInsets.only( padding: const EdgeInsets.only(
bottom: MediaQuery.paddingOf(context).bottom), right: 14, bottom: 14),
child: Row( child: button(),
mainAxisAlignment: MainAxisAlignment.spaceAround, ),
children: [ Container(
Expanded( decoration: BoxDecoration(
child: Builder( color: Theme.of(context).colorScheme.surface,
builder: (btnContext) => TextButton.icon( border: Border(
onPressed: () { top: BorderSide(
showModalBottomSheet( color: Theme.of(context)
context: context, .colorScheme
isScrollControlled: true, .outline
useSafeArea: true, .withOpacity(0.08),
builder: (context) => RepostPanel( ),
item: _dynamicDetailController.item, ),
callback: () { ),
int count = int.tryParse( padding: EdgeInsets.only(
_dynamicDetailController bottom:
MediaQuery.paddingOf(context).bottom),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
Expanded(
child: Builder(
builder: (btnContext) =>
TextButton.icon(
onPressed: () {
showModalBottomSheet(
context: context,
isScrollControlled: true,
useSafeArea: true,
builder: (context) => RepostPanel(
item: _dynamicDetailController
.item,
callback: () {
int count = int.tryParse(
_dynamicDetailController
.item
.modules
?.moduleStat
?.forward
?.count ??
'0') ??
0;
_dynamicDetailController
.item
.modules
?.moduleStat ??=
ModuleStatModel();
_dynamicDetailController
.item
.modules!
.moduleStat
?.forward ??= ForWard();
_dynamicDetailController
.item
.modules!
.moduleStat!
.forward!
.count =
(count + 1).toString();
if (btnContext.mounted) {
(btnContext as Element?)
?.markNeedsBuild();
}
},
),
);
},
icon: Icon(
FontAwesomeIcons.shareFromSquare,
size: 16,
color: Theme.of(context)
.colorScheme
.outline,
semanticLabel: "转发",
),
style: TextButton.styleFrom(
padding: const EdgeInsets.fromLTRB(
15, 0, 15, 0),
foregroundColor: Theme.of(context)
.colorScheme
.outline,
),
label: Text(
_dynamicDetailController
.item .item
.modules .modules
?.moduleStat ?.moduleStat
?.forward ?.forward
?.count ?? ?.count !=
'0') ?? null
0; ? Utils.numFormat(
_dynamicDetailController.item.modules _dynamicDetailController
?.moduleStat ??= ModuleStatModel(); .item
_dynamicDetailController.item.modules! .modules!
.moduleStat?.forward ??= ForWard(); .moduleStat!
_dynamicDetailController .forward!
.item .count)
.modules! : '转发',
.moduleStat! ),
.forward! ),
.count = (count + 1).toString(); ),
if (btnContext.mounted) {
(btnContext as Element?)
?.markNeedsBuild();
}
},
), ),
); Expanded(
}, child: TextButton.icon(
icon: Icon( onPressed: () {
FontAwesomeIcons.shareFromSquare, Utils.shareText(
size: 16, '${HttpString.dynamicShareBaseUrl}/${_dynamicDetailController.item.idStr}');
color: Theme.of(context).colorScheme.outline, },
semanticLabel: "转发", icon: Icon(
), FontAwesomeIcons.shareNodes,
style: TextButton.styleFrom( size: 16,
padding: color: Theme.of(context)
const EdgeInsets.fromLTRB(15, 0, 15, 0),
foregroundColor:
Theme.of(context).colorScheme.outline,
),
label: Text(
_dynamicDetailController.item.modules
?.moduleStat?.forward?.count !=
null
? Utils.numFormat(_dynamicDetailController
.item
.modules!
.moduleStat!
.forward!
.count)
: '转发',
),
),
),
),
Expanded(
child: TextButton.icon(
onPressed: () {
Utils.shareText(
'${HttpString.dynamicShareBaseUrl}/${_dynamicDetailController.item.idStr}');
},
icon: Icon(
FontAwesomeIcons.shareNodes,
size: 16,
color: Theme.of(context).colorScheme.outline,
semanticLabel: "分享",
),
style: TextButton.styleFrom(
padding:
const EdgeInsets.fromLTRB(15, 0, 15, 0),
foregroundColor:
Theme.of(context).colorScheme.outline,
),
label: const Text('分享'),
),
),
Expanded(
child: Builder(
builder: (context) => TextButton.icon(
onPressed: () => Utils.onLikeDynamic(
_dynamicDetailController.item,
() {
if (context.mounted) {
(context as Element?)?.markNeedsBuild();
}
},
),
icon: Icon(
_dynamicDetailController.item.modules
?.moduleStat?.like?.status ==
true
? FontAwesomeIcons.solidThumbsUp
: FontAwesomeIcons.thumbsUp,
size: 16,
color: _dynamicDetailController.item.modules
?.moduleStat?.like?.status ==
true
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.outline,
semanticLabel: _dynamicDetailController
.item
.modules
?.moduleStat
?.like
?.status ==
true
? "已赞"
: "点赞",
),
style: TextButton.styleFrom(
padding:
const EdgeInsets.fromLTRB(15, 0, 15, 0),
foregroundColor:
Theme.of(context).colorScheme.outline,
),
label: AnimatedSwitcher(
duration: const Duration(milliseconds: 400),
transitionBuilder: (Widget child,
Animation<double> animation) {
return ScaleTransition(
scale: animation, child: child);
},
child: Text(
_dynamicDetailController.item.modules
?.moduleStat?.like?.count !=
null
? Utils.numFormat(
_dynamicDetailController
.item
.modules!
.moduleStat!
.like!
.count)
: '点赞',
style: TextStyle(
color: _dynamicDetailController
.item
.modules
?.moduleStat
?.like
?.status ==
true
? Theme.of(context)
.colorScheme
.primary
: Theme.of(context)
.colorScheme .colorScheme
.outline, .outline,
semanticLabel: "分享",
),
style: TextButton.styleFrom(
padding: const EdgeInsets.fromLTRB(
15, 0, 15, 0),
foregroundColor: Theme.of(context)
.colorScheme
.outline,
),
label: const Text('分享'),
),
), ),
), Expanded(
child: Builder(
builder: (context) => TextButton.icon(
onPressed: () => Utils.onLikeDynamic(
_dynamicDetailController.item,
() {
if (context.mounted) {
(context as Element?)
?.markNeedsBuild();
}
},
),
icon: Icon(
_dynamicDetailController
.item
.modules
?.moduleStat
?.like
?.status ==
true
? FontAwesomeIcons.solidThumbsUp
: FontAwesomeIcons.thumbsUp,
size: 16,
color: _dynamicDetailController
.item
.modules
?.moduleStat
?.like
?.status ==
true
? Theme.of(context)
.colorScheme
.primary
: Theme.of(context)
.colorScheme
.outline,
semanticLabel:
_dynamicDetailController
.item
.modules
?.moduleStat
?.like
?.status ==
true
? "已赞"
: "点赞",
),
style: TextButton.styleFrom(
padding: const EdgeInsets.fromLTRB(
15, 0, 15, 0),
foregroundColor: Theme.of(context)
.colorScheme
.outline,
),
label: AnimatedSwitcher(
duration: const Duration(
milliseconds: 400),
transitionBuilder: (Widget child,
Animation<double> animation) {
return ScaleTransition(
scale: animation,
child: child);
},
child: Text(
_dynamicDetailController
.item
.modules
?.moduleStat
?.like
?.count !=
null
? Utils.numFormat(
_dynamicDetailController
.item
.modules!
.moduleStat!
.like!
.count)
: '点赞',
style: TextStyle(
color: _dynamicDetailController
.item
.modules
?.moduleStat
?.like
?.status ==
true
? Theme.of(context)
.colorScheme
.primary
: Theme.of(context)
.colorScheme
.outline,
),
),
),
),
),
),
],
), ),
), ),
), ],
), );
], },
),
),
],
), ),
), ),
), ),

View File

@@ -25,6 +25,7 @@ class HtmlRenderController extends ReplyController {
RxBool loaded = false.obs; RxBool loaded = false.obs;
late final horizontalPreview = GStorage.horizontalPreview; late final horizontalPreview = GStorage.horizontalPreview;
late final showDynActionBar = GStorage.showDynActionBar;
@override @override
dynamic get sourceId => id; dynamic get sourceId => id;
@@ -35,16 +36,20 @@ class HtmlRenderController extends ReplyController {
id = Get.parameters['id']!; id = Get.parameters['id']!;
dynamicType = Get.parameters['dynamicType']!; dynamicType = Get.parameters['dynamicType']!;
type = dynamicType == 'picture' ? 11 : 12; type = dynamicType == 'picture' ? 11 : 12;
if (RegExp(r'^cv', caseSensitive: false).hasMatch(id)) {
UrlUtils.parseRedirectUrl('https://www.bilibili.com/read/$id/') if (showDynActionBar) {
.then((url) { if (RegExp(r'^cv', caseSensitive: false).hasMatch(id)) {
if (url != null) { UrlUtils.parseRedirectUrl('https://www.bilibili.com/read/$id/')
_queryDyn(url.split('/').last); .then((url) {
} if (url != null) {
}); _queryDyn(url.split('/').last);
} else { }
_queryDyn(id); });
} else {
_queryDyn(id);
}
} }
reqHtml(); reqHtml();
} }

View File

@@ -448,20 +448,9 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
parent: fabAnimationCtr, parent: fabAnimationCtr,
curve: Curves.easeInOut, curve: Curves.easeInOut,
)), )),
child: Obx( child: Builder(
() => Column( builder: (context) {
mainAxisSize: MainAxisSize.min, Widget button() => FloatingActionButton(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Padding(
padding: EdgeInsets.only(
right: 14,
bottom: 14 +
(_htmlRenderCtr.item.value.idStr != null
? 0
: MediaQuery.of(context).padding.bottom),
),
child: FloatingActionButton(
heroTag: null, heroTag: null,
onPressed: () { onPressed: () {
feedBack(); feedBack();
@@ -473,229 +462,287 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
}, },
tooltip: '评论动态', tooltip: '评论动态',
child: const Icon(Icons.reply), child: const Icon(Icons.reply),
), );
), return _htmlRenderCtr.showDynActionBar.not
_htmlRenderCtr.item.value.idStr != null ? Align(
? Container( alignment: Alignment.bottomRight,
decoration: BoxDecoration( child: Padding(
color: Theme.of(context).colorScheme.surface,
border: Border(
top: BorderSide(
color: Theme.of(context)
.colorScheme
.outline
.withOpacity(0.08),
),
),
),
padding: EdgeInsets.only( padding: EdgeInsets.only(
bottom: MediaQuery.paddingOf(context).bottom), right: 14,
child: Row( bottom:
mainAxisAlignment: MainAxisAlignment.spaceAround, MediaQuery.of(context).padding.bottom + 14,
children: [ ),
Expanded( child: button(),
child: Builder( ),
builder: (btnContext) => TextButton.icon( )
onPressed: () { : Obx(
showModalBottomSheet( () => Column(
context: context, mainAxisSize: MainAxisSize.min,
isScrollControlled: true, crossAxisAlignment: CrossAxisAlignment.end,
useSafeArea: true, children: [
builder: (context) => RepostPanel( Padding(
item: _htmlRenderCtr.item.value, padding: EdgeInsets.only(
callback: () { right: 14,
int count = int.tryParse( bottom: 14 +
_htmlRenderCtr (_htmlRenderCtr.item.value.idStr != null
? 0
: MediaQuery.of(context)
.padding
.bottom),
),
child: button(),
),
_htmlRenderCtr.item.value.idStr != null
? Container(
decoration: BoxDecoration(
color: Theme.of(context)
.colorScheme
.surface,
border: Border(
top: BorderSide(
color: Theme.of(context)
.colorScheme
.outline
.withOpacity(0.08),
),
),
),
padding: EdgeInsets.only(
bottom: MediaQuery.paddingOf(context)
.bottom),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
children: [
Expanded(
child: Builder(
builder: (btnContext) =>
TextButton.icon(
onPressed: () {
showModalBottomSheet(
context: context,
isScrollControlled: true,
useSafeArea: true,
builder: (context) =>
RepostPanel(
item: _htmlRenderCtr
.item.value,
callback: () {
int count = int.tryParse(
_htmlRenderCtr
.item
.value
.modules
?.moduleStat
?.forward
?.count ??
'0') ??
0;
_htmlRenderCtr
.item
.value
.modules
?.moduleStat
?.forward!
.count =
(count + 1)
.toString();
if (btnContext
.mounted) {
(btnContext
as Element?)
?.markNeedsBuild();
}
},
),
);
},
icon: Icon(
FontAwesomeIcons
.shareFromSquare,
size: 16,
color: Theme.of(context)
.colorScheme
.outline,
semanticLabel: "转发",
),
style: TextButton.styleFrom(
padding:
const EdgeInsets.fromLTRB(
15, 0, 15, 0),
foregroundColor:
Theme.of(context)
.colorScheme
.outline,
),
label: Text(
_htmlRenderCtr
.item .item
.value .value
.modules .modules
?.moduleStat ?.moduleStat
?.forward ?.forward!
?.count ?? .count !=
'0') ?? null
0; ? Utils.numFormat(
_htmlRenderCtr _htmlRenderCtr
.item .item
.value .value
.modules .modules
?.moduleStat ?.moduleStat
?.forward! ?.forward!
.count = .count)
(count + 1).toString(); : '转发',
if (btnContext.mounted) { ),
(btnContext as Element?) ),
?.markNeedsBuild(); ),
}
},
), ),
); Expanded(
}, child: TextButton.icon(
icon: Icon( onPressed: () {
FontAwesomeIcons.shareFromSquare, Utils.shareText(
size: 16, '${HttpString.dynamicShareBaseUrl}/${_htmlRenderCtr.item.value.idStr}');
color: Theme.of(context) },
.colorScheme icon: Icon(
.outline, FontAwesomeIcons.shareNodes,
semanticLabel: "转发", size: 16,
), color: Theme.of(context)
style: TextButton.styleFrom(
padding: const EdgeInsets.fromLTRB(
15, 0, 15, 0),
foregroundColor: Theme.of(context)
.colorScheme
.outline,
),
label: Text(
_htmlRenderCtr
.item
.value
.modules
?.moduleStat
?.forward!
.count !=
null
? Utils.numFormat(_htmlRenderCtr
.item
.value
.modules
?.moduleStat
?.forward!
.count)
: '转发',
),
),
),
),
Expanded(
child: TextButton.icon(
onPressed: () {
Utils.shareText(
'${HttpString.dynamicShareBaseUrl}/${_htmlRenderCtr.item.value.idStr}');
},
icon: Icon(
FontAwesomeIcons.shareNodes,
size: 16,
color:
Theme.of(context).colorScheme.outline,
semanticLabel: "分享",
),
style: TextButton.styleFrom(
padding: const EdgeInsets.fromLTRB(
15, 0, 15, 0),
foregroundColor:
Theme.of(context).colorScheme.outline,
),
label: const Text('分享'),
),
),
Expanded(
child: Builder(
builder: (context) => TextButton.icon(
onPressed: () => Utils.onLikeDynamic(
_htmlRenderCtr.item.value,
() {
if (context.mounted) {
(context as Element?)
?.markNeedsBuild();
}
},
),
icon: Icon(
_htmlRenderCtr
.item
.value
.modules
?.moduleStat
?.like
?.status ==
true
? FontAwesomeIcons.solidThumbsUp
: FontAwesomeIcons.thumbsUp,
size: 16,
color: _htmlRenderCtr
.item
.value
.modules
?.moduleStat
?.like
?.status ==
true
? Theme.of(context)
.colorScheme
.primary
: Theme.of(context)
.colorScheme
.outline,
semanticLabel: _htmlRenderCtr
.item
.value
.modules
?.moduleStat
?.like
?.status ==
true
? "已赞"
: "点赞",
),
style: TextButton.styleFrom(
padding: const EdgeInsets.fromLTRB(
15, 0, 15, 0),
foregroundColor: Theme.of(context)
.colorScheme
.outline,
),
label: AnimatedSwitcher(
duration:
const Duration(milliseconds: 400),
transitionBuilder: (Widget child,
Animation<double> animation) {
return ScaleTransition(
scale: animation, child: child);
},
child: Text(
_htmlRenderCtr
.item
.value
.modules
?.moduleStat
?.like
?.count !=
null
? Utils.numFormat(_htmlRenderCtr
.item
.value
.modules!
.moduleStat!
.like!
.count)
: '点赞',
style: TextStyle(
color: _htmlRenderCtr
.item
.value
.modules
?.moduleStat
?.like
?.status ==
true
? Theme.of(context)
.colorScheme
.primary
: Theme.of(context)
.colorScheme .colorScheme
.outline, .outline,
semanticLabel: "分享",
),
style: TextButton.styleFrom(
padding:
const EdgeInsets.fromLTRB(
15, 0, 15, 0),
foregroundColor:
Theme.of(context)
.colorScheme
.outline,
),
label: const Text('分享'),
),
), ),
), Expanded(
child: Builder(
builder: (context) =>
TextButton.icon(
onPressed: () =>
Utils.onLikeDynamic(
_htmlRenderCtr.item.value,
() {
if (context.mounted) {
(context as Element?)
?.markNeedsBuild();
}
},
),
icon: Icon(
_htmlRenderCtr
.item
.value
.modules
?.moduleStat
?.like
?.status ==
true
? FontAwesomeIcons
.solidThumbsUp
: FontAwesomeIcons
.thumbsUp,
size: 16,
color: _htmlRenderCtr
.item
.value
.modules
?.moduleStat
?.like
?.status ==
true
? Theme.of(context)
.colorScheme
.primary
: Theme.of(context)
.colorScheme
.outline,
semanticLabel: _htmlRenderCtr
.item
.value
.modules
?.moduleStat
?.like
?.status ==
true
? "已赞"
: "点赞",
),
style: TextButton.styleFrom(
padding:
const EdgeInsets.fromLTRB(
15, 0, 15, 0),
foregroundColor:
Theme.of(context)
.colorScheme
.outline,
),
label: AnimatedSwitcher(
duration: const Duration(
milliseconds: 400),
transitionBuilder:
(Widget child,
Animation<double>
animation) {
return ScaleTransition(
scale: animation,
child: child);
},
child: Text(
_htmlRenderCtr
.item
.value
.modules
?.moduleStat
?.like
?.count !=
null
? Utils.numFormat(
_htmlRenderCtr
.item
.value
.modules!
.moduleStat!
.like!
.count)
: '点赞',
style: TextStyle(
color: _htmlRenderCtr
.item
.value
.modules
?.moduleStat
?.like
?.status ==
true
? Theme.of(context)
.colorScheme
.primary
: Theme.of(context)
.colorScheme
.outline,
),
),
),
),
),
),
],
), ),
), )
), : const SizedBox.shrink(),
), ],
], ),
), );
) },
: const SizedBox.shrink(),
],
),
), ),
), ),
), ),

View File

@@ -2137,6 +2137,13 @@ List<SettingsModel> get extraSettings => [
setKey: SettingBoxKey.enableShrinkVideoSize, setKey: SettingBoxKey.enableShrinkVideoSize,
defaultVal: true, defaultVal: true,
), ),
SettingsModel(
settingsType: SettingsType.sw1tch,
title: '动态/专栏详情页展示底部操作栏',
leading: const Icon(Icons.more_horiz),
setKey: SettingBoxKey.showDynActionBar,
defaultVal: true,
),
SettingsModel( SettingsModel(
settingsType: SettingsType.sw1tch, settingsType: SettingsType.sw1tch,
enableFeedback: true, enableFeedback: true,

View File

@@ -400,6 +400,9 @@ class GStorage {
static bool get enableShrinkVideoSize => GStorage.setting static bool get enableShrinkVideoSize => GStorage.setting
.get(SettingBoxKey.enableShrinkVideoSize, defaultValue: true); .get(SettingBoxKey.enableShrinkVideoSize, defaultValue: true);
static bool get showDynActionBar =>
GStorage.setting.get(SettingBoxKey.showDynActionBar, defaultValue: true);
static List<double> get dynamicDetailRatio => List<double>.from(setting static List<double> get dynamicDetailRatio => List<double>.from(setting
.get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0])); .get(SettingBoxKey.dynamicDetailRatio, defaultValue: [60.0, 40.0]));
@@ -657,6 +660,7 @@ class SettingBoxKey {
slideDismissReplyPage = 'slideDismissReplyPage', slideDismissReplyPage = 'slideDismissReplyPage',
showFSActionItem = 'showFSActionItem', showFSActionItem = 'showFSActionItem',
enableShrinkVideoSize = 'enableShrinkVideoSize', enableShrinkVideoSize = 'enableShrinkVideoSize',
showDynActionBar = 'showDynActionBar',
// Sponsor Block // Sponsor Block
enableSponsorBlock = 'enableSponsorBlock', enableSponsorBlock = 'enableSponsorBlock',