elbe 0.1.43 copy "elbe: ^0.1.43" to clipboard
elbe: ^0.1.43 copied to clipboard

a toolkit for simplifying frontend development

example/lib/main.dart

import 'package:elbe/bit/bit/bit.dart';
import 'package:elbe/elbe.dart';
import 'package:example/routes.dart';

void main() => runApp(_App());

class _App extends StatelessWidget {
  _App({Key? key}) : super(key: key);

  final GoRouter _appRouter = GoRouter(routes: appRoutes);

  @override
  Widget build(BuildContext context) =>
      BitBuildProvider<ColorModes, ColorModes, String, ColorModeBit>(
          create: (_) => ColorModeBit(),
          onData: (_, d) => ElbeApp(
                router: _appRouter,
                mode: d,
                debugShowCheckedModeBanner: false,
                theme: ThemeData.preset(color: Colors.blueAccent),
              ));
}

class ColorModeBit extends MapMsgBitControl<ColorModes> {
  static const builder = MapMsgBitBuilder<ColorModes, ColorModeBit>.make;
  ColorModeBit()
      : super.worker((w) => ColorModes.light, initial: ColorModes.light);

  void toggle() => state.whenOrNull(onData: (d) {
        emit(d == ColorModes.light ? ColorModes.dark : ColorModes.light);
      });
}
4
likes
0
points
270
downloads

Publisher

verified publisherrobbb.in

Weekly Downloads

a toolkit for simplifying frontend development

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

collection, flutter, go_router, lucide_icons, package_info_plus

More

Packages that depend on elbe