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.

chore: remove showFlowyMobileBottomSheet and replaced by showMobileBottomSheet (#4234)

Yijing Huang43a3a1e4b224
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/board/widgets/group_card_header.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/board/widgets/group_card_header.dart
index b5bfbea08b..1cf762c38f 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/board/widgets/group_card_header.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/board/widgets/group_card_header.dart
@@ -1,7 +1,6 @@
import 'package:appflowy/generated/flowy_svgs.g.dart';
import 'package:appflowy/generated/locale_keys.g.dart';
-import 'package:appflowy/mobile/presentation/bottom_sheet/bottom_sheet_action_widget.dart';
-import 'package:appflowy/mobile/presentation/widgets/show_flowy_mobile_bottom_sheet.dart';
+import 'package:appflowy/mobile/presentation/bottom_sheet/bottom_sheet.dart';
import 'package:appflowy/plugins/database_view/board/application/board_bloc.dart';
import 'package:appflowy/plugins/database_view/grid/presentation/widgets/header/field_type_extension.dart';
import 'package:appflowy_backend/protobuf/flowy-database2/field_entities.pbenum.dart';
@@ -107,9 +106,11 @@ class _GroupCardHeaderState extends State<GroupCardHeader> {
color: Theme.of(context).colorScheme.onSurface,
),
splashRadius: 5,
- onPressed: () => showFlowyMobileBottomSheet(
+ onPressed: () => showMobileBottomSheet(
context,
title: LocaleKeys.board_column_groupActions.tr(),
+ showHeader: true,
+ showCloseButton: true,
builder: (_) {
return Row(
children: [
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_detail/cells/url_cell.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_detail/cells/url_cell.dart
index bee9610769..5ab4e617aa 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_detail/cells/url_cell.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/card/card_detail/cells/url_cell.dart
@@ -1,6 +1,6 @@
import 'dart:async';
import 'package:appflowy/generated/locale_keys.g.dart';
-import 'package:appflowy/mobile/presentation/widgets/widgets.dart';
+import 'package:appflowy/mobile/presentation/bottom_sheet/show_mobile_bottom_sheet.dart';
import 'package:appflowy/plugins/database_view/application/cell/cell_controller_builder.dart';
import 'package:appflowy/plugins/database_view/widgets/row/cell_builder.dart';
import 'package:appflowy/plugins/database_view/widgets/row/cells/url_cell/url_cell_bloc.dart';
@@ -98,9 +98,11 @@ class _RowDetailURLCellState extends GridCellState<RowDetailURLCell> {
}
void _showURLEditor(String content) {
- showFlowyMobileBottomSheet(
+ showMobileBottomSheet(
context,
title: LocaleKeys.board_mobile_editURL.tr(),
+ showHeader: true,
+ showCloseButton: true,
builder: (_) {
final controller = TextEditingController(text: content);
return TextField(
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/card/row/cells/mobile_url_cell.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/card/row/cells/mobile_url_cell.dart
index 1d86abdd36..79c4760847 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/database/card/row/cells/mobile_url_cell.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/card/row/cells/mobile_url_cell.dart
@@ -1,6 +1,6 @@
import 'dart:async';
import 'package:appflowy/generated/locale_keys.g.dart';
-import 'package:appflowy/mobile/presentation/widgets/widgets.dart';
+import 'package:appflowy/mobile/presentation/bottom_sheet/show_mobile_bottom_sheet.dart';
import 'package:appflowy/plugins/database_view/application/cell/cell_controller_builder.dart';
import 'package:appflowy/plugins/database_view/widgets/row/cell_builder.dart';
import 'package:appflowy/plugins/database_view/widgets/row/cells/url_cell/url_cell_bloc.dart';
@@ -83,9 +83,11 @@ class _GridURLCellState extends GridCellState<MobileURLCell> {
final url = shouldAddScheme ? 'http://$content' : content;
canLaunchUrlString(url).then((value) => launchUrlString(url));
},
- onLongPress: () => showFlowyMobileBottomSheet(
+ onLongPress: () => showMobileBottomSheet(
context,
title: LocaleKeys.board_mobile_editURL.tr(),
+ showHeader: true,
+ showCloseButton: true,
builder: (_) {
final controller = TextEditingController(text: content);
return TextField(
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/widgets/show_flowy_mobile_bottom_sheet.dart b/frontend/appflowy_flutter/lib/mobile/presentation/widgets/show_flowy_mobile_bottom_sheet.dart
deleted file mode 100644
index fd1ca38160..0000000000
--- a/frontend/appflowy_flutter/lib/mobile/presentation/widgets/show_flowy_mobile_bottom_sheet.dart
+++ /dev/null
@@ -1,78 +0,0 @@
-import 'package:flowy_infra/size.dart';
-import 'package:flutter/material.dart';
-import 'package:go_router/go_router.dart';
-
-Future<T?> showFlowyMobileBottomSheet<T>(
- BuildContext context, {
- required String title,
- required Widget Function(BuildContext) builder,
- bool resizeToAvoidBottomInset = true,
- bool isScrollControlled = false,
-}) async {
- return showModalBottomSheet(
- context: context,
- isScrollControlled: isScrollControlled,
- shape: const RoundedRectangleBorder(
- borderRadius: BorderRadius.vertical(
- top: Corners.s12Radius,
- ),
- ),
- builder: (context) {
- const padding = EdgeInsets.fromLTRB(16, 16, 16, 48);
-
- final child = Padding(
- padding: padding,
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: [
- _BottomSheetTitle(title),
- const SizedBox(
- height: 16,
- ),
- builder(context),
- ],
- ),
- );
- if (resizeToAvoidBottomInset) {
- return AnimatedPadding(
- padding: padding +
- EdgeInsets.only(
- bottom: MediaQuery.of(context).viewInsets.bottom,
- ),
- duration: Duration.zero,
- child: child,
- );
- }
- return child;
- },
- );
-}
-
-class _BottomSheetTitle extends StatelessWidget {
- const _BottomSheetTitle(this.title);
-
- final String title;
-
- @override
- Widget build(BuildContext context) {
- final theme = Theme.of(context);
- return Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(
- title,
- style: theme.textTheme.labelSmall,
- ),
- IconButton(
- icon: Icon(
- Icons.close,
- color: theme.hintColor,
- ),
- onPressed: () {
- context.pop();
- },
- ),
- ],
- );
- }
-}
diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/widgets/widgets.dart b/frontend/appflowy_flutter/lib/mobile/presentation/widgets/widgets.dart
index 6c0507ede4..4b1c1eedef 100644
--- a/frontend/appflowy_flutter/lib/mobile/presentation/widgets/widgets.dart
+++ b/frontend/appflowy_flutter/lib/mobile/presentation/widgets/widgets.dart
@@ -1,5 +1,4 @@
export 'flowy_mobile_option_decorate_box.dart';
export 'flowy_mobile_state_container.dart';
export 'flowy_option_tile.dart';
-export 'show_flowy_mobile_bottom_sheet.dart';
export 'show_flowy_mobile_confirm_dialog.dart';
diff --git a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/calendar_page.dart b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/calendar_page.dart
index f18bc4c250..cdb9530992 100644
--- a/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/calendar_page.dart
+++ b/frontend/appflowy_flutter/lib/plugins/database_view/calendar/presentation/calendar_page.dart
@@ -3,7 +3,6 @@ import 'package:appflowy/generated/locale_keys.g.dart';
import 'package:appflowy/mobile/presentation/bottom_sheet/bottom_sheet.dart';
import 'package:appflowy/mobile/presentation/database/card/card.dart';
import 'package:appflowy/mobile/presentation/presentation.dart';
-import 'package:appflowy/mobile/presentation/widgets/show_flowy_mobile_bottom_sheet.dart';
import 'package:appflowy/plugins/database_view/application/database_controller.dart';
import 'package:appflowy/plugins/database_view/application/field/field_controller.dart';
import 'package:appflowy/plugins/database_view/calendar/application/calendar_bloc.dart';
@@ -222,9 +221,11 @@ class _CalendarPageState extends State<CalendarPage> {
children: [
GestureDetector(
onTap: PlatformExtension.isMobile
- ? () => showFlowyMobileBottomSheet(
+ ? () => showMobileBottomSheet(
context,
title: LocaleKeys.calendar_quickJumpYear.tr(),
+ showHeader: true,
+ showCloseButton: true,
builder: (_) => SizedBox(
height: 200,
child: YearPicker(