This commit is contained in:
2025-02-09 15:18:18 +02:00
commit 8e99f5010a
16 changed files with 375 additions and 0 deletions

View File

@@ -0,0 +1,71 @@
{
"configVersion": 2,
"packages": [
{
"name": "characters",
"rootUri": "file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/characters-1.3.0",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "collection",
"rootUri": "file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/collection-1.19.0",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "flutter",
"rootUri": "file:///C:/Users/micwa/fvm/versions/stable/packages/flutter",
"packageUri": "lib/",
"languageVersion": "3.3"
},
{
"name": "flutter_lints",
"rootUri": "file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_lints-2.0.3",
"packageUri": "lib/",
"languageVersion": "2.19"
},
{
"name": "lints",
"rootUri": "file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/lints-2.1.1",
"packageUri": "lib/",
"languageVersion": "3.0"
},
{
"name": "material_color_utilities",
"rootUri": "file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/material_color_utilities-0.11.1",
"packageUri": "lib/",
"languageVersion": "2.17"
},
{
"name": "meta",
"rootUri": "file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/meta-1.15.0",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "sky_engine",
"rootUri": "file:///C:/Users/micwa/fvm/versions/stable/bin/cache/pkg/sky_engine",
"packageUri": "lib/",
"languageVersion": "3.2"
},
{
"name": "vector_math",
"rootUri": "file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/vector_math-2.1.4",
"packageUri": "lib/",
"languageVersion": "2.14"
},
{
"name": "astromic_extensions",
"rootUri": "../",
"packageUri": "lib/",
"languageVersion": "3.6"
}
],
"generated": "2025-02-09T13:17:01.285423Z",
"generator": "pub",
"generatorVersion": "3.6.0",
"flutterRoot": "file:///C:/Users/micwa/fvm/versions/stable",
"flutterVersion": "3.27.1",
"pubCache": "file:///C:/Users/micwa/AppData/Local/Pub/Cache"
}

View File

@@ -0,0 +1,41 @@
characters
2.12
file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/characters-1.3.0/
file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/characters-1.3.0/lib/
collection
3.4
file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/collection-1.19.0/
file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/collection-1.19.0/lib/
flutter_lints
2.19
file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_lints-2.0.3/
file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_lints-2.0.3/lib/
lints
3.0
file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/lints-2.1.1/
file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/lints-2.1.1/lib/
material_color_utilities
2.17
file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/material_color_utilities-0.11.1/
file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/material_color_utilities-0.11.1/lib/
meta
2.12
file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/meta-1.15.0/
file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/meta-1.15.0/lib/
vector_math
2.14
file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/vector_math-2.1.4/
file:///C:/Users/micwa/AppData/Local/Pub/Cache/hosted/pub.dev/vector_math-2.1.4/lib/
sky_engine
3.2
file:///C:/Users/micwa/fvm/versions/stable/bin/cache/pkg/sky_engine/
file:///C:/Users/micwa/fvm/versions/stable/bin/cache/pkg/sky_engine/lib/
flutter
3.3
file:///C:/Users/micwa/fvm/versions/stable/packages/flutter/
file:///C:/Users/micwa/fvm/versions/stable/packages/flutter/lib/
astromic_extensions
3.6
file:///D:/Micazi/Helpers/astromic_extensions/
file:///D:/Micazi/Helpers/astromic_extensions/lib/
2

1
.dart_tool/version Normal file
View File

@@ -0,0 +1 @@
3.27.1

21
CHANGELOG.md Normal file
View File

@@ -0,0 +1,21 @@
<!---
## Guidelines for changelog/git
**INIT**: Initial commit in a repo, only committed once.
**DOC**: Updates/Refactors in the documents.
**CHORE**: Minor fixes and/or architecture enhancements.
**DEPS**: Dependency updates and the resulting refactors.
**SYNC**: Regular sync commits to ensure perfect syncing of all the development devices (Describes the feature in the working).
**TEST**: Adding/Updating test files.
**FIX**: Fixing a bug/issue that prevents a functionality.
**FEAT**: Add a completely new functionality or extend an existing one in a non-breaking manner.
**BREAKING CHANGE**: A [FEAT] but with breaking changes (Is only proposed as FEAT in the git commit).
## Version Composition
x.y.z
* Update z on Deps and Fixes.
* Update y on Feat that are large enough.
* Update x on BREAKING CHANGE that are a must and to signal phases completed [Alpha - Beta - Stable].
-->
## 0.1.0
- **INIT**: Initial commit in the new repo.

1
COPYRIGHT Normal file
View File

@@ -0,0 +1 @@
This repository is Developed, Maintained, and is property of Michael W. Aziz (Micazi).

23
README.md Normal file
View File

@@ -0,0 +1,23 @@
## Atromic Extensions
The extensions module of the **Astromic** Presentation System
Developed, Maintained, and is property of Michael W. Aziz (Micazi)
### Content
- on _BorderDirectional_
- `all()` : Generate a uniform border with one borderSide. ☑️
- on _EdgeInsetsGeometry_
- `copyWith()` ☑️
- `resolveToDirectional()` : Automatically reverse the EdgeInsets based on the dynamic *TextDirection*. ☑️
- on _List<E>_
- `containsAll()` : Checker to see if a list contains all of the other list. ☑️
- `getUnique()` : Get unique items only of a supplied list. ☑️
- on _TextAlignVertical_
- `toAllignment()` : convert a `TextAlignVertical` to an `Alignment` object. ☑️
- on _BorderRadiusGeometry_
- `copyWith()` ☑️
- `resolveToDirectional()` : Automatically reverse the BorderRadius based on the dynamic *TextDirection*. ☑️
- on _String_
- `toColor()` : Parse a HexCode `String` into a `Color` object. ☑️
- `capitalize()` : Capitalize the word. ☑️

