responsive_util 0.4.0 copy "responsive_util: ^0.4.0" to clipboard
responsive_util: ^0.4.0 copied to clipboard

A Flutter widget that allows drag resizing of its child's bounds to easily test responsive design.

example/README.md

Usage #

Resize the entire screen's layout.

@override
Widget build(BuildContext context) {
  return ResponsiveUtil(
    child: Scaffold(
      body: Container()
    ),
  );
}

Or use the builder function to directly pass updated constraints without needing a separate LayoutBuilder

ResponsiveUtil(
  builder: (context, constraints) {
    // if width < 300, use a column rather than a Row
    Axis direction =
        constraints.maxWidth > 300 ? Axis.horizontal : Axis.vertical;
    return Card(
      child: Flex(
        direction: direction,
        children: <Widget>[
          // ....
        ],
      ),
    );
  },
)

If the Widget to resize is in some ScrollView, also pass in the a ScrollController.

SingleChildScrollView(
  controller: _scrollController,
  child: ResponsiveUtil(
    scrollController: _scrollController,
    builder: (context, constraints) {
      // if width < 300, use a column rather than a Row
      Axis direction =
          constraints.maxWidth > 300 ? Axis.horizontal : Axis.vertical;
      return Card(
        child: Flex(
          direction: direction,
          children: <Widget>[
            // ....
          ],
        ),
      );
    },
  ),
)
51
likes
120
pub points
72%
popularity

Publisher

verified publisherclearbluedesign.com

A Flutter widget that allows drag resizing of its child's bounds to easily test responsive design.

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on responsive_util