mirror of
https://github.com/hanskokx/arcane_helper_utils.git
synced 2026-05-14 10:29:07 +02:00
v1.1.3
- Removed color extension Signed-off-by: Hans Kokx <hans.kokx@hackberry.se>
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
## 1.1.3
|
||||||
|
|
||||||
|
- Removes `Color` extension due to an incompatibility with Flutter. Sorry, @rania-run!
|
||||||
|
|
||||||
## 1.1.2
|
## 1.1.2
|
||||||
|
|
||||||
- Ensure new `Color` extensions are exported from the package.
|
- Ensure new `Color` extensions are exported from the package.
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ providing utility functions and extensions that simplify common tasks.
|
|||||||
class, making it easier to format dates and calculate differences.
|
class, making it easier to format dates and calculate differences.
|
||||||
- **String Extensions**: Enhances the `String` class by adding new methods for
|
- **String Extensions**: Enhances the `String` class by adding new methods for
|
||||||
common transformations and checks, including JWT parsing.
|
common transformations and checks, including JWT parsing.
|
||||||
- **Color Extensions**: Adds the ability to determine the luminance of a `Color`
|
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
@@ -331,16 +330,6 @@ objects:
|
|||||||
Additionally, the `CommonString` class provides a quick shortcut to common
|
Additionally, the `CommonString` class provides a quick shortcut to common
|
||||||
strings, such as punctuation marks that are otherwise cumbersome to find or type.
|
strings, such as punctuation marks that are otherwise cumbersome to find or type.
|
||||||
|
|
||||||
### Color Examples
|
|
||||||
|
|
||||||
The following utilities have been added to enhance working with `Color` objects:
|
|
||||||
|
|
||||||
- `luminance`: Computes the luminance of a given color.
|
|
||||||
|
|
||||||
```dart
|
|
||||||
final Color luminanceBasedColor = myColor.isDark ? Colors.white : Colors.black;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Contributions are welcome! Feel free to fork the repository and submit pull
|
Contributions are welcome! Feel free to fork the repository and submit pull
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
// ignore_for_file: avoid_print
|
// ignore_for_file: avoid_print
|
||||||
|
|
||||||
import "package:arcane_helper_utils/arcane_helper_utils.dart";
|
import "package:arcane_helper_utils/arcane_helper_utils.dart";
|
||||||
import "package:pure_dart_ui/pure_dart_ui.dart";
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
// DateTime
|
// DateTime
|
||||||
@@ -36,10 +35,4 @@ void main() {
|
|||||||
const String lowercase = "hello";
|
const String lowercase = "hello";
|
||||||
final String capitalized = lowercase.capitalize;
|
final String capitalized = lowercase.capitalize;
|
||||||
print(capitalized); // "Hello"
|
print(capitalized); // "Hello"
|
||||||
|
|
||||||
// Color
|
|
||||||
const Color myColor = Color.fromARGB(255, 153, 97, 227);
|
|
||||||
final Color luminanceBasedcolor =
|
|
||||||
myColor.isDark ? const Color(0xff000000) : const Color(0xffffffff);
|
|
||||||
print(luminanceBasedcolor); // Color(0xff000000)
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
library arcane_helper_utils;
|
library arcane_helper_utils;
|
||||||
|
|
||||||
export "package:arcane_helper_utils/src/extensions/color.dart";
|
|
||||||
export "package:arcane_helper_utils/src/extensions/date_time.dart";
|
export "package:arcane_helper_utils/src/extensions/date_time.dart";
|
||||||
export "package:arcane_helper_utils/src/extensions/string.dart";
|
export "package:arcane_helper_utils/src/extensions/string.dart";
|
||||||
export "package:arcane_helper_utils/src/extensions/string_jwt.dart";
|
export "package:arcane_helper_utils/src/extensions/string_jwt.dart";
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
import "package:pure_dart_ui/pure_dart_ui.dart";
|
|
||||||
|
|
||||||
/// A collection of extensions for the `Color` class.
|
|
||||||
extension ColorsExtensions on Color {
|
|
||||||
/// Determines if the color is considered dark.
|
|
||||||
///
|
|
||||||
/// A color is considered dark if its luminance is less than 0.5.
|
|
||||||
bool get isDark {
|
|
||||||
final luminance = computeLuminance();
|
|
||||||
// Luminance values range from 0 to 1, where 0 is black and 1 is white.
|
|
||||||
// A luminance value below 0.5 indicates a dark color.
|
|
||||||
return luminance < 0.5;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-2
@@ -1,7 +1,7 @@
|
|||||||
name: arcane_helper_utils
|
name: arcane_helper_utils
|
||||||
description: Provides a variety of helpful utilities and extensions for Flutter
|
description: Provides a variety of helpful utilities and extensions for Flutter
|
||||||
and Dart.
|
and Dart.
|
||||||
version: 1.1.2
|
version: 1.1.3
|
||||||
repository: https://github.com/hanskokx/arcane_helper_utils
|
repository: https://github.com/hanskokx/arcane_helper_utils
|
||||||
issue_tracker: https://github.com/hanskokx/arcane_helper_utils/issues
|
issue_tracker: https://github.com/hanskokx/arcane_helper_utils/issues
|
||||||
|
|
||||||
@@ -15,7 +15,6 @@ environment:
|
|||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
freezed_annotation: ^2.4.4
|
freezed_annotation: ^2.4.4
|
||||||
pure_dart_ui: ^0.1.10
|
|
||||||
week_number: ^1.1.0
|
week_number: ^1.1.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|||||||
Reference in New Issue
Block a user