Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

feat: hide tabbar when pushing to view page (#4050)

Lucas.Xuc0ae80328026
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_page.dart b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_page.dart
index c6a29e6f1d..d1d263a6c9 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_page.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/bottom_sheet_view_page.dart
@@ -43,18 +43,15 @@ class _ViewPageBottomSheetState extends State<ViewPageBottomSheet> {
@override
Widget build(BuildContext context) {
- return Padding(
- padding: const EdgeInsets.fromLTRB(16, 16, 16, 32),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- // header
- _buildHeader(),
- const VSpace(16),
- // body
- _buildBody(),
- ],
- ),
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ // header
+ _buildHeader(),
+ const VSpace(16),
+ // body
+ _buildBody(),
+ ],
);
}
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/show_mobile_bottom_sheet.dart b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/show_mobile_bottom_sheet.dart
index b3b08976e8..9195fbcaeb 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/show_mobile_bottom_sheet.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/bottom_sheet/show_mobile_bottom_sheet.dart
@@ -13,6 +13,8 @@ Future<void> showMobileBottomSheet({
required WidgetBuilder builder,
bool isDragEnabled = true,
ShapeBorder? shape,
+ bool resizeToAvoidBottomInset = true,
+ EdgeInsets padding = const EdgeInsets.fromLTRB(16, 16, 16, 32),
}) async {
showModalBottomSheet(
context: context,
@@ -26,7 +28,20 @@ Future<void> showMobileBottomSheet({
top: Corners.s12Radius,
),
),
- builder: builder,
+ builder: (context) {
+ final child = builder(context);
+ if (resizeToAvoidBottomInset) {
+ return AnimatedPadding(
+ padding: padding +
+ EdgeInsets.only(
+ bottom: MediaQuery.of(context).viewInsets.bottom,
+ ),
+ duration: Duration.zero,
+ child: child,
+ );
+ }
+ return child;
+ },
);
}
@@ -62,18 +77,15 @@ class _MobileViewItemBottomSheetState extends State<MobileViewItemBottomSheet> {
@override
Widget build(BuildContext context) {
- return Padding(
- padding: const EdgeInsets.fromLTRB(16, 16, 16, 32),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- // header
- _buildHeader(),
- const VSpace(16),
- // body
- _buildBody(),
- ],
- ),
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ // header
+ _buildHeader(),
+ const VSpace(16),
+ // body
+ _buildBody(),
+ ],
);
}
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/setting/personal_info/edit_username_bottom_sheet.dart b/frontend/appflowy_flutter/lib/mobile/presentation/setting/personal_info/edit_username_bottom_sheet.dart
index 026fb8466c..15d5155366 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/setting/personal_info/edit_username_bottom_sheet.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/setting/personal_info/edit_username_bottom_sheet.dart
@@ -46,63 +46,55 @@ class _EditUsernameBottomSheetState extends State<EditUsernameBottomSheet> {
}
}
- return Padding(
- padding: EdgeInsets.only(
- top: 16,
- right: 16,
- left: 16,
- bottom: MediaQuery.of(context).viewInsets.bottom + 32,
- ),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: <Widget>[
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(
- LocaleKeys.settings_mobile_username.tr(),
- style: theme.textTheme.labelSmall,
- ),
- IconButton(
- icon: Icon(
- Icons.close,
- color: theme.hintColor,
- ),
- onPressed: () {
- widget.context.pop();
- },
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ children: <Widget>[
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ children: [
+ Text(
+ LocaleKeys.settings_mobile_username.tr(),
+ style: theme.textTheme.labelSmall,
+ ),
+ IconButton(
+ icon: Icon(
+ Icons.close,
+ color: theme.hintColor,
),
- ],
- ),
- const SizedBox(
- height: 16,
- ),
- Form(
- key: _formKey,
- child: TextFormField(
- controller: _textFieldController,
- keyboardType: TextInputType.text,
- validator: (value) {
- if (value == null || value.isEmpty) {
- return LocaleKeys.settings_mobile_usernameEmptyError.tr();
- }
- return null;
+ onPressed: () {
+ widget.context.pop();
},
- onEditingComplete: submitUserName,
),
+ ],
+ ),
+ const SizedBox(
+ height: 16,
+ ),
+ Form(
+ key: _formKey,
+ child: TextFormField(
+ controller: _textFieldController,
+ keyboardType: TextInputType.text,
+ validator: (value) {
+ if (value == null || value.isEmpty) {
+ return LocaleKeys.settings_mobile_usernameEmptyError.tr();
+ }
+ return null;
+ },
+ onEditingComplete: submitUserName,
),
- const SizedBox(
- height: 16,
- ),
- SizedBox(
- width: double.infinity,
- child: ElevatedButton(
- onPressed: submitUserName,
- child: Text(LocaleKeys.button_update.tr()),
- ),
+ ),
+ const SizedBox(
+ height: 16,
+ ),
+ SizedBox(
+ width: double.infinity,
+ child: ElevatedButton(
+ onPressed: submitUserName,
+ child: Text(LocaleKeys.button_update.tr()),
),
- ],
- ),
+ ),
+ ],
);
}
}
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/setting/personal_info/personal_info_setting_group.dart b/frontend/appflowy_flutter/lib/mobile/presentation/setting/personal_info/personal_info_setting_group.dart
index 844d4fc5ab..2ee20dc46f 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/setting/personal_info/personal_info_setting_group.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/setting/personal_info/personal_info_setting_group.dart
@@ -1,5 +1,6 @@
import 'package:appflowy/env/cloud_env.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
+import 'package:appflowy/mobile/presentation/bottom_sheet/bottom_sheet.dart';
import 'package:appflowy/startup/startup.dart';
import 'package:appflowy/workspace/application/user/prelude.dart';
import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart';
@@ -43,10 +44,8 @@ class PersonalInfoSettingGroup extends StatelessWidget {
: null,
trailing: const Icon(Icons.chevron_right),
onTap: () {
- showModalBottomSheet<void>(
+ showMobileBottomSheet(
context: context,
- // avoid bottom sheet overflow from resizing when keyboard appears
- isScrollControlled: true,
builder: (_) {
return EditUsernameBottomSheet(
context,
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_paginated_bottom_sheet.dart b/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_paginated_bottom_sheet.dart
index 377d3ed4ea..ef444af9f1 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_paginated_bottom_sheet.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_paginated_bottom_sheet.dart
@@ -121,15 +121,12 @@ class FlowyBottomSheetPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
- return Padding(
- padding: const EdgeInsets.fromLTRB(16, 16, 16, 32),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- _SheetTopBar(title: title, isRoot: isRoot),
- child,
- ],
- ),
+ return Column(
+ mainAxisSize: MainAxisSize.min,
+ children: [
+ _SheetTopBar(title: title, isRoot: isRoot),
+ child,
+ ],
);
}
}
diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/date_cell/date_cell.dart b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/date_cell/date_cell.dart
index 51b239b319..a4e554c519 100644
--- a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/date_cell/date_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/date_cell/date_cell.dart
@@ -107,6 +107,7 @@ class _DateCellState extends GridCellState<GridDateCell> {
onTap: () {
showMobileBottomSheet(
context: context,
+ padding: EdgeInsets.zero,
builder: (context) {
return MobileDateCellEditScreen(
controller: widget.cellControllerBuilder.build()
diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/select_option_cell/select_option_cell.dart b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/select_option_cell/select_option_cell.dart
index b0da1272dd..1ad22080f2 100644
--- a/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/select_option_cell/select_option_cell.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database_view/widgets/row/cells/select_option_cell/select_option_cell.dart
@@ -208,6 +208,7 @@ class _SelectOptionWrapState extends State<SelectOptionWrap> {
onTap: () {
showMobileBottomSheet(
context: context,
+ padding: EdgeInsets.zero,
builder: (context) {
return MobileSelectOptionEditor(
cellController: cellController,
diff --git a/frontend/appflowy_flutter/lib/startup/tasks/generate_router.dart b/frontend/appflowy_flutter/lib/startup/tasks/generate_router.dart
index ae72ab74d4..2800ea412c 100644
--- a/frontend/appflowy_flutter/lib/startup/tasks/generate_router.dart
+++ b/frontend/appflowy_flutter/lib/startup/tasks/generate_router.dart
@@ -431,6 +431,7 @@ GoRoute _signInScreenRoute() {
GoRoute _mobileEditorScreenRoute() {
return GoRoute(
path: MobileEditorScreen.routeName,
+ parentNavigatorKey: AppGlobals.rootNavKey,
pageBuilder: (context, state) {
final id = state.uri.queryParameters[MobileEditorScreen.viewId]!;
final title = state.uri.queryParameters[MobileEditorScreen.viewTitle];
@@ -447,6 +448,7 @@ GoRoute _mobileEditorScreenRoute() {
GoRoute _mobileGridScreenRoute() {
return GoRoute(
path: MobileGridScreen.routeName,
+ parentNavigatorKey: AppGlobals.rootNavKey,
pageBuilder: (context, state) {
final id = state.uri.queryParameters[MobileGridScreen.viewId]!;
final title = state.uri.queryParameters[MobileGridScreen.viewTitle];
@@ -463,6 +465,7 @@ GoRoute _mobileGridScreenRoute() {
GoRoute _mobileBoardScreenRoute() {
return GoRoute(
path: MobileBoardScreen.routeName,
+ parentNavigatorKey: AppGlobals.rootNavKey,
pageBuilder: (context, state) {
final id = state.uri.queryParameters[MobileBoardScreen.viewId]!;
final title = state.uri.queryParameters[MobileBoardScreen.viewTitle];
@@ -479,6 +482,7 @@ GoRoute _mobileBoardScreenRoute() {
GoRoute _mobileCalendarScreenRoute() {
return GoRoute(
path: MobileCalendarScreen.routeName,
+ parentNavigatorKey: AppGlobals.rootNavKey,
pageBuilder: (context, state) {
final id = state.uri.queryParameters[MobileCalendarScreen.viewId]!;
final title = state.uri.queryParameters[MobileCalendarScreen.viewTitle]!;