style_widget 0.0.1 copy "style_widget: ^0.0.1" to clipboard
style_widget: ^0.0.1 copied to clipboard

A concept for decorator syntax without the namespace leakage

example/lib/main.dart

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

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  var visible = true;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'styled_widget',
      home: Material(
        child: Padding(
          padding: const EdgeInsets.all(8.0),
          child: Column(
            children: [
              Switch.adaptive(
                value: visible,
                onChanged: (x) => setState(() => visible = x),
              ),
              SizedBox(
                height: 200,
                child: Center(
                  child: Placeholder(
                    child: StyleWidget(
                      style: (s) => s
                          .marginAll()
                          .paddingAll()
                          .backgroundColor(Colors.black)
                          .foregroundColor(Colors.white)
                          .boxShadow(const BoxShadow(blurRadius: 8))
                          .iconSize(24)
                          .borderRadius(8)
                          .animated(delay: const Duration(milliseconds: 500))
                          .collapseY(!visible)
                          .collapseX(!visible)
                          .opacity(visible ? 1 : 0)
                          .translate(y: visible ? 0 : 20)
                          .rotate(visible ? 0 : 45)
                          .fontSize(20)
                          .fontFamily('courier')
                          .fontWeight(FontWeight.bold)
                          .rotateAlignment(Alignment.center),
                      child: Column(
                        mainAxisSize: MainAxisSize.min,
                        children: [
                          const Text("Hello"),
                          const Row(
                            mainAxisSize: MainAxisSize.min,
                            children: [
                              Icon(Icons.check),
                              Text("Subtitle"),
                            ],
                          ),
                          FilledButton(
                            child: const Text("Continue"),
                            onPressed: () {
                              print("boom");
                            },
                          )
                        ],
                      ),
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
7
likes
130
points
24
downloads

Publisher

unverified uploader

Weekly Downloads

A concept for decorator syntax without the namespace leakage

Repository (GitHub)

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on style_widget