flutter_resources 1.0.0 copy "flutter_resources: ^1.0.0" to clipboard
flutter_resources: ^1.0.0 copied to clipboard

Flutter resources managment plugin.

flutter_resources #

Flutter resources management plugin for improve your application responsibility.

Getting Started #

  1. Import library.
import 'package:flutter_resources/flutter_resources.dart';
  1. Create resource delegates. For example:
class IntResources extends ResourceDelegate<int> {

  @override
  ResourceOption? get options => null;
  
  @override
  Map<String, Resource<int>> get resources => {
    'some_size': 15,
  };

}
class IntTabletResources extends ResourceDelegate<int> {

  @override
  ResourceOption? get options => ResourceOption(5,
    shortestSide: 700,
  );
  
  @override
  Map<String, Resource<int>> get resources => {
    'some_size': 70,
  };

}

If no one options not conditions will be returned default value fron null options.

  1. Put Resources widget before App widget.
Resources( 
    delegates: [
        IntResources(),
        IntTabletResources(),
        ... // Other resource delegates.
    ],
    child: MaterialApp(), 
)
  1. Get data.
final resources = Resources.of(context);
final size = resources.get<int>('some_size');

Support options #

  • displayMetrics (l, m, h, xh, xxh, xxxh);
  • screenSize (small, normal, large, xlarge);
  • orientation (portrait, landscape);
  • brightness (dark, light);
  • platform (web, android, ios, fuchsia, macOS, linux, windows)
  • languageCode;
  • countryCode;
  • shortestSide; (for example may be use for detect tablet. Just set >=700)
3
likes
30
pub points
45%
popularity

Publisher

unverified uploader

Flutter resources managment plugin.

Repository (GitHub)
View/report issues

License

GPL-3.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_resources