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

This commit is contained in:
Yijing Huang 2023-12-28 18:47:03 -07:00 committed by GitHub
parent 65f3296508
commit 43a3a1e4b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 15 additions and 88 deletions

View File

@ -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: [

View File

@ -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(

View File

@ -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(

View File

@ -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();
},
),
],
);
}
}

View File

@ -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';

View File

@ -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(