10
analysis_options.yaml Normal file
View File

@@ -0,0 +1,10 @@
include: package:lints/recommended.yaml
linter:
rules:
- prefer_relative_imports
- close_sinks
- avoid_empty_else
- file_names
- prefer_const_constructors
- no_leading_underscores_for_local_identifiers

View File

@@ -0,0 +1,8 @@
library astromic_extensions;
export './src/border_extensions.dart';
export './src/insets_extension.dart';
export './src/list_extensions.dart';
export 'src/alignment_extensions.dart';
export './src/radius_extensions.dart';
export './src/string_extensions.dart';

View File

@@ -0,0 +1,16 @@
import 'package:flutter/material.dart';
extension TextAlignVerticalExtension on TextAlignVertical {
Alignment toAlignment() {
switch (this) {
case TextAlignVertical.top:
return Alignment.topCenter;
case TextAlignVertical.center:
return Alignment.center;
case TextAlignVertical.bottom:
return Alignment.bottomCenter;
default:
return Alignment.center;
}
}
}

View File

@@ -0,0 +1,7 @@
import "package:flutter/painting.dart";
extension BorderExtension on BorderDirectional {
BorderDirectional all(BorderSide side) {
return BorderDirectional(top: side, bottom: side, start: side, end: side);
}
}

View File

@@ -0,0 +1,12 @@
import 'package:flutter/widgets.dart';
extension InsetsExtension on EdgeInsetsGeometry {
copyWith(EdgeInsetsGeometry g) => add(g);
//
EdgeInsetsDirectional resolveToDirectional(TextDirection direction) {
//
return EdgeInsetsDirectional.fromSTEB(direction == TextDirection.ltr ? resolve(direction).left : resolve(direction).right, resolve(direction).top,
direction == TextDirection.ltr ? resolve(direction).right : resolve(direction).left, resolve(direction).bottom);
//
}
}

View File

@@ -0,0 +1,20 @@
extension ListExtension<E> on List<E> {
bool containsAll(List<E> otherList) {
List<bool> checks = [];
//
for (E thisElement in otherList) {
checks.add(contains(thisElement));
}
return !checks.contains(false);
}
List<E> getUnique() {
List<E> uniqueItems = [];
for (E thisElement in this) {
if (!uniqueItems.contains(thisElement)) {
uniqueItems.add(thisElement);
}
}
return uniqueItems;
}
}

View File

@@ -0,0 +1,15 @@
import 'package:flutter/widgets.dart';
extension RadiusExtension on BorderRadiusGeometry {
copyWith(BorderRadiusGeometry g) => add(g);
//
BorderRadiusDirectional resolveToDirectional(TextDirection direction) {
//
return BorderRadiusDirectional.only(
topStart: direction == TextDirection.ltr ? resolve(direction).topLeft : resolve(direction).topRight,
topEnd: direction == TextDirection.rtl ? resolve(direction).topLeft : resolve(direction).topRight,
bottomEnd: direction == TextDirection.rtl ? resolve(direction).bottomRight : resolve(direction).bottomRight,
bottomStart: direction == TextDirection.ltr ? resolve(direction).bottomLeft : resolve(direction).bottomRight,
);
}
}

View File

@@ -0,0 +1,19 @@
import 'package:flutter/material.dart';
extension StringExtensions on String {
/// Parse the HexCode to color
Color get toColor {
if (this == '') return const Color(0xFF000000);
String hexColor = replaceAll('#', '');
hexColor = hexColor.replaceAll('0x', '');
hexColor = hexColor.padLeft(6, '0');
hexColor = hexColor.padLeft(8, 'F');
final int length = hexColor.length;
return Color(int.tryParse('0x${hexColor.substring(length - 8, length)}') ?? 0xFF000000);
}
/// Capitalize the first letter in a string.
String get capitalize {
return (length > 1) ? this[0].toUpperCase() + substring(1) : toUpperCase();
}
}

72
pubspec.lock Normal file
View File

@@ -0,0 +1,72 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
characters:
dependency: transitive
description:
name: characters
sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
collection:
dependency: transitive
description:
name: collection
sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf
url: "https://pub.dev"
source: hosted
version: "1.19.0"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04
url: "https://pub.dev"
source: hosted
version: "2.0.3"
lints:
dependency: transitive
description:
name: lints
sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452"
url: "https://pub.dev"
source: hosted
version: "2.1.1"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
url: "https://pub.dev"
source: hosted
version: "0.11.1"
meta:
dependency: transitive
description:
name: meta
sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7
url: "https://pub.dev"
source: hosted
version: "1.15.0"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
vector_math:
dependency: transitive
description:
name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
url: "https://pub.dev"
source: hosted
version: "2.1.4"
sdks:
dart: ">=3.6.0 <4.0.0"
flutter: ">3.27.0"

38
pubspec.yaml Normal file
View File

@@ -0,0 +1,38 @@
##SECTION --Project Information
name: astromic_extensions
description: The extensions module of the Astromic Presentation System
publish_to: "none"
## App Version scheme: Major.Feature.Fixes+Build
version: 0.1.0
##!SECTION --Project Information
#
#
##SECTION --Environment Constraints
environment:
sdk: ">=3.6.0"
flutter: ">3.27.0"
##!SECTION --Environment Constraints
#
#
##SECTION -- Dependencies Overrides
# dependency_overrides:
##!SECTION -- Dependencies Overrides
#
#
##SECTION --Development Dependencies
dev_dependencies:
flutter_lints: ^2.0.3
##
##!SECTION --Development Dependencies
#
#
##SECTION --Dependencies
dependencies:
flutter:
sdk: flutter
#
##!SECTION --Dependencies
#
#
##SECTION --App Assets
##!SECTION --App Assets