flutter_resources 0.0.4
flutter_resources: ^0.0.4

Flutter Android iOS

Flutter resources managment plugin.

flutter_resources #

Flutter resources managment plugin.

Getting Started #

  1. Import library.
import 'package:flutter_resources/flutter_resources.dart';
  1. Create resource delegates. For example:
class IntResources extends ResourceDelegate<int> {
  
  @override
  Map<String, Resource<int>> get resources => {
    'name': Resource(15, [
      ResourceOption(5,
        screenSize: ScreenSize.normal,
        displayMetrics: DisplayMetrics.h,
      )
    ]),
    'custom': Resource(10, [
      ResourceOption(2,
        displayMetrics: DisplayMetrics.xh,
        screenSize: ScreenSize.normal,
        displayMetrics: DisplayMetrics.h,
        orientation: Orientation.landscape,
        languageCode: 'en',
        countryCode: 'US',
        platform: PlatformType.Android,
      )
    ])
  };

}

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

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

Support options #

  • displayMetrics (s, m, h, xh, xxh, xxxh);
  • screenSize (small, normal, large);
  • orientation (portrait, landscape);
  • brightness (dark, light);
  • platform (web, android, ios, fuchsia, macOS, linux, windows)
  • languageCode;
  • countryCode;
0
likes
70
pub points
18%
popularity

Flutter resources managment plugin.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

alezhk@gmail.com

License

GPL 3.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on flutter_resources