Last updated:
0 purchases
flutter resources
flutter_resources #
Flutter resources management plugin for improve your application responsibility.
Getting Started #
Import library.
import 'package:flutter_resources/flutter_resources.dart';
copied to clipboard
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,
};
}
copied to clipboard
If no one options not conditions will be returned default value fron null options.
Put Resources widget before App widget.
Resources(
delegates: [
IntResources(),
IntTabletResources(),
... // Other resource delegates.
],
child: MaterialApp(),
)
copied to clipboard
Get data.
final resources = Resources.of(context);
final size = resources.get<int>('some_size');
copied to clipboard
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)
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.