Переглянути джерело

Add theme for elevated button

Neeraj Gupta 3 роки тому
батько
коміт
66849fae96
2 змінених файлів з 64 додано та 0 видалено
  1. 32 0
      lib/app.dart
  2. 32 0
      lib/ui/common/custom_color_scheme.dart

+ 32 - 0
lib/app.dart

@@ -56,6 +56,22 @@ final lightThemeData = ThemeData(
       alignment: Alignment.center,
     ),
   ),
+  elevatedButtonTheme: ElevatedButtonThemeData(
+      style: ElevatedButton.styleFrom(
+    onPrimary: Colors.white,
+    primary: Colors.black,
+    alignment: Alignment.center,
+    textStyle: TextStyle(
+      fontWeight: FontWeight.w600,
+      fontFamily: 'Inter-SemiBold',
+      fontSize: 18,
+    ),
+    padding: EdgeInsets.symmetric(vertical: 14),
+    shape: const RoundedRectangleBorder(
+      borderRadius: BorderRadius.all(Radius.circular(8)),
+    ),
+  )),
+
   toggleableActiveColor: Colors.red[400],
   scaffoldBackgroundColor: Colors.white,
   bottomAppBarColor: Color.fromRGBO(196, 196, 196, 1.0),
@@ -178,6 +194,22 @@ final darkThemeData = ThemeData(
       alignment: Alignment.center,
     ),
   ),
+  elevatedButtonTheme: ElevatedButtonThemeData(
+      style: ElevatedButton.styleFrom(
+    onPrimary: Colors.black,
+    primary: Colors.white,
+    minimumSize: Size(88, 36),
+    alignment: Alignment.center,
+    textStyle: TextStyle(
+      fontWeight: FontWeight.w600,
+      fontFamily: 'Inter-SemiBold',
+      fontSize: 18,
+    ),
+    padding: EdgeInsets.symmetric(vertical: 14),
+    shape: const RoundedRectangleBorder(
+      borderRadius: BorderRadius.all(Radius.circular(8)),
+    ),
+  )),
   scaffoldBackgroundColor: Colors.black,
   backgroundColor: Colors.black,
   appBarTheme: AppBarTheme().copyWith(

+ 32 - 0
lib/ui/common/custom_color_scheme.dart

@@ -13,4 +13,36 @@ extension CustomColorScheme on ColorScheme {
   Color get boxUnSelectColor => brightness == Brightness.light
       ? Color.fromRGBO(240, 240, 240, 1)
       : Color.fromRGBO(8, 18, 18, 0.4);
+
+  ButtonStyle get primaryActionButtonStyle => ElevatedButton.styleFrom(
+        onPrimary: Colors.white,
+        primary: Color.fromRGBO(29, 185, 84, 1.0),
+        minimumSize: Size(88, 36),
+        alignment: Alignment.center,
+        textStyle: TextStyle(
+          fontWeight: FontWeight.w600,
+          fontFamily: 'Inter-SemiBold',
+          fontSize: 18,
+        ),
+        padding: EdgeInsets.symmetric(vertical: 14),
+        shape: const RoundedRectangleBorder(
+          borderRadius: BorderRadius.all(Radius.circular(8)),
+        ),
+      );
+
+  ButtonStyle get optionalActionButtonStyle => ElevatedButton.styleFrom(
+        onPrimary: Colors.black87,
+        primary: Color.fromRGBO(240, 240, 240, 1),
+        minimumSize: Size(88, 36),
+        alignment: Alignment.center,
+        textStyle: TextStyle(
+          fontWeight: FontWeight.w600,
+          fontFamily: 'Inter-SemiBold',
+          fontSize: 18,
+        ),
+        padding: EdgeInsets.symmetric(vertical: 14),
+        shape: const RoundedRectangleBorder(
+          borderRadius: BorderRadius.all(Radius.circular(8)),
+        ),
+      );
 }