Files
astromic_extensions/README.md

3.6 KiB

Astromic Extensions

The Foundation of the Astromic Presentation System.

A collection of high-performance Dart extensions designed to eliminate UI boilerplate and simplify RTL (Right-to-Left) layout logic.


🛠 Features & API Reference

Layout & Spacing

Focus: Geometry generation, responsive units, and RTL resolution.

  • .resolveToDirectional() (EdgeInsetsGeometry): Automatically flips insets based on the current TextDirection.
  • .resolveToDirectional() (BorderRadiusGeometry): Reverses corner radii (e.g., top-left to top-right) for RTL support.
  • .copyWith() (EdgeInsetsGeometry / BorderRadiusGeometry): An additive method to combine geometries without overwriting existing values.
  • .padAll / .symH / .symV / .padTop / .padBot (num): Quick-access EdgeInsets generators directly from numbers.
  • .padStart / .padEnd (num): RTL-aware EdgeInsetsDirectional generators.
  • .ofSW() / .ofSH() (num): Returns a double representing a percentage of the screen width or height (e.g., 20.ofSW(context)).

Widget Wrappers (Fluent UI)

Focus: Eliminating nesting hell by wrapping widgets with dot-notation.

  • Layout: .center, .align(), .positioned(), .sized(), .rotated()
  • Transform: .flipH, .flipV, .opacity()
  • Spacing: .padAll(), .padSymH(), .padSymV(), .padTop(), .padBot(), .padStart(), .padEnd()
  • Context: .sw / .sh (BuildContext): Immediate, performant access to MediaQuery dimensions.
  • Utility: .safeArea, .circular, .visibleIf(bool): Structural UI tools for conditional rendering and clipping.

Data & Logic

Focus: Non-UI logic, collection manipulation, and string parsing.

  • .rich() (String): High-performance parser to convert strings into clickable/styled RichText using backtick markup (e.g., "Hello `World`{0}").
  • .toColor (String): Parses Hex strings (supports #, 0x, or raw hex) into Flutter Color objects.
  • .capitalize / .camelCaseToTitle (String): Advanced string formatting for UI labels and titles.
  • .replaceIfEmpty() (String / String?): Null-safe fallback logic to ensure UI strings never appear empty.
  • containsAll() (List<E>): Optimized O(n) check to see if a list contains all elements of another.
  • getUnique() (List<E>): Returns a list with duplicates removed using high-performance Set hashing.
  • .nonNulls / .limit() / .tryReduce() (List<E>): Safe collection utilities to prevent runtime errors.
  • mergeAllMaps() (List<Map>): Performs a deep merge of map collections with an optional key-collision comparer.
  • .generatePinCode (int): Generates a random numeric pin of the specified length for auth flows.

📦 Installation

dependencies:
  astromic_extensions:
    git:
      url: git.micazi.dev/micazi/astromic_extensions.git
      ref: main

🤝 Client Handoff & Continuity

To ensure project stability following the engagement, clients should follow these steps to secure a local version of this library:

  1. Mirror Repository: Clone this repository and re-upload it to your internal Git organization.

  2. Update Source: Update the pubspec.yaml in your application to point to your internal Git URL.

  3. Versioning: Always use a specific Git ref (tag or commit hash) to ensure build reproducibility.

Note: Access to the Micazi master repository is strictly controlled. Unauthorized redistribution of this source code is prohibited under the included LICENSE terms.


⚖️ License

Developed, Maintained, and property of Michael W. Aziz (Micazi). Refer to the LICENSE file for permitted use in client projects.