screen_brightness 0.0.4 copy "screen_brightness: ^0.0.4" to clipboard
screen_brightness: ^0.0.4 copied to clipboard

outdated

A Plugin for controlling screen brightness with application life cycle set and reset brightness implemented

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:screen_brightness_example/view/blank_page.dart';
import 'package:screen_brightness_example/view/controller_page.dart';
import 'package:screen_brightness_example/view/home_page.dart';
import 'package:screen_brightness_example/view/route_aware_page.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  static final RouteObserver<Route> routeObserver = RouteObserver<Route>();

  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: const HomePage(),
      onGenerateRoute: (settings) {
        late final Widget page;
        switch (settings.name) {
          case HomePage.routeName:
            page = const HomePage();
            break;

          case ControllerPage.routeName:
            page = const ControllerPage();
            break;

          case RouteAwarePage.routeName:
            page = const RouteAwarePage();
            break;

          case BlankPage.routeName:
            page = const BlankPage();
            break;

          default:
            throw UnimplementedError('page name not found');
        }

        return MaterialPageRoute(
          builder: (context) => page,
          settings: settings,
        );
      },
      navigatorObservers: [
        routeObserver,
      ],
    );
  }
}
117
likes
0
pub points
98%
popularity

Publisher

unverified uploader

A Plugin for controlling screen brightness with application life cycle set and reset brightness implemented

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on screen_brightness