flutter_control 0.14.1+11 copy "flutter_control: ^0.14.1+11" to clipboard
flutter_control: ^0.14.1+11 copied to clipboard

outdated

Flutter Control is library to simply maintain App and State management. Provides some basic Widgets and Controllers to start with.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_control/core.dart';

import 'cards_controller.dart';
import 'menu_page.dart';

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

class MyApp extends StatelessWidget with LocalizationProvider, PrefsProvider {
  final _theme = ActionControl<ThemeData>.broadcastListener(
    key: 'theme',
    defaultValue: ThemeData(
      primaryColor: Colors.orange,
    ),
  );

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return ControlBase(
      debug: true,
      defaultLocale: 'en',
      locales: {
        'en': AssetPath().localization('en'),
        'cs': 'assets/localization/cs.json',
      },
      entries: {
        'cards': CardsController(),
      },
      initializers: {
        DetailController: (args) => DetailController(),
      },
      theme: (context) => MyTheme.of(context),
      root: (context) => MenuPage(),
      app: (context, key, home) {
        return ControlBuilder<ThemeData>(
            controller: _theme,
            builder: (context, theme) {
              return MaterialApp(
                key: key,
                home: home,
                title: localization.isActive ? localize('app_name') : 'Flutter Example',
                theme: theme,
              );
            });
      },
    );
  }
}

class MyTheme extends ControlTheme {
  @override
  final padding = 24.0;

  @override
  final paddingHalf = 12.0;

  final superColor = Colors.red;

  MyTheme(Device device, ThemeData data) : super(device, data);

  factory MyTheme.of(BuildContext context) {
    return MyTheme(Device.of(context), Theme.of(context));
  }

  MyTheme copy(ThemeData data) => MyTheme(
        device,
        data,
      );
}
20
likes
0
pub points
57%
popularity

Publisher

verified publisherbasecontrol.dev

Flutter Control is library to simply maintain App and State management. Provides some basic Widgets and Controllers to start with.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, shared_preferences

More

Packages that depend on flutter_control