From 470fc23d15b20abd57027c5e0decf1bbbbcfac45 Mon Sep 17 00:00:00 2001 From: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Date: Tue, 28 Jul 2026 17:39:21 +0530 Subject: [PATCH] fix: apply disabled styling to UI buttons --- .../ui/lib/src/components/column_button.dart | 17 +++-------------- .../ui/lib/src/components/icon_button.dart | 17 +++-------------- .../ui/lib/src/components/text_button.dart | 17 +++-------------- 3 files changed, 9 insertions(+), 42 deletions(-) diff --git a/mobile/packages/ui/lib/src/components/column_button.dart b/mobile/packages/ui/lib/src/components/column_button.dart index f990dbc065..03b6933389 100644 --- a/mobile/packages/ui/lib/src/components/column_button.dart +++ b/mobile/packages/ui/lib/src/components/column_button.dart @@ -43,21 +43,10 @@ class _ImmichColumnButtonState extends State { } } - Future? _onPressed() { - if (_isDisabled) { - return null; - } + VoidCallback? get _onPressed => _isDisabled ? null : () => _runAction(widget.onPressed); - return _runAction(widget.onPressed); - } - - Future? _onLongPress() { - if (_isDisabled || widget.onLongPress == null) { - return null; - } - - return _runAction(widget.onLongPress!); - } + VoidCallback? get _onLongPress => + _isDisabled || widget.onLongPress == null ? null : () => _runAction(widget.onLongPress!); @override Widget build(BuildContext context) { diff --git a/mobile/packages/ui/lib/src/components/icon_button.dart b/mobile/packages/ui/lib/src/components/icon_button.dart index 1c02f30ed3..c0e1bcc3fa 100644 --- a/mobile/packages/ui/lib/src/components/icon_button.dart +++ b/mobile/packages/ui/lib/src/components/icon_button.dart @@ -44,21 +44,10 @@ class _ImmichIconButtonState extends State { } } - Future? _onPressed() { - if (_isDisabled) { - return null; - } + VoidCallback? get _onPressed => _isDisabled ? null : () => _runAction(widget.onPressed); - return _runAction(widget.onPressed); - } - - Future? _onLongPress() { - if (_isDisabled || widget.onLongPress == null) { - return null; - } - - return _runAction(widget.onLongPress!); - } + VoidCallback? get _onLongPress => + _isDisabled || widget.onLongPress == null ? null : () => _runAction(widget.onLongPress!); @override Widget build(BuildContext context) { diff --git a/mobile/packages/ui/lib/src/components/text_button.dart b/mobile/packages/ui/lib/src/components/text_button.dart index bbcfe4a3a7..6cbc08473b 100644 --- a/mobile/packages/ui/lib/src/components/text_button.dart +++ b/mobile/packages/ui/lib/src/components/text_button.dart @@ -46,21 +46,10 @@ class _ImmichTextButtonState extends State { } } - Future? _onPressed() { - if (_isDisabled) { - return null; - } + VoidCallback? get _onPressed => _isDisabled ? null : () => _runAction(widget.onPressed); - return _runAction(widget.onPressed); - } - - Future? _onLongPress() { - if (_isDisabled || widget.onLongPress == null) { - return null; - } - - return _runAction(widget.onLongPress!); - } + VoidCallback? get _onLongPress => + _isDisabled || widget.onLongPress == null ? null : () => _runAction(widget.onLongPress!); @override Widget build(BuildContext context) {