DEV: Spacing & Widgets

This commit is contained in:
2024-04-22 18:30:31 +02:00
parent 8d26230200
commit 081fa78486
13 changed files with 686 additions and 93 deletions

View File

@@ -0,0 +1,157 @@
import 'dart:typed_data';
import 'dart:ui';
//s2 Core Packages Imports
import 'package:astromic_mobile_elements/src/Widgets/src/blur.widget.dart';
import 'package:astromic_mobile_elements/src/Widgets/src/scaffold.widget.dart';
import 'src/image.widget.dart';
import 'package:flutter/material.dart';
class AstromicWidgets {
//S1 -- SCAFFOLD
static Widget scaffold({
//S1 -- AppBar
PreferredSizeWidget? appBar,
bool isAppbarStacked = false,
//S1 -- FAB
Widget? floatingActionButton,
FloatingActionButtonLocation? floatingActionButtonLocation,
//S1 -- Other Integral Components
Widget? drawer,
Widget? bottomNavigationBar,
Widget? bottomSheet,
//S1 -- Styling
Color? backgroundColor,
EdgeInsetsGeometry? padding,
ScrollPhysics? scrollPhysics = const BouncingScrollPhysics(),
//S1 -- Configs
bool withSafeArea = false,
bool extendBody = false,
bool resizeToAvoidBottomInset = true,
bool withScrollView = false,
bool closeKeyboardOnTap = true,
//
Widget? body,
//
}) =>
astromicScaffold(
//
appBar: appBar,
isAppbarStacked: isAppbarStacked,
//
floatingActionButton: floatingActionButton,
floatingActionButtonLocation: floatingActionButtonLocation,
//
drawer: drawer,
bottomNavigationBar: bottomNavigationBar,
bottomSheet: bottomSheet,
//
backgroundColor: backgroundColor,
padding: padding,
scrollPhysics: scrollPhysics,
//
withSafeArea: withSafeArea,
extendBody: extendBody,
resizeToAvoidBottomInset: resizeToAvoidBottomInset,
withScrollView: withScrollView,
closeKeyboardOnTap: closeKeyboardOnTap,
//
body: body,
);
//S1 -- IMAGE
static Widget image(
BuildContext context, {
//S1 -- Asset
String? assetPath,
String? assetURL,
Uint8List? assetBytes,
String? assetFallback,
//S1 -- Sizing | Width
double? wFactor,
double? minW,
double? maxW,
double? fixedWidth,
//S1 -- Sizing | Width
bool useHeight = false,
double? hFactor,
double? minH,
double? maxH,
double? fixedHeight,
//S1 -- STYLING
bool circular = false,
double? border,
Color? borderColor,
EdgeInsetsGeometry? borderPadding,
BorderRadiusGeometry radius = BorderRadius.zero,
List<BoxShadow>? shadow,
//S1 -- SVG FILTERS
Color? color,
BlendMode? blend,
//S1 -- CONFIGS
BoxFit fit = BoxFit.cover,
Alignment alignment = Alignment.center,
LinearGradient? linearGradient,
//S1 -- STATE
Widget? loadingWidget,
Widget? errorWidget,
}) =>
astromicImage(
context,
//
assetPath: assetPath,
assetURL: assetURL,
assetBytes: assetBytes,
assetFallback: assetFallback,
//
wFactor: wFactor,
minW: minW,
maxW: maxW,
fixedWidth: fixedWidth,
//
useHeight: useHeight,
hFactor: hFactor,
minH: minH,
maxH: maxH,
fixedHeight: fixedHeight,
//
circular: circular,
border: border,
borderColor: borderColor,
borderPadding: borderPadding,
radius: radius,
shadow: shadow,
//
color: color,
blend: blend,
//
fit: fit,
alignment: alignment,
linearGradient: linearGradient,
//
loadingWidget: loadingWidget,
errorWidget: errorWidget,
);
//S1 -- BLUR
static Widget blur(
Widget child,
double sigmaX,
double sigmaY, {
Widget? topChild,
Color? overlayColor = const Color.fromRGBO(0, 0, 0, 0.1),
TileMode? tileMode = TileMode.mirror,
List<BoxShadow>? shadow,
BorderRadius? radius,
}) =>
astromicBlurEffect(
child,
sigmaX,
sigmaY,
topChild: topChild,
overlayColor: overlayColor,
tileMode: tileMode,
shadow: shadow,
radius: radius,
);
}