Skip to content

Commit

Permalink
misc #433: add some minor changes to codes
Browse files Browse the repository at this point in the history
  • Loading branch information
AInfinity-LilacDream committed Dec 10, 2024
1 parent 4a5543e commit ab49c1b
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions lib/page/forum/hole_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,8 @@ class BBSPostDetailState extends State<BBSPostDetail> {
),
trailingActions: [
if (_renderModel
case Normal(hole: var hole, onlyShowDZ: var onlyShowDZ)) ...[
case Normal(hole: var hole, onlyShowSelectedPerson: var onlyShowSelectedPerson,
selectedPerson: var selectedPerson)) ...[
_buildSubscribeActionButton(),
_buildFavoredActionButton(),
PlatformIconButton(
Expand All @@ -327,12 +328,22 @@ class BBSPostDetailState extends State<BBSPostDetail> {
label: S.of(context).scroll_to_end,
onTap: _onTapScrollToEnd),
PopupMenuOption(
label: onlyShowDZ
label: onlyShowSelectedPerson && 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).onlyShowSelectedPerson &&
(_renderModel as Normal).selectedPerson != hole.floors?.first_floor?.anonyname) {
(_renderModel as Normal).selectedPerson = hole.floors?.first_floor?.anonyname;
}
else {
(_renderModel as Normal).onlyShowSelectedPerson =
!onlyShowSelectedPerson;
(_renderModel as Normal).selectedPerson = hole.floors
?.first_floor?.anonyname;
}
});
refreshListView();
}),
PopupMenuOption(
Expand Down Expand Up @@ -886,9 +897,6 @@ class BBSPostDetailState extends State<BBSPostDetail> {
refreshListView();
} else {
(_renderModel as Normal).selectedPerson = e.anonyname;
if ((_renderModel as Normal).onlyShowDZ) {
(_renderModel as Normal).onlyShowDZ = false;
}
setState(() =>
(_renderModel as Normal).onlyShowSelectedPerson = true);
refreshListView();
Expand Down Expand Up @@ -1033,12 +1041,6 @@ class BBSPostDetailState extends State<BBSPostDetail> {
return nil;
}
}
if (_renderModel case Normal(onlyShowDZ: var onlyShowDZ, hole: var hole)) {
if (onlyShowDZ &&
floor.anonyname != hole.floors?.first_floor?.anonyname) {
return nil;
}
}

Future<List<ImageUrlInfo>?> loadPageImage(
BuildContext pageContext, int pageIndex) async {
Expand Down Expand Up @@ -1214,7 +1216,6 @@ sealed class RenderModel {}
class Normal extends RenderModel {
OTHole hole;
bool? isFavored, isSubscribed;
bool onlyShowDZ = false;
bool onlyShowSelectedPerson = false;

String? selectedPerson;
Expand Down

0 comments on commit ab49c1b

Please sign in to comment.