From 1777641eafcac8e824a0b72831f1c998e31cbad3 Mon Sep 17 00:00:00 2001 From: "Michael W. Aziz" Date: Tue, 14 May 2024 13:49:55 +0300 Subject: [PATCH] [DEV] updated and activated the Widgets elements --- README.md | 6 +-- lib/astromic_mobile_elements.dart | 2 +- lib/src/Spacing/spacing.astromic.dart | 58 ++++++++++++++------------- 3 files changed, 35 insertions(+), 31 deletions(-) diff --git a/README.md b/README.md index 9afe7be..baf5aad 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,6 @@ Developed, Maintained, and is property of Michael W. Aziz (Micazi) - Selectors - Toggles - Widgets - - Image ☑️ - - Scaffold ☑️ - - Blur ☑️ + - Image + - Scaffold + - Blur diff --git a/lib/astromic_mobile_elements.dart b/lib/astromic_mobile_elements.dart index 5771740..3ed161c 100644 --- a/lib/astromic_mobile_elements.dart +++ b/lib/astromic_mobile_elements.dart @@ -2,11 +2,11 @@ library astromic_mobile_elements; // export './src/Spacing/spacing.astromic.dart'; +export './src/Widgets/widgets.astromic.dart'; // export './src/2.Buttons/buttons.astromic.dart'; // export './src/3.Selectors/selectors.astromic.dart'; // export './src/4.Toggles/toggles.astromic.dart'; // export './src/5.Fields/fields.astromic.dart'; -// export './src/6.Widgets/Widgets.astromic.dart'; // // // export './src/styles/styles.astromic.dart'; // export './src/configurations/configs.astromic.dart'; \ No newline at end of file diff --git a/lib/src/Spacing/spacing.astromic.dart b/lib/src/Spacing/spacing.astromic.dart index d1469c0..8bf4082 100644 --- a/lib/src/Spacing/spacing.astromic.dart +++ b/lib/src/Spacing/spacing.astromic.dart @@ -2,8 +2,8 @@ import 'package:flutter/material.dart'; class AstromicSpacing { //S1 -- SizedBox - static Widget vsb([double h = 0]) => SizedBox(height: h); - static Widget hsb([double w = 0]) => SizedBox(width: w); + static Widget vsb([double h = 10]) => SizedBox(height: h); + static Widget hsb([double w = 10]) => SizedBox(width: w); //s1 --- FLEXER static Widget flexer(int factor, [Widget? child]) => factor >= 0 @@ -17,33 +17,37 @@ class AstromicSpacing { //S1 --- DIVIDER static divider( - double thickness, - Color color, { + double thickness, { + Color? color, + Gradient? gradient, + Axis mode = Axis.horizontal, double length = 24.0, double margin = 8.0, - Axis mode = Axis.horizontal, bool rounded = true, - }) => - SizedBox( - height: mode == Axis.horizontal - ? thickness + (2 * margin) - : mode == Axis.vertical - ? length - : 0, - width: mode == Axis.vertical - ? thickness + (2 * margin) - : mode == Axis.horizontal - ? length - : 0, - child: Container( - margin: EdgeInsets.symmetric( - horizontal: mode == Axis.vertical ? margin : 0, - vertical: mode == Axis.horizontal ? margin : 0, - ), - decoration: BoxDecoration( - color: color, - borderRadius: rounded ? BorderRadius.circular(1000) : BorderRadius.zero, - ), + }) { + assert(color != null && gradient == null || color == null && gradient != null, "You can't provide both a color and a gradient."); + return SizedBox( + height: mode == Axis.horizontal + ? thickness + (2 * margin) + : mode == Axis.vertical + ? length + : 0, + width: mode == Axis.vertical + ? thickness + (2 * margin) + : mode == Axis.horizontal + ? length + : 0, + child: Container( + margin: EdgeInsets.symmetric( + horizontal: mode == Axis.vertical ? margin : 0, + vertical: mode == Axis.horizontal ? margin : 0, ), - ); + decoration: BoxDecoration( + color: gradient != null ? null : color, + gradient: color != null ? null : gradient, + borderRadius: rounded ? BorderRadius.circular(1000) : BorderRadius.zero, + ), + ), + ); + } }