dynamic_app 1.0.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • new61

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 packages get

Alternatively, your editor might support flutter packages 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';
  
Version Uploaded Documentation Archive
1.0.1 Mar 10, 2019 Go to the documentation of dynamic_app 1.0.1 Download dynamic_app 1.0.1 archive
0.2.1 Mar 9, 2019 Go to the documentation of dynamic_app 0.2.1 Download dynamic_app 0.2.1 archive
0.1.1 Mar 6, 2019 Go to the documentation of dynamic_app 0.1.1 Download dynamic_app 0.1.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
34
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
61
Learn more about scoring.

We analyzed this package on Mar 10, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.3.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

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.

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.1+1
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test