stylix_ui 1.0.4 copy "stylix_ui: ^1.0.4" to clipboard
stylix_ui: ^1.0.4 copied to clipboard

A semantic Flutter design system with customizable themes, brand presets, typography, and reusable UI components.

πŸ’Ž Stylix UI #

Pub Version License Flutter

Stylix UI is a beautiful, highly-opinionated, and highly-scalable design system for Flutter. It brings together expertly crafted color palettes (brands), pixel-perfect spacing, modern typography, elevation shadows, layout gaps, and fully pre-built component styles (Buttons & Cards).

Say goodbye to manually tweaking padding and hunting for hex codes. Stylix acts as the unified design language for your entire application.


✨ Features #

  • 18 Premium Brand Presets: Instantly switch your entire app's look and feel with one line of code.
  • Dynamic Light/Dark Modes: Automatically adapts your brand tokens to perfectly balanced light and dark schemes.
  • Semantic Tokens via Context: Access colors contextually with context.stylixColors.background instead of messy raw colors.
  • Unified Spacing & Gaps: No more magic numbers. Use StylixSpacing.md and StylixGap.hXl for consistent layouts.
  • Pre-built Component Styles: Instantly style Buttons and Cards with StylixButtonStyles and StylixCardStyles.
  • 40+ Premium Gradients: Access beautifully crafted linear gradients for hero sections, cards, and backgrounds via StylixGradients.
  • Premium Typography: Integrates seamlessly with GoogleFonts (Barlow Condensed for English, Cairo for Arabic).

πŸš€ Getting Started #

1. Add Dependency #

Add stylix_ui to your pubspec.yaml:

dependencies:
  stylix_ui: ^1.0.3

2. Initialize the Theme #

Wrap your MaterialApp with StylixTheme.light and StylixTheme.dark.

import 'package:flutter/material.dart';
import 'package:stylix_ui/stylix_ui.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    // 1. Pick one of the 18 gorgeous built-in brands!
    const brand = StylixBrand.jadeCanopy;

    return MaterialApp(
      title: 'Stylix Demo',
      themeMode: ThemeMode.system,
      // 2. Inject Stylix into ThemeData
      theme: StylixTheme.light(brand, locale: const Locale('en', 'US')),
      darkTheme: StylixTheme.dark(brand, locale: const Locale('en', 'US')),
      home: const HomePage(),
    );
  }
}

🎨 Core Systems & Code Examples #

1. Colors & Semantic Tokens #

Access your theme's semantic colors from anywhere using the context.stylixColors extension. This ensures your app perfectly adapts to light/dark modes automatically.

Container(
  // Use semantic colors!
  color: context.stylixColors.surfaceContainer,
  child: Text(
    'Hello World',
    style: TextStyle(
      color: context.stylixColors.primary,
    ),
  ),
)

2. The 18 Brand Presets #

Stylix comes with 18 professionally designed brand palettes. You can access them via the StylixBrand enum. If you need a readable string for the UI (like a settings dropdown), just use .displayName!

final currentBrand = StylixBrand.neonVelvet;
print(currentBrand.displayName); // "Neon Velvet"

Available Brands:
Default Jade Canopy Imperial Nova Rouge Synth Midnight Armor Toxic Flora
Arctic Forge Skyline Pulse Neon Velvet Violet Alloy Phantom Mint Ember Core
Royal Blush Deep Forest Tidal Mist Solar Eclipse Neon Tide Lavender Pulse

3. Spacing & Gaps (StylixSpacing / StylixGap) #

Stop hardcoding 16.0 and 8.0. Use the standardized semantic spacing scale.

Available Spacing Values (StylixSpacing): none, xxs, xs, sm, md, lg, xl, xxl, xxxl, huge

Available Gaps (StylixGap):

  • Horizontal: wNone, wXxs, wXs, wSm, wMd, wLg, wXl, wXxl, wXxxl
  • Vertical: hNone, hXxs, hXs, hSm, hMd, hLg, hXl, hXxl, hXxxl

Convenience Padding (StylixInsets): screenPadding, cardPadding, dialogPadding, buttonPadding, chipPadding, inputContentPadding

// ❌ Bad: Magic Numbers
Padding(
  padding: EdgeInsets.all(16.0),
  child: Column(
    children: [
      Text('Title'),
      SizedBox(height: 24.0),
      Text('Subtitle'),
    ]
  )
)

