From 228695d51798c8075d91cbec4d705d97940247c3 Mon Sep 17 00:00:00 2001 From: appflowy Date: Fri, 6 May 2022 20:21:50 +0800 Subject: [PATCH] chore: add close button on row detail page --- .../grid/src/widgets/row/row_detail.dart | 28 ++++++++++++++++++- .../lib/src/flowy_overlay/flowy_overlay.dart | 2 +- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart index 7e2ece2cf5..6984d1ebca 100644 --- a/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart +++ b/frontend/app_flowy/lib/workspace/presentation/plugins/grid/src/widgets/row/row_detail.dart @@ -6,9 +6,11 @@ import 'package:app_flowy/workspace/presentation/plugins/grid/src/layout/sizes.d import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/cell/prelude.dart'; import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/header/field_cell.dart'; import 'package:app_flowy/workspace/presentation/plugins/grid/src/widgets/header/field_editor.dart'; +import 'package:flowy_infra/image.dart'; import 'package:flowy_infra/theme.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/style_widget/hover.dart'; +import 'package:flowy_infra_ui/style_widget/icon_button.dart'; import 'package:flowy_infra_ui/style_widget/scrolling/styled_scroll_bar.dart'; import 'package:flowy_infra_ui/widget/spacing.dart'; import 'package:flowy_sdk/protobuf/flowy-grid-data-model/grid.pb.dart' show FieldType; @@ -66,12 +68,36 @@ class _RowDetailPageState extends State { }, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 80, vertical: 40), - child: _PropertyList(cellCache: widget.cellCache), + child: Column( + children: [ + SizedBox( + height: 40, + child: Row( + children: const [Spacer(), _CloseButton()], + )), + Expanded(child: _PropertyList(cellCache: widget.cellCache)), + ], + ), ), ); } } +class _CloseButton extends StatelessWidget { + const _CloseButton({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + final theme = context.watch(); + return FlowyIconButton( + width: 24, + onPressed: () => FlowyOverlay.of(context).remove(RowDetailPage.identifier()), + iconPadding: const EdgeInsets.fromLTRB(2, 2, 2, 2), + icon: svgWidget("home/close", color: theme.iconColor), + ); + } +} + class _PropertyList extends StatelessWidget { final GridCellCache cellCache; final ScrollController _scrollController; diff --git a/frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_overlay.dart b/frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_overlay.dart index 0f6cecf0bc..7ed3c04673 100644 --- a/frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_overlay.dart +++ b/frontend/app_flowy/packages/flowy_infra_ui/lib/src/flowy_overlay/flowy_overlay.dart @@ -176,7 +176,6 @@ class FlowyOverlayState extends State { FlowyOverlayStyle? style, Offset? anchorOffset, }) { - debugPrint("Show overlay: $identifier"); this.style = style ?? FlowyOverlayStyle(); _showOverlay( @@ -245,6 +244,7 @@ class FlowyOverlayState extends State { OverlapBehaviour? overlapBehaviour, FlowyOverlayDelegate? delegate, }) { + debugPrint("Show overlay: $identifier"); Widget overlay = widget; final offset = anchorOffset ?? Offset.zero;