super_layout_builder 1.1.0 copy "super_layout_builder: ^1.1.0" to clipboard
super_layout_builder: ^1.1.0 copied to clipboard

The best way to create responsive layouts for dynamic screen sizes.

example/main.dart

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

// ignore: must_be_immutable
class Home extends StatelessWidget {
  int built = 0;

  Widget customDrawer() {
    return Flexible(
      flex: 1,
      child: Container(
        color: Colors.blue[800],
        child: ListView(
          children: [
            Material(
                color: Colors.blueAccent,
                child: ListTile(
                  leading: Icon(Icons.home),
                  selected: true,
                  title: Text('Home', style: TextStyle(color: Colors.white)),
                  onTap: () {},
                ))
          ],
        ),
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    built++;
    return SuperLayoutBuilder(
      triggerWidth: [850],
      triggerHeight: [500],
      builder: (c, m) => Scaffold(
        drawer: m.size.width <= 850 ? customDrawer() : null,
        appBar: AppBar(
          elevation: 0,
          title: Text('Home'),
        ),
        body: Column(
          children: <Widget>[
            Expanded(
              child: Row(
                children: <Widget>[
                  m.size.width <= 850 ? Container() : customDrawer(),
                  Flexible(
                    flex: 4,
                    child: Container(
                      child: Text('Times built: $built',
                          style: TextStyle(fontSize: 32)),
                    ),
                  )
                ],
              ),
            )
          ],
        ),
      ),
    );
  }
}
6
likes
130
points
21
downloads

Publisher

verified publishercleancode.dev

Weekly Downloads

The best way to create responsive layouts for dynamic screen sizes.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, rxdart

More

Packages that depend on super_layout_builder