Skip to content

Commit

Permalink
v5.0.2 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
agordn52 committed May 24, 2023
1 parent 94e2192 commit 58e6ff0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 169 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<a href="#"><img alt="GitHub stars" src="https://img.shields.io/github/stars/nylo-core/nylo?style=plastic"></a>
</p>

## Nylo (v5.0.1)
## Nylo (v5.0.2)

Nylo is a micro-framework for Flutter which is designed to help simplify developing apps. Every project provides a simple boilerplate and MVC pattern to help you build apps easier.

Expand Down
169 changes: 4 additions & 165 deletions lib/bootstrap/extensions.dart
Original file line number Diff line number Diff line change
@@ -1,182 +1,21 @@
import 'package:flutter/material.dart';
import 'package:flutter_app/bootstrap/helpers.dart';
import 'package:flutter_app/resources/themes/styles/color_styles.dart';
import 'package:nylo_framework/nylo_framework.dart';

/// [Text] Extensions
extension NyText on Text {
/// Set the Style to use [displayLarge].
Text displayLarge(BuildContext context) {
if (style == null) {
return copyWith(style: Theme.of(context).textTheme.displayLarge);
}
return this.setStyle(Theme.of(context).textTheme.displayLarge);
}

/// Set the Style to use [displayMedium].
Text displayMedium(BuildContext context) {
if (style == null) {
return copyWith(style: Theme.of(context).textTheme.displayMedium);
}
return this.setStyle(Theme.of(context).textTheme.displayMedium);
}

/// Set the Style to use [displaySmall].
Text displaySmall(BuildContext context) {
if (style == null) {
return copyWith(style: Theme.of(context).textTheme.displaySmall);
}
return this.setStyle(Theme.of(context).textTheme.displaySmall);
}

/// Set the Style to use [headlineLarge].
Text headingLarge(BuildContext context) {
if (style == null) {
return copyWith(style: Theme.of(context).textTheme.headlineLarge);
}
return this.setStyle(Theme.of(context).textTheme.headlineLarge);
}

/// Set the Style to use [headlineMedium].
Text headingMedium(BuildContext context) {
if (style == null) {
return copyWith(style: Theme.of(context).textTheme.headlineMedium);
}
return this.setStyle(Theme.of(context).textTheme.headlineMedium);
}

/// Set the Style to use [headlineSmall].
Text headingSmall(BuildContext context) {
if (style == null) {
return copyWith(style: Theme.of(context).textTheme.headlineSmall);
}
return this.setStyle(Theme.of(context).textTheme.headlineSmall);
}

/// Set the Style to use [titleLarge].
Text titleLarge(BuildContext context) {
if (style == null) {
return copyWith(style: Theme.of(context).textTheme.titleLarge);
}
return this.setStyle(Theme.of(context).textTheme.titleLarge);
}

/// Set the Style to use [titleMedium].
Text titleMedium(BuildContext context) {
if (style == null) {
return copyWith(style: Theme.of(context).textTheme.titleMedium);
}
return this.setStyle(Theme.of(context).textTheme.titleMedium);
}

/// Set the Style to use [titleSmall].
Text titleSmall(BuildContext context) {
if (style == null) {
return copyWith(style: Theme.of(context).textTheme.titleSmall);
}
return this.setStyle(Theme.of(context).textTheme.titleSmall);
}

/// Set the Style to use [bodyLarge].
Text bodyLarge(BuildContext context) {
if (style == null) {
return copyWith(style: Theme.of(context).textTheme.bodyLarge);
}
return this.setStyle(Theme.of(context).textTheme.bodyLarge);
}

/// Set the Style to use [bodyMedium].
Text bodyMedium(BuildContext context) {
if (style == null) {
return copyWith(style: Theme.of(context).textTheme.bodyMedium);
}
return this.setStyle(Theme.of(context).textTheme.bodyMedium);
}

/// Set the Style to use [bodySmall].
Text bodySmall(BuildContext context) {
if (style == null) {
return copyWith(style: Theme.of(context).textTheme.bodySmall);
}
return this.setStyle(Theme.of(context).textTheme.bodySmall);
}

/// Make the font bold.
Text fontWeightBold() {
return copyWith(style: TextStyle(fontWeight: FontWeight.bold));
}

/// Make the font light.
Text fontWeightLight() {
return copyWith(style: TextStyle(fontWeight: FontWeight.w300));
}

/// Change the [style].
Text setStyle(TextStyle? style) => copyWith(style: style);

/// Sets the color from your [ColorStyles] or [Color].
Text setColor(
BuildContext context, Color Function(ColorStyles color) newColor,
{String? themeId}) {
return copyWith(
style: TextStyle(
color: newColor(ThemeColor.get(context, themeId: themeId))));
}

/// Aligns text to the left.
Text alignLeft() {
return copyWith(textAlign: TextAlign.left);
}

/// Aligns text to the right.
Text alignRight() {
return copyWith(textAlign: TextAlign.right);
}

/// Aligns text to the center.
Text alignCenter() {
return copyWith(textAlign: TextAlign.center);
}

/// Aligns text to the center.
Text setMaxLines(int maxLines) {
return copyWith(maxLines: maxLines);
}

/// Change the [fontFamily].
Text setFontFamily(String fontFamily) =>
copyWith(style: TextStyle(fontFamily: fontFamily));

/// Helper to apply changes.
Text copyWith(
{Key? key,
StrutStyle? strutStyle,
TextAlign? textAlign,
TextDirection? textDirection = TextDirection.ltr,
Locale? locale,
bool? softWrap,
TextOverflow? overflow,
double? textScaleFactor,
int? maxLines,
String? semanticsLabel,
TextWidthBasis? textWidthBasis,
TextStyle? style}) {
return Text(this.data ?? "",
key: key ?? this.key,
strutStyle: strutStyle ?? this.strutStyle,
textAlign: textAlign ?? this.textAlign,
textDirection: textDirection ?? this.textDirection,
locale: locale ?? this.locale,
softWrap: softWrap ?? this.softWrap,
overflow: overflow ?? this.overflow,
textScaleFactor: textScaleFactor ?? this.textScaleFactor,
maxLines: maxLines ?? this.maxLines,
semanticsLabel: semanticsLabel ?? this.semanticsLabel,
textWidthBasis: textWidthBasis ?? this.textWidthBasis,
style: style != null ? this.style?.merge(style) ?? style : this.style);
}
}

