dynamic_app 1.0.1

  • Readme
  • Changelog
  • Installing
  • 58

dynamic_app #

Dynamically change your theme and locale

How to use #

First add dynamic_app to you'r dependencies

dependencies:
dynamic_app: ^0.1.1

Then install it

$ flutter packages get

And finaly import and use it like that

import 'package:dynamic_app/dynamic_app.dart';

In you'r application change you'r aplication to be like this code

return DynamicApp(
      defaultLocale: Locale('fa'),
      themes: [
        ThemeData(primaryColor: Colors.yellow),
        ThemeData(primaryColor: Colors.deepPurpleAccent),
        ThemeData(brightness: Brightness.dark)
      ],
      selectedTheme: 0,
      dynamicWidgetBuilder: (context, theme, locale) {
        return MaterialApp(
          title: 'Flutter Demo',
          locale: locale,
          theme: theme,
          home: MyHomePage(title: 'Flutter Demo Home Page'),
        );
      },
    );

And for changeing theme and locale use this code's

  void changeTheme(int selectedTheme)
  {
    // selectedTheme is the position of theme in theme array
    DynamicApp.of(context).selectTheme(selectedTheme);
  }

  void changeLocale() {
    DynamicApp.of(context).setLocale("en");
  }

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

[0.1.1] - 2019/3/6 #

Added theme and locale and brightness dynamic change

[0.2.1] - 2019/3/9 #

Made Theme builder function async

[1.0.1] - 2019/3/10 #

Removed brightness from dynamic app and instead of that we create as predefined array

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  dynamic_app: ^1.0.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:dynamic_app/dynamic_app.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
32
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
62
Overall:
Weighted score of the above. [more]
58
Learn more about scoring.

We analyzed this package on Apr 8, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6
  • Flutter: 1.12.13+hotfix.8

Health suggestions

Fix lib/src/dynamic_app.dart. (-1 points)

Analysis of lib/src/dynamic_app.dart reported 2 hints:

line 29 col 15: 'ancestorStateOfType' is deprecated and shouldn't be used. Use findAncestorStateOfType instead. This feature was deprecated after v1.12.1..

line 29 col 41: 'TypeMatcher' is deprecated and shouldn't be used. TypeMatcher has been deprecated because it is no longer used in framework(only in deprecated methods). This feature was deprecated after v1.12.1..

Format lib/dynamic_app.dart.

Run flutter format to format lib/dynamic_app.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and dynamic_app.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Package is getting outdated. (-7.95 points)

The package was last published 56 weeks ago.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
shared_preferences ^0.5.1+1 0.5.6+3
Transitive dependencies
collection 1.14.11 1.14.12
flutter_web_plugins 0.0.0
meta 1.1.8
shared_preferences_macos 0.0.1+6
shared_preferences_platform_interface 1.0.3
shared_preferences_web 0.1.2+4
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test