Docs
Overview
Getting started

Getting Started

Installation

Run the following command in the root of your project:

flutter pub add mix

Import it everywhere you use it:

import 'package:mix/mix.dart';

Styling Your First Widget

Flutter's Traditional Approach

In Flutter, you might style a Container with elevation and color like this:

Container(
  height: 100,
  width: 100,
  margin: EdgeInsets.symmetric(
    vertical: 10,
    horizontal: 20,
  ),
  decoration: BoxDecoration(
    color: Colors.blue,
    borderRadius: BorderRadius.circular(10),
    border: Border.all(
      color: Colors.black,
      width: 1,
      style: BorderStyle.solid,
    ),
  ),
  child: Text('Hello World'),
);

Mix's Approach

Now, let's style the same Container with Mix:

final style = Style(
  height(100),
  width(100),
  margin(10, 20),
  backgroundColor.blue(),
  borderRadius(10),
  border(
    color: Colors.black,
    width: 1,
    style: BorderStyle.solid,
  ),
);
 
Box(
  style: style,
  child: Text('Hello Mix'),
);