From 746f0817bc4f41c6c22aa24f8ecaf55b09852678 Mon Sep 17 00:00:00 2001 From: Richard Shiue <71320345+richardshiue@users.noreply.github.com> Date: Fri, 23 Feb 2024 10:49:34 +0800 Subject: [PATCH] fix: show database view options for inline as disabled (#4711) --- .../view/database_view_quick_actions.dart | 32 ++++++++++++------- .../flowy_mobile_quick_action_button.dart | 8 +++-- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_view_quick_actions.dart b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_view_quick_actions.dart index 49d88cd249..6902903f3b 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_view_quick_actions.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/database/view/database_view_quick_actions.dart @@ -46,19 +46,27 @@ class MobileDatabaseViewQuickActions extends StatelessWidget { ), ); }), - if (!isInline) ...[ - _divider(), - _actionButton(context, _Action.duplicate, () { + _divider(), + _actionButton( + context, + _Action.duplicate, + () { context.read().add(const ViewEvent.duplicate()); context.pop(); - }), - _divider(), - _actionButton(context, _Action.delete, () { + }, + !isInline, + ), + _divider(), + _actionButton( + context, + _Action.delete, + () { context.read().add(const ViewEvent.delete()); context.pop(); - }), - _divider(), - ], + }, + !isInline, + ), + _divider(), ], ); } @@ -66,14 +74,16 @@ class MobileDatabaseViewQuickActions extends StatelessWidget { Widget _actionButton( BuildContext context, _Action action, - VoidCallback onTap, - ) { + VoidCallback onTap, [ + bool enable = true, + ]) { return MobileQuickActionButton( icon: action.icon, text: action.label, textColor: action.color(context), iconColor: action.color(context), onTap: onTap, + enable: enable, ); } diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_mobile_quick_action_button.dart b/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_mobile_quick_action_button.dart index a267085dbc..ad5ac13bd5 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_mobile_quick_action_button.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/widgets/flowy_mobile_quick_action_button.dart @@ -10,6 +10,7 @@ class MobileQuickActionButton extends StatelessWidget { required this.text, this.textColor, this.iconColor, + this.enable = true, }); final VoidCallback onTap; @@ -17,6 +18,7 @@ class MobileQuickActionButton extends StatelessWidget { final String text; final Color? textColor; final Color? iconColor; + final bool enable; @override Widget build(BuildContext context) { @@ -25,6 +27,8 @@ class MobileQuickActionButton extends StatelessWidget { child: InkWell( onTap: onTap, borderRadius: BorderRadius.circular(12), + overlayColor: + enable ? null : const MaterialStatePropertyAll(Colors.transparent), splashColor: Colors.transparent, child: Container( height: 44, @@ -34,14 +38,14 @@ class MobileQuickActionButton extends StatelessWidget { FlowySvg( icon, size: const Size.square(20), - color: iconColor, + color: enable ? iconColor : Theme.of(context).disabledColor, ), const HSpace(12), Expanded( child: FlowyText( text, fontSize: 15, - color: textColor, + color: enable ? textColor : Theme.of(context).disabledColor, ), ), ],