screen_brightness 0.0.3 screen_brightness: ^0.0.3 copied to clipboard
A Plugin for controlling screen brightness with application life cycle set and reset brightness implemented
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,
],
);
}
}