diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 64e00cc7..a83cb700 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -544,5 +544,6 @@ "proxy_setting_input_hint": "e.g. 127.0.0.1:1234 (Leave blank to disable)", "proxy_setting_set_successfully": "Proxy settings saved, restart the app to take effect.", "use_webvpn_title": "Use WebVPN proxy", - "use_webvpn_description": "When enabled, certain functions could be accessed directly without Fudan LAN (restart required)" + "use_webvpn_description": "When enabled, certain functions could be accessed directly without Fudan LAN (restart required)", + "show_this_person": "Filter by this user" } \ No newline at end of file diff --git a/lib/l10n/intl_ja.arb b/lib/l10n/intl_ja.arb index ad4b1acf..29ea636b 100644 --- a/lib/l10n/intl_ja.arb +++ b/lib/l10n/intl_ja.arb @@ -526,5 +526,6 @@ "proxy_setting_input_hint": "例:127.0.0.1:1234(空白のままにしてプロキシを無効にする)", "proxy_setting_set_successfully": "プロキシ設定が保存されました。再起動すると有効になります。", "use_webvpn_title": "WebVPN を自動的に使う", - "use_webvpn_description": "有効時、一部の機能はFudan LANなしで、直接に連接するのができます (再起動が必要)" + "use_webvpn_description": "有効時、一部の機能はFudan LANなしで、直接に連接するのができます (再起動が必要)", + "show_this_person": "この人だけ" } \ No newline at end of file diff --git a/lib/l10n/intl_zh_CN.arb b/lib/l10n/intl_zh_CN.arb index b086f0d3..ec89f03f 100644 --- a/lib/l10n/intl_zh_CN.arb +++ b/lib/l10n/intl_zh_CN.arb @@ -538,5 +538,6 @@ "proxy_setting_input_hint": "如 127.0.0.1:1234(留空以关闭代理)", "proxy_setting_set_successfully": "代理设置已保存,重启应用后生效", "use_webvpn_title": "自动使用 WebVPN 代理", - "use_webvpn_description": "启动该项后,允许在非校园网环境下直接访问茶楼、评教等功能(需要重启应用)" + "use_webvpn_description": "启动该项后,允许在非校园网环境下直接访问茶楼、评教等功能(需要重启应用)", + "show_this_person": "只看此人" } diff --git a/lib/page/forum/hole_detail.dart b/lib/page/forum/hole_detail.dart index 4b7169d2..341c2580 100644 --- a/lib/page/forum/hole_detail.dart +++ b/lib/page/forum/hole_detail.dart @@ -306,7 +306,7 @@ class BBSPostDetailState extends State { ), trailingActions: [ if (_renderModel - case Normal(hole: var hole, onlyShowDZ: var onlyShowDZ)) ...[ + case Normal(hole: var hole, selectedPerson: var selectedPerson)) ...[ _buildSubscribeActionButton(), _buildFavoredActionButton(), PlatformIconButton( @@ -327,12 +327,18 @@ class BBSPostDetailState extends State { label: S.of(context).scroll_to_end, onTap: _onTapScrollToEnd), PopupMenuOption( - label: onlyShowDZ + label: selectedPerson == hole.floors?.first_floor?.anonyname ? S.of(context).show_all_replies : S.of(context).only_show_dz, onTap: (_) { - setState(() => - (_renderModel as Normal).onlyShowDZ = !onlyShowDZ); + setState(() { + if ((_renderModel as Normal).selectedPerson != hole.floors?.first_floor?.anonyname) { + (_renderModel as Normal).selectedPerson = hole.floors?.first_floor?.anonyname; + } + else { + (_renderModel as Normal).selectedPerson = null; + } + }); refreshListView(); }), PopupMenuOption( @@ -878,6 +884,20 @@ class BBSPostDetailState extends State { }, child: Text(S.of(context).share_floor), ), + PlatformContextMenuItem( + menuContext: menuContext, + onPressed: () async { + if ((_renderModel as Normal).selectedPerson != null) { + (_renderModel as Normal).selectedPerson = null; + refreshListView(); + } else { + setState(() => + (_renderModel as Normal).selectedPerson = e.anonyname); + refreshListView(); + } + }, + child: Text((_renderModel as Normal).selectedPerson == e.anonyname ? S.of(context).show_all_replies : S.of(context).show_this_person), + ), PlatformContextMenuItem( menuContext: menuContext, isDestructive: true, @@ -1009,9 +1029,9 @@ class BBSPostDetailState extends State { Widget _getListItems(BuildContext context, ListProvider dataProvider, int index, OTFloor floor, {bool isNested = false}) { - if (_renderModel case Normal(onlyShowDZ: var onlyShowDZ, hole: var hole)) { - if (onlyShowDZ && - floor.anonyname != hole.floors?.first_floor?.anonyname) { + if (_renderModel case Normal(selectedPerson: var selectedPerson, hole: var hole)) { + if (selectedPerson != null && + floor.anonyname != selectedPerson) { return nil; } } @@ -1190,7 +1210,7 @@ sealed class RenderModel {} class Normal extends RenderModel { OTHole hole; bool? isFavored, isSubscribed; - bool onlyShowDZ = false; + String? selectedPerson = null; Normal(this.hole);