Przeglądaj źródła

removed SmallGradientButton

ashilkn 2 lat temu
rodzic
commit
242498b6a6

+ 0 - 88
lib/ui/common/small_gradient_button_widget.dart

@@ -1,88 +0,0 @@
-import 'package:flutter/material.dart';
-
-class SmallGradientButton extends StatelessWidget {
-  final List<Color> linearGradientColors;
-  final Function onTap;
-  final Widget child;
-  // text is ignored if child is specified
-  final String text;
-  // nullable
-  final IconData iconData;
-  // padding between the text and icon
-  final double spacingBetweenItems;
-
-  const SmallGradientButton({
-    Key key,
-    this.child,
-    this.linearGradientColors = const [
-      Color(0xFF2CD267),
-      Color(0xFF1DB954),
-    ],
-    this.onTap,
-    this.text,
-    this.iconData,
-    this.spacingBetweenItems = 12,
-  }) : super(key: key);
-
-  @override
-  Widget build(BuildContext context) {
-    Widget buttonContent;
-    if (child != null) {
-      buttonContent = child;
-    } else if (iconData == null) {
-      buttonContent = Center(
-        child: Text(
-          text,
-          style: const TextStyle(
-            color: Colors.white,
-            fontWeight: FontWeight.w600,
-            fontFamily: 'Inter',
-            fontSize: 16,
-          ),
-        ),
-      );
-    } else {
-      buttonContent = Row(
-        mainAxisAlignment: MainAxisAlignment.center,
-        crossAxisAlignment: CrossAxisAlignment.center,
-        children: [
-          Icon(
-            iconData,
-            color: Colors.white,
-            size: 20,
-          ),
-          SizedBox(width: spacingBetweenItems),
-          Text(
-            text,
-            style: const TextStyle(
-              color: Colors.white,
-              fontWeight: FontWeight.w600,
-              fontFamily: 'Inter',
-              fontSize: 16,
-            ),
-          ),
-        ],
-      );
-    }
-    return InkWell(
-      onTap: onTap,
-      child: Container(
-        height: 44,
-        decoration: BoxDecoration(
-          gradient: LinearGradient(
-            begin: const Alignment(0.1, -0.9),
-            end: const Alignment(-0.6, 0.9),
-            colors: linearGradientColors,
-          ),
-          borderRadius: BorderRadius.circular(4),
-        ),
-        child: Center(
-          child: Container(
-            constraints: const BoxConstraints(minWidth: 118),
-            child: buttonContent,
-          ),
-        ),
-      ),
-    );
-  }
-}

+ 6 - 5
lib/ui/tools/lock_screen.dart

@@ -1,6 +1,6 @@
 import 'package:flutter/material.dart';
 import 'package:flutter/material.dart';
 import 'package:logging/logging.dart';
 import 'package:logging/logging.dart';
-import 'package:photos/ui/common/small_gradient_button_widget.dart';
+import 'package:photos/ui/common/gradient_button.dart';
 import 'package:photos/ui/tools/app_lock.dart';
 import 'package:photos/ui/tools/app_lock.dart';
 import 'package:photos/utils/auth_util.dart';
 import 'package:photos/utils/auth_util.dart';
 
 
@@ -36,13 +36,14 @@ class _LockScreenState extends State<LockScreen> {
                   child: Image.asset('assets/loading_photos_background.png'),
                   child: Image.asset('assets/loading_photos_background.png'),
                 ),
                 ),
                 SizedBox(
                 SizedBox(
-                  width: 118,
-                  child: SmallGradientButton(
+                  width: 142,
+                  child: GradientButton(
+                    text: "Unlock",
+                    iconData: Icons.lock_open_outlined,
+                    paddingValue: 6,
                     onTap: () async {
                     onTap: () async {
                       _showLockScreen();
                       _showLockScreen();
                     },
                     },
-                    text: "Unlock",
-                    iconData: Icons.lock_open_outlined,
                   ),
                   ),
                 ),
                 ),
               ],
               ],