live 0.1.0 copy "live: ^0.1.0" to clipboard
live: ^0.1.0 copied to clipboard

Reactive,adaptive and responsive Flutter UI and commonly used widgets.

Live #

Reactive, adaptive and responsive Flutter UI components and commonly used widgets.

Reactivity #


Use LiveValue and LiveView to make your widgets react to state changes.
// counter app with live view
class MyCounter extends StatelessWidget {
  final LiveValue<int> _count = LiveValue(0);


  Widget build(BuildContext context) {
    return Column(
        children: [
          LiveView<int>(
            live: _count,
            builder: (BuildContext context, int count, Widget child) {
              return Row(
                  children: [
                    child,
                    Text("${count}"),
                  ]
              );
            },

            /// specify a child that you dont want rebuilt
            child: Text("Current Count: "),
          ),
          IconButton(
            icon: const Icon(Icons.plus),
            onPressed: () {
              _count.update(count + 1);
            },
          ),
          IconButton(
            icon: const Icon(Icons.plus),
            onPressed: () {
              _count.update(count + 2);
            },
          ),
        ]
    );
  }
}

Responsiveness & Adaptive #


Live feature an BuildContext extension with adapters and easy-access properties that include :
  • screen size
  • orientation
  • platform breakpoint
  • adapter transformer functions

Your app will react to all/any of that when they change.

// counter app with live view
class MyCounter extends StatelessWidget {


  Widget build(final BuildContext context) {
    return Column(
        children: [
          Text("ScreenWidth: ${context.width}, ScreenHeight: ${context.height}"),
          adapt(
            phone: context.orient(landscape: Text("Phone on landscape!"), portrait: Text("Phone on portrait")),
            // phone(small:,medium:,large:,)
            tablet: context.tablet(small: Text("Small tablet!"), large: Text("tablet Large!")),
            desktop: Text("On Desktop!"), // desktop(small:,medium:,large:,)
          ),
          platform(
            web: Text("We are on web"),
            android: Text("we are on android"),
            // linux,macOS,chromeOS,mobile,desktop,+more
          )
        ]
    );
  }
}

Getting started #

Note: if you wanted just reactivity and are willing to build your own widgets use the structures package.

$ flutter pub get live

Additional information #

This package is a set of tools built by Luminucx .inc dev team to enhance the experience developers and encourage them to write clean and efficient code.

Go through it to make sure it is right for use with your project.

3
likes
0
pub points
10%
popularity

Publisher

verified publisherluminucx.com

Reactive,adaptive and responsive Flutter UI and commonly used widgets.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, google_fonts, meta, structures

More

Packages that depend on live