// βœ… Good: Stylix Semantic Spacing
Padding(
  padding: EdgeInsets.all(StylixSpacing.lg),
  child: Column(
    children: [
      Text('Title'),
      StylixGap.hXl, // Automatically creates a SizedBox with height 24.0
      Text('Subtitle'),
    ]
  )
)

(Note: StylixSpacing.none and StylixGap.hNone / wNone are also available for 0.0 spacing!)

4. Borders & Radius (StylixRadius & StylixCorners) #

Achieve consistent roundness across your entire app using explicit doubles (StylixRadius) or pre-built BorderRadius objects (StylixCorners).

Available Radius Tokens: none, xs, sm, md, lg, xl, xxl, pill

Container(
  decoration: BoxDecoration(
    color: context.stylixColors.card,
    // Use pre-built BorderRadius objects!
    borderRadius: StylixCorners.md, 
  ),
)

5. Elevation & Shadows (StylixShadows) #

Beautiful, buttery-smooth shadows that look modern, unlike the default harsh Material shadows.

Container(
  decoration: BoxDecoration(
    color: context.stylixColors.surface,
    boxShadow: StylixShadows.lg(context.stylixColors), // Perfectly tuned shadow
  ),
)

6. Component Styles (StylixButtonStyles & StylixCardStyles) #

Stylix provides static helpers that instantly generate complex ButtonStyle and BoxDecoration objects so you don't have to write boilerplate.

Buttons:

ElevatedButton(
  // Instantly applies the primary brand color, correct padding, and hover states!
  style: StylixButtonStyles.primary(context.stylixColors, Theme.of(context).textTheme),
  onPressed: () {},
  child: const Text('Primary Action'),
)

OutlinedButton(
  style: StylixButtonStyles.outline(context.stylixColors, Theme.of(context).textTheme),
  onPressed: () {},
  child: const Text('Secondary Action'),
)

Cards:

Container(
  padding: StylixCardStyles.padding, // Standardized 16.0 padding
  decoration: StylixCardStyles.surface(context.stylixColors), // Standard background + border + shadow
  child: const Text('I am a card!'),
)

7. Gradients (StylixGradients & StylixGradient) #

Need a beautiful background for a splash screen, onboarding, or a premium card? Stylix includes over 40 hand-crafted gradients.

Sunlit Glow Ocean Breeze Sunset Blush Lavender Dream
Aqua Splash Coral Crush Emerald Wave Pink Lemonade
Mint Fusion Violet Haze Berry Dusk Fiery Dawn
Magenta Pulse Neon Sky Turquoise Tide Peach Glow
Citrus Sky Lime Pop Golden Night Amber Flame
Teal Abyss Copper Violet Bubblegum Bliss Aqua Indigo
Saffron Plum Mustard Twilight Lemon Zest Green Sapphire
Crimson Flare Canary Amethyst Peach Rose Sky Sapphire
Coral Berry Mango Magenta Mint Cyan Midnight Bloom
Lime Burst Blue Horizon Fuchsia Night Teal Blush
Pink Sunrise Golden Blue Vivid Plum Mint Cobalt
Crimson Cobalt Coral Gold Aqua Depth Blue Volt
Fuchsia Dusk Lime Sky Royal Purple Electric Lime
Coral Teal Indigo Shift Pink Burst Cyber Blue
Fresh Green Sunset Pink Pastel Dream Lavender Gold
Blush Rose Ice Blue Peach Sunset Neon Pink
Mint Wave Fiery Orange Golden Lavender Forest Green
Warm Peach Vivid Sunset Default

Container(
  decoration: BoxDecoration(
    // Access a specific gradient by ID or list
    gradient: StylixGradients.all.first.gradient,
  ),
)

πŸ›  Example App #

Want to see all these tokens, brands, and components in action? Check out the example/ folder! It includes a full DesignSystemPreviewPage that allows you to hot-swap between all 18 brands and instantly see how the spacing, colors, and typography react.

0
likes
150
points
188
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A semantic Flutter design system with customizable themes, brand presets, typography, and reusable UI components.

Repository (GitHub)
View/report issues

Topics

#flutter #design-system #theme #material3 #design-tokens

License

MIT (license)

Dependencies

flutter, google_fonts

More

Packages that depend on stylix_ui