diff --git a/lib/views/add_token_manually_view/add_token_manually_view_widgets/labeled_dropdown_button.dart b/lib/views/add_token_manually_view/add_token_manually_view_widgets/labeled_dropdown_button.dart index c79e56843..bd662e8e1 100644 --- a/lib/views/add_token_manually_view/add_token_manually_view_widgets/labeled_dropdown_button.dart +++ b/lib/views/add_token_manually_view/add_token_manually_view_widgets/labeled_dropdown_button.dart @@ -19,6 +19,7 @@ */ import 'package:flutter/material.dart'; import '../../../utils/logger.dart'; +import '../../../widgets/deactivateable.dart'; import 'add_token_manually_row.dart'; class LabeledDropdownButton extends StatefulWidget { @@ -62,41 +63,35 @@ class _LabeledDropdownButtonState extends State> { @override Widget build(BuildContext context) { - final child = AddTokenManuallyRow( - label: widget.label, - child: DropdownButton( - value: widget.valueNotifier?.value != null && widget.values.contains(widget.valueNotifier!.value) - ? widget.valueNotifier!.value - : widget.values.firstOrNull, - isExpanded: true, - items: [ - for (var i = 0; i < widget.values.length; i++) - DropdownMenuItem( - value: widget.values[i], - child: Text( - '${widget.valueLabels != null && i < widget.valueLabels!.length ? widget.valueLabels![i] : widget.values[i].toString()}' - ' ${widget.postFix}', - style: Theme.of(context).textTheme.bodyMedium, - overflow: TextOverflow.fade, - softWrap: false, + return Deactivateable( + deactivated: !widget.enabled, + child: AddTokenManuallyRow( + label: widget.label, + child: DropdownButton( + value: widget.valueNotifier?.value != null && widget.values.contains(widget.valueNotifier!.value) + ? widget.valueNotifier!.value + : widget.values.firstOrNull, + isExpanded: true, + items: [ + for (var i = 0; i < widget.values.length; i++) + DropdownMenuItem( + value: widget.values[i], + child: Text( + '${widget.valueLabels != null && i < widget.valueLabels!.length ? widget.valueLabels![i] : widget.values[i].toString()}' + ' ${widget.postFix}', + style: Theme.of(context).textTheme.bodyMedium, + overflow: TextOverflow.fade, + softWrap: false, + ), ), - ), - ], - onChanged: (T? newValue) { - if (newValue == null) return; - Logger.info('DropdownButton onChanged: $newValue'); - widget.valueNotifier?.value = newValue; - }, + ], + onChanged: (T? newValue) { + if (newValue == null) return; + Logger.info('DropdownButton onChanged: $newValue'); + widget.valueNotifier?.value = newValue; + }, + ), ), ); - - return widget.enabled - ? child - : ShaderMask( - shaderCallback: (Rect bounds) => LinearGradient( - colors: [Colors.grey.shade600, Colors.grey.shade600], - ).createShader(bounds), - child: IgnorePointer(ignoring: true, child: child), - ); } } diff --git a/lib/widgets/deactivated.dart b/lib/widgets/deactivateable.dart similarity index 100% rename from lib/widgets/deactivated.dart rename to lib/widgets/deactivateable.dart