This commit is contained in:
2025-02-12 14:12:23 +02:00
parent 40f17efd30
commit 65f4c0ee6c
12 changed files with 646 additions and 229 deletions

View File

@@ -0,0 +1,43 @@
// //s1 Imports
// //s2 Core Package Imports
// import 'package:flutter/material.dart';
// //s2 1st-party Package Imports
// //s2 3rd-party Package Imports
// //s2 Dependancies Imports
// //s3 Routes
// //s3 Services
// //s3 Models
// //s1 Exports
// class AstromicAppBar extends StatelessWidget {
// //SECTION - Widget Arguments
// //!SECTION
// //
// const AstromicAppBar({
// super.key,
// });
// @override
// Widget build(BuildContext context) {
// //SECTION - Build Setup
// //s1 -Values
// //double w = MediaQuery.of(context).size.width;
// //double h = MediaQuery.of(context).size.height;
// //s1 -Values
// //
// //s1 -Widgets
// //s1 -Widgets
// //!SECTION
// //SECTION - Build Return
// return Scaffold(
// body: Container(),
// );
// //!SECTION
// }
// //SECTION - Helper Functions
// // Build the leading widget
// Widget? _buildLeading() {}
// //!SECTION
// }

View File

@@ -1,39 +1,85 @@
//s1 Imports
//s2 Core Package Imports
import 'dart:ui';
import 'package:flutter/material.dart';
//s2 1st-party Package Imports
//s2 3rd-party Package Imports
//s2 Dependancies Imports
//s3 Routes
//s3 Services
//s3 Models
//s1 Exports
Widget astromicBlurEffect(
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,
}) =>
Container(
class AstromicBlur extends StatelessWidget {
//SECTION - Widget Arguments
final Widget child;
final (double x, double y)? sigma;
final TileMode? tileMode;
final Color? overlayColor;
final Gradient? overlayGradient;
final BorderRadius? radius;
final List<BoxShadow>? shadow;
final Widget? childOnTop;
//!SECTION
//
const AstromicBlur({
super.key,
required this.child,
this.sigma = (5, 5),
this.tileMode = TileMode.clamp,
this.overlayColor,
this.overlayGradient,
this.radius,
this.shadow,
this.childOnTop,
});
@override
Widget build(BuildContext context) {
//SECTION - Build Setup
//s1 -Values
//double w = MediaQuery.of(context).size.width;
//double h = MediaQuery.of(context).size.height;
//s1 -Values
//
//s1 -Widgets
//s1 -Widgets
//!SECTION
//SECTION - Build Return
return Container(
decoration: BoxDecoration(
borderRadius: radius,
boxShadow: shadow,
),
child: ClipRRect(
borderRadius: radius ?? BorderRadius.zero,
child: Stack(
fit: StackFit.expand,
children: [
child,
child, // The main widget goes under the blurred background
BackdropFilter(
filter: ImageFilter.blur(
sigmaX: 5.0,
sigmaY: 5.0,
tileMode: TileMode.mirror,
),
child: Container(
decoration: BoxDecoration(
color: overlayColor,
),
),
filter: ImageFilter.blur(sigmaX: sigma!.$1, sigmaY: sigma!.$2),
child: Container(decoration: BoxDecoration(color: overlayColor, gradient: overlayGradient)),
),
topChild ?? Container(),
childOnTop ?? Container(),
],
),
),
);
//!SECTION
}
}
extension BlurExtension on Widget {
Widget blur({
(double x, double y)? sigma,
TileMode? tileMode,
Color? overlayColor,
Gradient? overlayGradient,
BorderRadius? radius,
List<BoxShadow>? shadow,
Widget? childOnTop,
}) =>
AstromicBlur(child: this, sigma: sigma, tileMode: tileMode, overlayColor: overlayColor, overlayGradient: overlayGradient, radius: radius, shadow: shadow, childOnTop: childOnTop);
}

View File

@@ -1,76 +1,113 @@
import 'package:flutter/material.dart';
// //s1 Imports
// //s2 Core Package Imports
// import 'package:flutter/material.dart';
// //s2 1st-party Package Imports
// //s2 3rd-party Package Imports
// //s2 Dependancies Imports
// //s3 Routes
// //s3 Services
// //s3 Models
// //s1 Exports
//
Widget astromicScaffold({
//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,
//
}) {
assert(!withScrollView || (withScrollView && body is Column), 'Make sure you add a column in the body section!');
//
return Scaffold(
backgroundColor: backgroundColor,
//
appBar: isAppbarStacked ? null : appBar,
floatingActionButton: floatingActionButton,
floatingActionButtonLocation: floatingActionButtonLocation,
drawer: drawer,
bottomNavigationBar: bottomNavigationBar,
bottomSheet: bottomSheet,
//
resizeToAvoidBottomInset: resizeToAvoidBottomInset,
extendBody: extendBody,
body: Stack(
children: [
GestureDetector(
onTap: !withScrollView && closeKeyboardOnTap ? () => FocusManager.instance.primaryFocus?.unfocus() : null,
child: withSafeArea
? SafeArea(
child: withScrollView
? SingleChildScrollView(
keyboardDismissBehavior: closeKeyboardOnTap ? ScrollViewKeyboardDismissBehavior.onDrag : ScrollViewKeyboardDismissBehavior.manual,
physics: scrollPhysics,
padding: padding ?? EdgeInsets.zero,
child: body,
)
: Padding(
padding: padding ?? EdgeInsets.zero,
child: body,
),
)
: withScrollView
? SingleChildScrollView(
keyboardDismissBehavior: closeKeyboardOnTap ? ScrollViewKeyboardDismissBehavior.onDrag : ScrollViewKeyboardDismissBehavior.manual,
padding: padding ?? EdgeInsets.zero,
child: body,
)
: Padding(
padding: padding ?? EdgeInsets.zero,
child: body,
),
),
isAppbarStacked && appBar != null ? Wrap(children: [appBar]) : Container(),
],
),
);
}
// class AstromicScaffold extends StatelessWidget {
// //SECTION - Widget Arguments
// //!SECTION
// //
// const AstromicScaffold({
// super.key,
// });
// @override
// Widget build(BuildContext context) {
// //SECTION - Build Setup
// //s1 -Values
// //double w = MediaQuery.of(context).size.width;
// //double h = MediaQuery.of(context).size.height;
// //s1 -Values
// //
// //s1 -Widgets
// //s1 -Widgets
// //!SECTION
// //SECTION - Build Return
// return Scaffold(
// body: Container(),
// );
// //!SECTION
// }
// }
// //
// Widget astromicScaffold({
// //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,
// //
// }) {
// assert(!withScrollView || (withScrollView && body is Column), 'Make sure you add a column in the body section!');
// //
// return Scaffold(
// backgroundColor: backgroundColor,
// //
// appBar: isAppbarStacked ? null : appBar,
// floatingActionButton: floatingActionButton,
// floatingActionButtonLocation: floatingActionButtonLocation,
// drawer: drawer,
// bottomNavigationBar: bottomNavigationBar,
// bottomSheet: bottomSheet,
// //
// resizeToAvoidBottomInset: resizeToAvoidBottomInset,
// extendBody: extendBody,
// body: Stack(
// children: [
// GestureDetector(
// onTap: !withScrollView && closeKeyboardOnTap ? () => FocusManager.instance.primaryFocus?.unfocus() : null,
// child: withSafeArea
// ? SafeArea(
// child: withScrollView
// ? SingleChildScrollView(
// keyboardDismissBehavior: closeKeyboardOnTap ? ScrollViewKeyboardDismissBehavior.onDrag : ScrollViewKeyboardDismissBehavior.manual,
// physics: scrollPhysics,
// padding: padding ?? EdgeInsets.zero,
// child: body,
// )
// : Padding(
// padding: padding ?? EdgeInsets.zero,
// child: body,
// ),
// )
// : withScrollView
// ? SingleChildScrollView(
// keyboardDismissBehavior: closeKeyboardOnTap ? ScrollViewKeyboardDismissBehavior.onDrag : ScrollViewKeyboardDismissBehavior.manual,
// padding: padding ?? EdgeInsets.zero,
// child: body,
// )
// : Padding(
// padding: padding ?? EdgeInsets.zero,
// child: body,
// ),
// ),
// isAppbarStacked && appBar != null ? Wrap(children: [appBar]) : Container(),
// ],
// ),
// );
// }

View File

@@ -0,0 +1,284 @@
// //SECTION - Imports
// //
// //s1 PACKAGES
// //---------------
// //s2 CORE
// import 'dart:io';
// import 'dart:ui';
// import 'package:flutter/material.dart';
// import 'package:flutter/widgets.dart';
// import '../../../../../Domain/Services/Core/L10n/l10n.service.dart';
// import '../../../../../Domain/Services/Core/Routing/routing.service.dart';
// import '../../../../Astromic/astromic.dart';
// import '../../../../DS/ds.dart';
// //s2 3RD-PARTY
// //
// //s1 DEPENDENCIES
// //---------------
// //s2 SERVICES
// //s2 MODELS
// //s2 MISC
// //!SECTION - Imports
// //
// //SECTION - Exports
// //!SECTION - Exports
// //
// class SliverScaffoldComponent extends StatefulWidget {
// //SECTION - Widget Arguments
// final EdgeInsets padding;
// //
// final bool isForm;
// final bool resizeToAvoidBottomInset;
// //
// final bool implyAppbarLeading;
// //
// final String? appbarTitleString;
// final Widget Function(bool isExpanded)? appbarTitleWidget;
// //
// final List<Widget>? appbarActions;
// final Widget? appbarLeading;
// //
// final Widget? bottomNavigationBar;
// final Widget? fab;
// final FloatingActionButtonLocation? fabLocation;
// //
// final bool withSafeArea;
// final bool withScrollView;
// final bool closeKeyboardOnTap;
// final Color? forcedColor;
// final Color? forcedAppbarColor;
// final bool? isBlurred;
// //
// final Widget Function(ScrollController? controller)? body;
// final Widget? stackedImage;
// final bool withExpanded;
// final Widget? expandedWidget;
// final double? expandedHeight;
// //!SECTION
// //
// const SliverScaffoldComponent({
// Key? key,
// this.padding = const EdgeInsets.symmetric(horizontal: 20.0),
// this.isForm = false,
// this.resizeToAvoidBottomInset = true,
// this.implyAppbarLeading = true,
// this.appbarTitleString,
// this.appbarTitleWidget,
// this.appbarActions,
// this.appbarLeading,
// this.bottomNavigationBar,
// this.fab,
// this.fabLocation,
// this.withSafeArea = false,
// this.withScrollView = false,
// this.closeKeyboardOnTap = true,
// this.forcedColor,
// this.forcedAppbarColor,
// this.isBlurred = false,
// this.body,
// this.stackedImage,
// this.withExpanded = false,
// this.expandedWidget,
// this.expandedHeight,
// }) : super(
// key: key,
// );
// @override
// State<SliverScaffoldComponent> createState() => _SliverScaffoldComponentState();
// }
// class _SliverScaffoldComponentState extends State<SliverScaffoldComponent> {
// //
// //SECTION - State Variables
// //s1 --State
// late ScrollController _scrollController;
// //s1 --State
// //
// //s1 --Controllers
// //late AstromicFormController _formController;
// //s1 --Controllers
// //
// //s1 --Constants
// double collapsedBarHeight = kToolbarHeight + 8;
// //s1 --Constants
// //!SECTION
// @override
// void initState() {
// super.initState();
// //
// //SECTION - State Variables initializations & Listeners
// //s1 --State
// //s1 --State
// //
// //s1 --Controllers & Listeners
// // _formController = AstromicFormController();
// _scrollController = ScrollController();
// //s1 --Controllers & Listeners
// //
// //s1 --Late & Async Initializers
// //s1 --Late & Async Initializers
// //!SECTION
// }
// @override
// void didChangeDependencies() {
// super.didChangeDependencies();
// //
// //SECTION - State Variables initializations & Listeners
// //s1 --State
// //s1 --State
// //
// //s1 --Controllers & Listeners
// //s1 --Controllers & Listeners
// //
// //!SECTION
// }
// //SECTION - Dumb Widgets
// bool get _isSliverAppBarExpanded {
// return _scrollController.hasClients && _scrollController.offset > ((((widget.expandedHeight) ?? 250) - 20) - kToolbarHeight);
// }
// //-
// //----------------------------------------------------------------
// //-
// //!SECTION
// //SECTION - Stateless functions
// //!SECTION
// //SECTION - Action Callbacks
// //!SECTION
// @override
// Widget build(BuildContext context) {
// //SECTION - Build Setup
// //s1 --Values
// double w = MediaQuery.of(context).size.width;
// //double h = MediaQuery.of(context).size.height;
// // debugPrint(MediaQuery.of(context).viewPadding.top.toString());
// //s1 --Values
// //
// //s1 --Contexted Widgets
// //s1 --Contexted Widgets
// //!SECTION
// //SECTION - Build Return
// return AstromicWidgets.scaffold(
// withSafeArea: false,
// closeKeyboardOnTap: widget.closeKeyboardOnTap,
// padding: widget.padding,
// backgroundColor: Colors.white,
// resizeToAvoidBottomInset: widget.resizeToAvoidBottomInset,
// bottomNavigationBar: widget.bottomNavigationBar,
// floatingActionButton: widget.fab,
// floatingActionButtonLocation: widget.fabLocation,
// appBar: widget.withExpanded
// ? null
// : context.miscComponents.appbar(
// context,
// color: widget.forcedAppbarColor ?? context.colors.main.primary,
// elevation: 0,
// implyLeading: widget.implyAppbarLeading,
// leading: widget.appbarLeading,
// actions: widget.appbarActions,
// titleString: widget.appbarTitleString,
// titleWidget: widget.appbarTitleWidget != null ? widget.appbarTitleWidget!(false) : null,
// centerTitle: Platform.isIOS,
// isBlurred: widget.isBlurred ?? false,
// ),
// //
// body: widget.withExpanded
// ? NestedScrollView(
// controller: _scrollController,
// headerSliverBuilder: (context, innerBoxIsScrolled) => [
// //S1 -- Sliver Appbar
// widget.withExpanded
// ? SliverAppBar(
// collapsedHeight: collapsedBarHeight,
// expandedHeight: widget.withExpanded ? (widget.expandedHeight ?? 250) : null,
// floating: false,
// pinned: true,
// toolbarHeight: collapsedBarHeight,
// flexibleSpace: widget.withExpanded
// ? FlexibleSpaceBar(
// titlePadding: EdgeInsets.only(top: collapsedBarHeight + MediaQuery.of(context).viewPadding.top),
// collapseMode: CollapseMode.parallax,
// // stretchModes: const [StretchMode.fadeTitle],
// expandedTitleScale: 1,
// // titlePadding: EdgeInsets.only(top: collapsedBarHeight + (kToolbarHeight / 2)),
// title: widget.expandedWidget ?? Container(),
// )
// : Container(),
// backgroundColor: widget.forcedAppbarColor ?? context.colors.main.primary,
// elevation: 0,
// automaticallyImplyLeading: widget.implyAppbarLeading,
// foregroundColor: context.colors.gs.white,
// leading: widget.appbarLeading != null || widget.implyAppbarLeading
// ? Row(
// textDirection: L10nService.get(context).direction,
// children: [
// const SizedBox(
// width: 4,
// ),
// widget.appbarLeading ??
// context.buttons.neutral.icon(
// context,
// L10nService.get(context).value<IconString>(
// ar: context.assets.iconAssets.arrowRight,
// en: context.assets.iconAssets.arrowLeft,
// ),
// onTap: () async {
// RoutingService.back(context);
// },
// iconColor: context.colors.gs.white,
// ),
// ],
// )
// : null,
// leadingWidth: 48,
// actions: widget.appbarActions != null
// ? [
// Padding(
// padding: const EdgeInsets.symmetric(horizontal: 10),
// child: Row(
// children: widget.appbarActions!,
// ),
// )
// ]
// : null,
// title: widget.appbarTitleString != null
// ? Text(
// widget.appbarTitleString!,
// style: context.typography.headlines.h6.copyWith(fontSize: 18),
// )
// : widget.appbarTitleWidget!(_isSliverAppBarExpanded),
// centerTitle: Platform.isIOS,
// )
// : Container(),
// ],
// body: widget.body != null ? widget.body!(_scrollController) : Container(),
// )
// : widget.body != null
// ? widget.body!(null)
// : Container(),
// );
// //!SECTION
// }
// @override
// void dispose() {
// //SECTION - Disposable variables
// //!SECTION
// super.dispose();
// }
// }

View File

@@ -1,63 +1,20 @@
//s1 Imports
//s2 Core Package Imports
import 'dart:typed_data';
//s2 Core Packages Imports
import 'src/blur.widget.dart';
import 'src/scaffold.widget.dart';
import 'src/image.widget.dart';
import 'package:flutter/material.dart';
//s2 1st-party Package Imports
//s2 3rd-party Package Imports
//s2 Dependancies Imports
//s3 Routes
//s3 Services
//s3 Models & Widgets
import 'src/blur.widget.dart';
import 'src/image.widget.dart';
//s1 Exports
export 'src/blur.widget.dart' show BlurExtension;
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
/// Customized Image widget for the Astromic system.
static Widget image({
String? assetPath,
String? assetURL,
@@ -121,25 +78,75 @@ class AstromicWidgets {
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,
/// Customized Blur widget for the Astromic system.
static Widget blur({
required Widget child,
(double x, double y)? sigma,
TileMode? tileMode,
Color? overlayColor,
Gradient? overlayGradient,
BorderRadius? radius,
List<BoxShadow>? shadow,
Widget? childOnTop,
}) =>
astromicBlurEffect(
child,
sigmaX,
sigmaY,
topChild: topChild,
overlayColor: overlayColor,
AstromicBlur(
child: child,
sigma: sigma,
tileMode: tileMode,
shadow: shadow,
overlayColor: overlayColor,
overlayGradient: overlayGradient,
radius: radius,
shadow: shadow,
childOnTop: childOnTop,
);
// 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,
// );
}