/// Helper to set colors on TextStyle
extension ColorsHelper on TextStyle {
/// [TextStyle] Extensions
extension NyTextStyle on TextStyle {
TextStyle? setColor(
BuildContext context, Color Function(ColorStyles color) newColor,
{String? themeId}) {
Expand Down
5 changes: 4 additions & 1 deletion lib/config/events.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter_app/app/models/user.dart';
import '/app/events/login_event.dart';
import '/app/events/logout_event.dart';
import 'package:nylo_framework/nylo_framework.dart';
Expand All @@ -16,5 +17,7 @@ final Map<Type, NyEvent> events = {
LoginEvent: LoginEvent(),
LogoutEvent: LogoutEvent(),
AuthUserEvent: AuthUserEvent(),
SyncAuthToBackpackEvent: SyncAuthToBackpackEvent(),
SyncAuthToBackpackEvent: SyncAuthToBackpackEvent<User>(),

};

4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ environment:

dependencies:
url_launcher: ^6.1.11
google_fonts: ^4.0.4
google_fonts: ^4.0.5
analyzer: ^5.7.1
intl: ^0.18.0
nylo_framework: ^5.0.0
nylo_framework: ^5.0.1
pretty_dio_logger: ^1.3.1
flutter:
sdk: flutter
Expand Down

0 comments on commit 58e6ff0

Please sign in to comment.