fix: apply disabled styling to UI buttons (#30322)

Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
shenlong
2026-07-30 09:23:08 +00:00
committed by GitHub
co-authored by shenlong-tanwen
parent 9d03a92b10
commit 7e70f90c15
3 changed files with 9 additions and 42 deletions
@@ -43,21 +43,10 @@ class _ImmichColumnButtonState extends State<ImmichColumnButton> {
}
}
Future<void>? _onPressed() {
if (_isDisabled) {
return null;
}
VoidCallback? get _onPressed => _isDisabled ? null : () => _runAction(widget.onPressed);
return _runAction(widget.onPressed);
}
Future<void>? _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) {
@@ -44,21 +44,10 @@ class _ImmichIconButtonState extends State<ImmichIconButton> {
}
}
Future<void>? _onPressed() {
if (_isDisabled) {
return null;
}
VoidCallback? get _onPressed => _isDisabled ? null : () => _runAction(widget.onPressed);
return _runAction(widget.onPressed);
}
Future<void>? _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) {
@@ -46,21 +46,10 @@ class _ImmichTextButtonState extends State<ImmichTextButton> {
}
}
Future<void>? _onPressed() {
if (_isDisabled) {
return null;
}
VoidCallback? get _onPressed => _isDisabled ? null : () => _runAction(widget.onPressed);
return _runAction(widget.onPressed);
}
Future<void>? _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) {