diff --git a/CHANGELOG.md b/CHANGELOG.md index d29f281..d4c6a8b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # 更新记录 ## v0.5.1(未发布) - 可以设置长按历史或订阅/标签按钮会在新标签页打开对应页面(高级设置) -- 长按串的时间会在相对时间和绝对时间之间切换 +- 长按串的时间会在相对时间和具体时间之间切换 - 修复“修复字体显示”无效的问题 ## v0.5.0 diff --git a/lib/app/data/services/settings.dart b/lib/app/data/services/settings.dart index ebe2b92..6fd8519 100644 --- a/lib/app/data/services/settings.dart +++ b/lib/app/data/services/settings.dart @@ -573,7 +573,7 @@ class SettingsService extends GetxService { set showRelativeTime(bool showRelativeTime) => _settingsBox.put(Settings.showRelativeTime, showRelativeTime); - /// 0是不显示,1是显示绝对时间,2是显示相对时间 + /// 0是不显示,1是显示具体时间,2是显示相对时间 int get showLatestPostTimeInFeed => (_settingsBox.get(Settings.showLatestPostTimeInFeed, defaultValue: 0) as int) diff --git a/lib/app/modules/basic_ui_settings.dart b/lib/app/modules/basic_ui_settings.dart index fd53972..a281464 100644 --- a/lib/app/modules/basic_ui_settings.dart +++ b/lib/app/modules/basic_ui_settings.dart @@ -504,7 +504,7 @@ class _ShowLatestPostTimeInFeed extends StatelessWidget { DropdownMenuItem( value: 1, alignment: Alignment.centerRight, - child: Text('显示绝对时间'), + child: Text('显示具体时间'), ), DropdownMenuItem( value: 2, diff --git a/lib/app/modules/image.dart b/lib/app/modules/image.dart index 545a0de..a6ac873 100644 --- a/lib/app/modules/image.dart +++ b/lib/app/modules/image.dart @@ -70,7 +70,6 @@ class _TopOverlay extends StatelessWidget { showReplyCount: false, showPoTag: true, showPostTags: false, - longPressPostIdToCopy: false, ), ), ), diff --git a/lib/app/modules/post_settings.dart b/lib/app/modules/post_settings.dart index 2d00ec0..8677448 100644 --- a/lib/app/modules/post_settings.dart +++ b/lib/app/modules/post_settings.dart @@ -276,6 +276,7 @@ class PostFontSettingsView extends GetView { child: PostContent( post: _post, showFullTime: false, + longPressPostTimeToSwitch: false, longPressPostIdToCopy: false, contentTextStyle: TextStyle( fontSize: controller._postContentFontSize.value, diff --git a/lib/app/widgets/post.dart b/lib/app/widgets/post.dart index f0f873b..dc80cde 100644 --- a/lib/app/widgets/post.dart +++ b/lib/app/widgets/post.dart @@ -125,6 +125,8 @@ class _PostTime extends StatefulWidget { final bool showFullTime; + final bool longPressPostTimeToSwitch; + final TextStyle? textStyle; const _PostTime( @@ -132,6 +134,7 @@ class _PostTime extends StatefulWidget { {super.key, required this.postTime, this.showFullTime = true, + this.longPressPostTimeToSwitch = true, this.textStyle}); @override @@ -162,6 +165,7 @@ class _PostTimeState extends State<_PostTime> { return ListenBuilder( listenable: settings.showRelativeTimeListenable, builder: (context, child) => PostTime( + enableSwitch: widget.longPressPostTimeToSwitch, isShowRelativeTime: settings.showRelativeTime, relativeTime: (context) => Text( time.relativeTime(widget.postTime), @@ -603,6 +607,8 @@ class PostContent extends StatelessWidget { final bool isPinned; + final bool longPressPostTimeToSwitch; + final bool longPressPostIdToCopy; final double? headerHeight; @@ -648,6 +654,7 @@ class PostContent extends StatelessWidget { this.showPoTag = false, this.showPostTags = true, this.isPinned = false, + this.longPressPostTimeToSwitch = true, this.longPressPostIdToCopy = true, this.headerHeight, this.contentMaxHeight, @@ -728,6 +735,7 @@ class PostContent extends StatelessWidget { child: _PostTime( postTime: post.postTime, showFullTime: showFullTime, + longPressPostTimeToSwitch: longPressPostTimeToSwitch, textStyle: headerTextStyle, ), ), @@ -818,6 +826,7 @@ class PostInkWell extends StatelessWidget { bool showPoTag = false, bool showPostTags = true, bool isPinned = false, + bool longPressPostTimeToSwitch = true, bool longPressPostIdToCopy = true, double? headerHeight, double? contentMaxHeight, @@ -850,6 +859,7 @@ class PostInkWell extends StatelessWidget { showPoTag: showPoTag, showPostTags: showPostTags, isPinned: isPinned, + longPressPostTimeToSwitch: longPressPostTimeToSwitch, longPressPostIdToCopy: longPressPostIdToCopy, headerHeight: headerHeight, contentMaxHeight: contentMaxHeight, diff --git a/lib/app/widgets/time.dart b/lib/app/widgets/time.dart index 91a931b..dc64209 100644 --- a/lib/app/widgets/time.dart +++ b/lib/app/widgets/time.dart @@ -12,6 +12,8 @@ class _TimerRefresher extends TimerRefreshWidget { } class PostTime extends StatefulWidget { + final bool enableSwitch; + final bool isShowRelativeTime; final WidgetBuilder relativeTime; @@ -20,6 +22,7 @@ class PostTime extends StatefulWidget { const PostTime( {super.key, + this.enableSwitch = true, required this.isShowRelativeTime, required this.relativeTime, required this.absoluteTime}); @@ -49,8 +52,9 @@ class _PostTimeState extends State { @override Widget build(BuildContext context) => GestureDetector( - onLongPress: () => - setState(() => _isShowRelativeTime = !_isShowRelativeTime), + onLongPress: widget.enableSwitch + ? () => setState(() => _isShowRelativeTime = !_isShowRelativeTime) + : null, child: _isShowRelativeTime ? _TimerRefresher(builder: widget.relativeTime) : widget.absoluteTime); diff --git a/pubspec.yaml b/pubspec.yaml index 02ca6a6..a756de9 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: nmbxd description: An app for nmbxd.com. publish_to: 'none' -version: 0.5.1-alpha+11 +version: 0.5.1+12 environment: sdk: '>=3.0.6 <4.0.0'