Browse Source

Code refactoring

ashilkn 2 years ago
parent
commit
dc0dcffbef
1 changed files with 11 additions and 20 deletions
  1. 11 20
      lib/ui/components/text_input_widget.dart

+ 11 - 20
lib/ui/components/text_input_widget.dart

@@ -308,26 +308,17 @@ class SuffixIconWidget extends StatelessWidget {
     if (executionState == ExecutionState.idle ||
     if (executionState == ExecutionState.idle ||
         !shouldSurfaceExecutionStates) {
         !shouldSurfaceExecutionStates) {
       if (obscureTextNotifier != null) {
       if (obscureTextNotifier != null) {
-        if (obscureTextNotifier!.value) {
-          trailingWidget = GestureDetector(
-            onTap: () {
-              obscureTextNotifier!.value = !obscureTextNotifier!.value;
-            },
-            child: Icon(
-              Icons.visibility_off_outlined,
-              color: colorScheme.strokeMuted,
-            ),
-          );
-        } else {
-          trailingWidget = GestureDetector(
-            onTap: () {
-              obscureTextNotifier!.value = !obscureTextNotifier!.value;
-            },
-            child: const Icon(
-              Icons.visibility,
-            ),
-          );
-        }
+        trailingWidget = GestureDetector(
+          onTap: () {
+            obscureTextNotifier!.value = !obscureTextNotifier!.value;
+          },
+          child: Icon(
+            obscureTextNotifier!.value
+                ? Icons.visibility_off_outlined
+                : Icons.visibility,
+            color: obscureTextNotifier!.value ? colorScheme.strokeMuted : null,
+          ),
+        );
       } else {
       } else {
         trailingWidget = const SizedBox.shrink();
         trailingWidget = const SizedBox.shrink();
       }
       }