[DEV] updated and activated the Widgets elements

This commit is contained in:
2024-05-14 13:49:55 +03:00
parent dcc53dbc0a
commit 1777641eaf
3 changed files with 35 additions and 31 deletions

View File

@@ -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';

View File

@@ -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,
),
),
);
}
}