dynamic_material_app 0.0.1 copy "dynamic_material_app: ^0.0.1" to clipboard
dynamic_material_app: ^0.0.1 copied to clipboard

Dynamic Material App Widget

Dynamic Material App Widget #

This widget automatically decides theme mode depending on the light in the surroundings.This only works for an Android app.

Install #

Add dynamic_material_app as a dependency in pubspec.yaml. For help on adding as a dependency, view the documentation.

Usage #

First import package.

import 'package:dynamic_material_app/theme_data_bloc.dart';

Add the following line in main.dart.

void main(){
  WidgetsFlutterBinding.ensureInitialized();
  runApp(MyApp());
}

Add this widget as root widget.



class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return DynamicMaterialApp(
      theme: ThemeData.light(), //You can give your custom light mode theme.
      
      darkTheme: ThemeData.dark(), //You can give your custom dark mode theme.
       
      home: Scaffold(),
    );
  }
}
0
likes
20
pub points
0%
popularity

Publisher

unverified uploader

Dynamic Material App Widget

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, light

More

Packages that depend on dynamic_material_app