Skip to content

Commit

Permalink
v8.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
agordn52 committed Dec 16, 2024
1 parent 335144f commit 79e9064
Show file tree
Hide file tree
Showing 11 changed files with 666 additions and 81 deletions.
5 changes: 5 additions & 0 deletions LabelStoreMax/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## [8.0.1] - 2024-12-16

* Add status alerts into the project
* Dependency updates

## [8.0.0] - 2024-12-01

* Update project for Nylo 6.x
Expand Down
7 changes: 5 additions & 2 deletions LabelStoreMax/lib/app/providers/app_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class AppProvider implements NyProvider {
baseUrl: wooSignalApp.wpLoginBaseUrl ?? "",
shouldDebug: getEnv('APP_DEBUG'),
wpJsonPath: wooSignalApp.wpLoginWpApiPath ?? "",
nylo: true);
nylo: nylo);
}

if (getEnv('DEFAULT_LOCALE', defaultValue: null) == null &&
Expand All @@ -99,7 +99,10 @@ class AppProvider implements NyProvider {
nylo.addControllers(controllers);
nylo.addApiDecoders(apiDecoders);
nylo.useErrorStack();
nylo.addAuthKey(Keys.auth);

if (nylo.getAuthKey() == null) {
nylo.addAuthKey(Keys.auth);
}
await nylo.syncKeys(Keys.syncedOnBoot);

return nylo;
Expand Down
7 changes: 2 additions & 5 deletions LabelStoreMax/lib/bootstrap/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import 'dart:convert';
import 'package:collection/collection.dart' show IterableExtension;
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter_app/bootstrap/status_alert/models/status_alert_media_configuration.dart';
import 'package:flutter_app/bootstrap/status_alert/status_alert.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:wp_json_api/models/wp_user.dart';
import 'package:wp_json_api/wp_json_api.dart';
Expand All @@ -32,7 +34,6 @@ import 'package:html/parser.dart';
import 'package:math_expressions/math_expressions.dart';
import 'package:money_formatter/money_formatter.dart';
import 'package:nylo_framework/nylo_framework.dart';
import 'package:status_alert/status_alert.dart';
import 'package:woosignal/models/response/product.dart';
import 'package:woosignal/models/response/tax_rate.dart';
import 'package:woosignal/woosignal.dart';
Expand Down Expand Up @@ -403,10 +404,6 @@ String formatForDateTime(FormatType formatType) {
{
return "hh:mm a";
}
default:
{
return "";
}
}
}

Expand Down
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,
});
}
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 LabelStoreMax/lib/bootstrap/status_alert/status_alert.dart
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 LabelStoreMax/lib/bootstrap/status_alert/utils/colors.dart
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);
Loading

0 comments on commit 79e9064

Please sign in to comment.