mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: disable more button in row page
This commit is contained in:
parent
9f81b210e4
commit
83e8ea1dcb
@ -18,14 +18,21 @@ extension MobileRouter on BuildContext {
|
||||
ViewPB view, {
|
||||
Map<String, dynamic>? arguments,
|
||||
bool addInRecent = true,
|
||||
bool showMoreButton = true,
|
||||
}) async {
|
||||
// set the current view before pushing the new view
|
||||
getIt<MenuSharedState>().latestOpenView = view;
|
||||
unawaited(getIt<CachedRecentService>().updateRecentViews([view.id], true));
|
||||
final queryParameters = view.queryParameters(arguments);
|
||||
|
||||
if (view.layout == ViewLayoutPB.Document) {
|
||||
queryParameters[MobileDocumentScreen.viewShowMoreButton] =
|
||||
showMoreButton.toString();
|
||||
}
|
||||
|
||||
final uri = Uri(
|
||||
path: view.routeName,
|
||||
queryParameters: view.queryParameters(arguments),
|
||||
queryParameters: queryParameters,
|
||||
).toString();
|
||||
await push(uri);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ class MobileViewPage extends StatefulWidget {
|
||||
required this.viewLayout,
|
||||
this.title,
|
||||
this.arguments,
|
||||
this.showMoreButton = true,
|
||||
});
|
||||
|
||||
/// view id
|
||||
@ -33,6 +34,7 @@ class MobileViewPage extends StatefulWidget {
|
||||
final ViewLayoutPB viewLayout;
|
||||
final String? title;
|
||||
final Map<String, dynamic>? arguments;
|
||||
final bool showMoreButton;
|
||||
|
||||
@override
|
||||
State<MobileViewPage> createState() => _MobileViewPageState();
|
||||
@ -215,13 +217,19 @@ class _MobileViewPageState extends State<MobileViewPage> {
|
||||
]);
|
||||
}
|
||||
|
||||
actions.addAll([
|
||||
MobileViewPageMoreButton(
|
||||
view: view,
|
||||
isImmersiveMode: isImmersiveMode,
|
||||
appBarOpacity: _appBarOpacity,
|
||||
),
|
||||
]);
|
||||
if (widget.showMoreButton) {
|
||||
actions.addAll([
|
||||
MobileViewPageMoreButton(
|
||||
view: view,
|
||||
isImmersiveMode: isImmersiveMode,
|
||||
appBarOpacity: _appBarOpacity,
|
||||
),
|
||||
]);
|
||||
} else {
|
||||
actions.addAll([
|
||||
const HSpace(18.0),
|
||||
]);
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
@ -89,6 +89,7 @@ class _OpenRowPageButtonState extends State<OpenRowPageButton> {
|
||||
await context.pushView(
|
||||
view!,
|
||||
addInRecent: false,
|
||||
showMoreButton: false,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -7,15 +7,18 @@ class MobileDocumentScreen extends StatelessWidget {
|
||||
super.key,
|
||||
required this.id,
|
||||
this.title,
|
||||
this.showMoreButton = true,
|
||||
});
|
||||
|
||||
/// view id
|
||||
final String id;
|
||||
final String? title;
|
||||
final bool showMoreButton;
|
||||
|
||||
static const routeName = '/docs';
|
||||
static const viewId = 'id';
|
||||
static const viewTitle = 'title';
|
||||
static const viewShowMoreButton = 'show_more_button';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -23,6 +26,7 @@ class MobileDocumentScreen extends StatelessWidget {
|
||||
id: id,
|
||||
title: title,
|
||||
viewLayout: ViewLayoutPB.Document,
|
||||
showMoreButton: showMoreButton,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -493,9 +493,17 @@ GoRoute _mobileEditorScreenRoute() {
|
||||
pageBuilder: (context, state) {
|
||||
final id = state.uri.queryParameters[MobileDocumentScreen.viewId]!;
|
||||
final title = state.uri.queryParameters[MobileDocumentScreen.viewTitle];
|
||||
final showMoreButton = bool.tryParse(
|
||||
state.uri.queryParameters[MobileDocumentScreen.viewShowMoreButton] ??
|
||||
'true',
|
||||
);
|
||||
|
||||
return MaterialExtendedPage(
|
||||
child: MobileDocumentScreen(id: id, title: title),
|
||||
child: MobileDocumentScreen(
|
||||
id: id,
|
||||
title: title,
|
||||
showMoreButton: showMoreButton ?? true,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user