Removed helpers lib and updated to flutter 3.22
This commit is contained in:
+11
-19
@@ -1,9 +1,9 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:colorful_print/colorful_print.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:helpers/helpers/print.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:rluv/global/styles.dart';
|
||||
import 'package:rluv/main.dart';
|
||||
@@ -20,20 +20,16 @@ bool boolFromJson(int value) => value == 1;
|
||||
|
||||
int boolToJson(bool hide) => hide ? 1 : 0;
|
||||
|
||||
String colorToJson(Color color) =>
|
||||
color.toString().split('(0x')[1].split(')')[0];
|
||||
String colorToJson(Color color) => color.toString().split('(0x')[1].split(')')[0];
|
||||
|
||||
Color colorFromJson(String hex) => Color(int.parse(hex, radix: 16));
|
||||
|
||||
String? optionalColorToJson(Color? optionalColor) => optionalColor == null
|
||||
? null
|
||||
: optionalColor.toString().split('(0x')[1].split(')')[0];
|
||||
String? optionalColorToJson(Color? optionalColor) =>
|
||||
optionalColor == null ? null : optionalColor.toString().split('(0x')[1].split(')')[0];
|
||||
|
||||
Color? optionalColorFromJson(String? hex) =>
|
||||
hex == null ? null : Color(int.parse(hex, radix: 16));
|
||||
Color? optionalColorFromJson(String? hex) => hex == null ? null : Color(int.parse(hex, radix: 16));
|
||||
|
||||
Brightness getBrightness(Color color) =>
|
||||
ThemeData.estimateBrightnessForColor(color);
|
||||
Brightness getBrightness(Color color) => ThemeData.estimateBrightnessForColor(color);
|
||||
|
||||
List<Color> generateColorList() {
|
||||
List<Color> colors = [];
|
||||
@@ -60,7 +56,7 @@ extension MonetaryExtension on double {
|
||||
return "\$${pieces.first}.00";
|
||||
} else {
|
||||
if (pieces.length > 2) {
|
||||
printBlue(pieces);
|
||||
printColor(pieces, textColor: TextColor.blue);
|
||||
}
|
||||
return '\$${pieces[0]}.${pieces[1].padRight(2, "0")}';
|
||||
}
|
||||
@@ -83,7 +79,7 @@ void showSnack(
|
||||
Duration duration = const Duration(seconds: 2)}) {
|
||||
final messengerKey = ref.read(scaffoldMessengerKeyProvider);
|
||||
if (messengerKey.currentState == null) {
|
||||
printPink('Cannot show snackbar, state == null');
|
||||
printColor('Cannot show snackbar, state == null', textColor: TextColor.red);
|
||||
return;
|
||||
}
|
||||
final color = type == SnackType.info
|
||||
@@ -99,8 +95,7 @@ void showSnack(
|
||||
elevation: 8,
|
||||
backgroundColor: Styles.deepPurpleNurple,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(20.0), topRight: Radius.circular(20.0)),
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(20.0), topRight: Radius.circular(20.0)),
|
||||
),
|
||||
content: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
@@ -108,9 +103,7 @@ void showSnack(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 14.0),
|
||||
child: Icon(
|
||||
type == SnackType.success ? Icons.check_circle : Icons.info,
|
||||
color: color),
|
||||
child: Icon(type == SnackType.success ? Icons.check_circle : Icons.info, color: color),
|
||||
),
|
||||
Text(text, style: textStyle),
|
||||
],
|
||||
@@ -120,8 +113,7 @@ void showSnack(
|
||||
}
|
||||
|
||||
bool isEmailValid(String email) {
|
||||
final RegExp regex =
|
||||
RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$");
|
||||
final RegExp regex = RegExp(r"^[a-zA-Z0-9.a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$");
|
||||
return regex.hasMatch(email);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user