-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
666 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 142 additions & 0 deletions
142
LabelStoreMax/lib/bootstrap/status_alert/models/status_alert_media_configuration.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
// Label StoreMax | ||
// | ||
// Created by Anthony Gordon. | ||
// 2024, WooSignal Ltd. All rights reserved. | ||
// | ||
|
||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
|
||
import 'package:flutter/material.dart'; | ||
|
||
@immutable | ||
abstract class PopupMediaConfiguration { | ||
const PopupMediaConfiguration(); | ||
} | ||
|
||
@immutable | ||
class FlareConfiguration extends PopupMediaConfiguration { | ||
/// Name of the Flare file to be loaded from the AssetBundle. | ||
final String filename; | ||
|
||
/// The name of the artboard to display. | ||
final String? artboard; | ||
|
||
/// The name of the animation to play. | ||
final String? animation; | ||
|
||
/// When true, the animation will be applied at the end of its duration. | ||
final bool snapToEnd; | ||
|
||
/// The BoxFit strategy used to scale the Flare content into the | ||
/// bounds of this widget. | ||
final BoxFit fit; | ||
|
||
/// The alignment that will be applied in conjuction to the [fit] to align | ||
/// the Flare content within the bounds of this widget. | ||
final Alignment alignment; | ||
|
||
/// When true, animations do not advance. | ||
final bool isPaused; | ||
|
||
/// When true, the Flare content will be clipped against the bounds of this | ||
/// widget. | ||
final bool shouldClip; | ||
|
||
// /// The [FlareController] used to drive animations/mixing/procedural hierarchy | ||
// /// manipulation of the Flare contents. | ||
// final FlareController? controller; | ||
// | ||
// /// Callback invoked when [animation] has completed. If [animation] is looping | ||
// /// this callback is never invoked. | ||
// final FlareCompletedCallback? callback; | ||
|
||
/// The color to override any fills/strokes with. | ||
final Color? color; | ||
|
||
/// The name of the node to use to determine the bounds of the content. | ||
/// When null it will default to the bounds of the artboard. | ||
final String? boundsNode; | ||
|
||
/// When true the intrinsic size of the artboard will be used as the | ||
/// dimensions of this widget. | ||
final bool sizeFromArtboard; | ||
|
||
/// Margin for [FlareActor] | ||
final EdgeInsets margin; | ||
|
||
/// Size of animated [FlareActor] | ||
final Size size; | ||
|
||
const FlareConfiguration( | ||
this.filename, { | ||
this.boundsNode, | ||
this.animation, | ||
this.fit = BoxFit.contain, | ||
this.alignment = Alignment.center, | ||
this.isPaused = false, | ||
this.snapToEnd = false, | ||
// this.controller, | ||
// this.callback, | ||
this.color, | ||
this.shouldClip = true, | ||
this.sizeFromArtboard = false, | ||
this.artboard, | ||
this.margin = const EdgeInsets.all(24.0), | ||
this.size = const Size(150, 150), | ||
}); | ||
} | ||
|
||
@immutable | ||
class IconConfiguration extends PopupMediaConfiguration { | ||
/// Key | ||
final Key? key; | ||
|
||
/// The icon to display. | ||
final IconData icon; | ||
|
||
/// The size of the icon in logical pixels. | ||
final double? size; | ||
|
||
/// The color to use when drawing the icon. | ||
final Color? color; | ||
|
||
/// Semantic label for the icon. | ||
final String? semanticLabel; | ||
|
||
/// The text direction to use for rendering the icon. | ||
final TextDirection? textDirection; | ||
|
||
/// Margin for [Icon] | ||
final EdgeInsets margin; | ||
|
||
const IconConfiguration({ | ||
this.key, | ||
this.margin = const EdgeInsets.all(0.0), | ||
this.size, | ||
this.icon = Icons.done, | ||
this.color, | ||
this.semanticLabel, | ||
this.textDirection, | ||
}); | ||
} | ||
|
||
@immutable | ||
class ImageConfiguration extends PopupMediaConfiguration { | ||
const ImageConfiguration(); | ||
} | ||
|
||
@immutable | ||
class WidgetConfiguration extends PopupMediaConfiguration { | ||
/// The widget to be displayed. | ||
/// All in your hands!!! | ||
/// | ||
/// _____\_ヘ(︶ω︶) | ||
/// | ||
final Widget widget; | ||
|
||
const WidgetConfiguration({ | ||
required this.widget, | ||
}); | ||
} |
71 changes: 71 additions & 0 deletions
71
LabelStoreMax/lib/bootstrap/status_alert/models/status_alert_text_configuration.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Label StoreMax | ||
// | ||
// Created by Anthony Gordon. | ||
// 2024, WooSignal Ltd. All rights reserved. | ||
// | ||
|
||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
|
||
import 'package:flutter/material.dart'; | ||
|
||
class StatusAlertTextConfiguration { | ||
/// The text to display as a [InlineSpan]. | ||
InlineSpan? textSpan; | ||
|
||
/// If non-null, the style to use for this text. | ||
TextStyle style; | ||
|
||
/// {@macro flutter.painting.textPainter.strutStyle} | ||
StrutStyle? strutStyle; | ||
|
||
/// How the text should be aligned horizontally. | ||
TextAlign textAlign; | ||
|
||
/// The directionality of the text. | ||
TextDirection? textDirection; | ||
|
||
/// Used to select a font when the same Unicode character can | ||
/// be rendered differently, depending on the locale. | ||
Locale? locale; | ||
|
||
/// Whether the text should break at soft line breaks. | ||
bool? softWrap; | ||
|
||
/// How visual overflow should be handled. | ||
TextOverflow? overflow; | ||
|
||
/// The number of font pixels for each logical pixel. | ||
double? textScaleFactor; | ||
|
||
/// An optional maximum number of lines for the text to span, wrapping if necessary. | ||
/// If the text exceeds the given number of lines, it will be truncated according | ||
/// to [overflow]. | ||
int? maxLines; | ||
|
||
/// An alternative semantics label for this text. | ||
String? semanticsLabel; | ||
|
||
/// {@macro flutter.painting.textPainter.textWidthBasis} | ||
TextWidthBasis? textWidthBasis; | ||
|
||
/// Key | ||
Key? key; | ||
|
||
StatusAlertTextConfiguration({ | ||
this.textSpan, | ||
this.key, | ||
this.style = const TextStyle(fontFamily: 'SFNS'), | ||
this.strutStyle, | ||
this.textAlign = TextAlign.center, | ||
this.textDirection, | ||
this.locale, | ||
this.softWrap, | ||
this.overflow, | ||
this.textScaleFactor, | ||
this.maxLines, | ||
this.semanticsLabel, | ||
this.textWidthBasis, | ||
}); | ||
} |
78 changes: 78 additions & 0 deletions
78
LabelStoreMax/lib/bootstrap/status_alert/status_alert.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Label StoreMax | ||
// | ||
// Created by Anthony Gordon. | ||
// 2024, WooSignal Ltd. All rights reserved. | ||
// | ||
|
||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
|
||
import 'package:flutter/material.dart'; | ||
import '/bootstrap/status_alert/utils/status_allert_manager.dart'; | ||
import '/bootstrap/status_alert/widgets/status_alert_base_widget.dart'; | ||
import 'models/status_alert_media_configuration.dart'; | ||
import 'models/status_alert_text_configuration.dart'; | ||
|
||
class StatusAlert { | ||
static void show( | ||
BuildContext context, { | ||
String? title, | ||
String? subtitle, | ||
Color? backgroundColor, | ||
double blurPower = 15, | ||
double? maxWidth, | ||
StatusAlertTextConfiguration? titleOptions, | ||
StatusAlertTextConfiguration? subtitleOptions, | ||
PopupMediaConfiguration? configuration, | ||
Alignment alignment = Alignment.center, | ||
bool dismissOnBackgroundTap = false, | ||
EdgeInsets margin = const EdgeInsets.all(40.0), | ||
EdgeInsets padding = const EdgeInsets.all(30.0), | ||
Duration duration = const Duration(milliseconds: 1300), | ||
BorderRadius borderRadius = const BorderRadius.all(Radius.circular(10.0)), | ||
}) { | ||
StatusAlertTextConfiguration? titleConfig = titleOptions; | ||
StatusAlertTextConfiguration? subtitleConfig = subtitleOptions; | ||
if (titleConfig == null) { | ||
titleConfig = StatusAlertTextConfiguration(); | ||
titleConfig.style = titleConfig.style.copyWith( | ||
fontSize: 23, | ||
fontWeight: FontWeight.w600, | ||
); | ||
} | ||
|
||
if (subtitleConfig == null) { | ||
subtitleConfig = StatusAlertTextConfiguration(); | ||
subtitleConfig.style = subtitleConfig.style.copyWith( | ||
fontSize: 16, | ||
fontWeight: FontWeight.w400, | ||
); | ||
} | ||
|
||
StatusAlertManager.createView( | ||
context: context, | ||
dismissOnBackgroundTap: dismissOnBackgroundTap, | ||
child: StatusAlertBaseWidget( | ||
title: title, | ||
margin: margin, | ||
padding: padding, | ||
duration: duration, | ||
subtitle: subtitle, | ||
alignment: alignment, | ||
blurPower: blurPower, | ||
maxWidth: maxWidth, | ||
borderRadius: borderRadius, | ||
titleOptions: titleConfig, | ||
onHide: StatusAlertManager.dismiss, | ||
configuration: configuration, | ||
subtitleOptions: subtitleConfig, | ||
backgroundColor: backgroundColor, | ||
), | ||
); | ||
} | ||
|
||
static void hide() => StatusAlertManager.dismiss(); | ||
|
||
static get isVisible => StatusAlertManager.isVisible; | ||
} |
17 changes: 17 additions & 0 deletions
17
LabelStoreMax/lib/bootstrap/status_alert/utils/colors.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Label StoreMax | ||
// | ||
// Created by Anthony Gordon. | ||
// 2024, WooSignal Ltd. All rights reserved. | ||
// | ||
|
||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
|
||
import 'package:flutter/material.dart'; | ||
|
||
const Color darkAccent = Color.fromRGBO(160, 160, 160, 1); | ||
const Color lightAccent = Color.fromRGBO(90, 90, 90, 1); | ||
|
||
const Color darkBackground = Color.fromRGBO(66, 66, 66, 0.95); | ||
const Color lightBackground = Color.fromRGBO(220, 220, 220, 0.95); |
Oops, something went wrong.