Skip to content

Commit

Permalink
Move instance modlog action to popup menu (#1180)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjiangsu committed Mar 10, 2024
1 parent 204ba55 commit 5f37728
Showing 1 changed file with 31 additions and 26 deletions.
57 changes: 31 additions & 26 deletions lib/feed/widgets/feed_page_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -333,33 +333,38 @@ class FeedAppBarGeneralActions extends StatelessWidget {
);
},
),
IconButton(
icon: Icon(Icons.shield_rounded, semanticLabel: l10n.modlog),
onPressed: () async {
HapticFeedback.mediumImpact();
PopupMenuButton(
itemBuilder: (context) => [
ThunderPopupMenuItem(
onTap: () async {
HapticFeedback.mediumImpact();

AuthBloc authBloc = context.read<AuthBloc>();
ThunderBloc thunderBloc = context.read<ThunderBloc>();

await Navigator.of(context).push(
SwipeablePageRoute(
transitionDuration: thunderBloc.state.reduceAnimations ? const Duration(milliseconds: 100) : null,
backGestureDetectionStartOffset: !kIsWeb && Platform.isAndroid ? 45 : 0,
backGestureDetectionWidth: 45,
canOnlySwipeFromEdge:
disableFullPageSwipe(isUserLoggedIn: authBloc.state.isLoggedIn, state: thunderBloc.state, isPostPage: false) || !thunderBloc.state.enableFullScreenSwipeNavigationGesture,
builder: (otherContext) {
return MultiBlocProvider(
providers: [
BlocProvider.value(value: feedBloc),
BlocProvider.value(value: thunderBloc),
],
child: const ModlogFeedPage(),
);
},
),
);
},
AuthBloc authBloc = context.read<AuthBloc>();
ThunderBloc thunderBloc = context.read<ThunderBloc>();

await Navigator.of(context).push(
SwipeablePageRoute(
transitionDuration: thunderBloc.state.reduceAnimations ? const Duration(milliseconds: 100) : null,
backGestureDetectionStartOffset: !kIsWeb && Platform.isAndroid ? 45 : 0,
backGestureDetectionWidth: 45,
canOnlySwipeFromEdge:
disableFullPageSwipe(isUserLoggedIn: authBloc.state.isLoggedIn, state: thunderBloc.state, isPostPage: false) || !thunderBloc.state.enableFullScreenSwipeNavigationGesture,
builder: (otherContext) {
return MultiBlocProvider(
providers: [
BlocProvider.value(value: feedBloc),
BlocProvider.value(value: thunderBloc),
],
child: const ModlogFeedPage(),
);
},
),
);
},
icon: Icons.shield_rounded,
title: l10n.modlog,
),
],
),
],
);
Expand Down

0 comments on commit 5f37728

Please sign in to comment.