1- import 'package:baseflow_plugin_template/baseflow_plugin_template.dart' ;
21import 'package:flutter/material.dart' ;
32import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart' ;
43
54void main () {
6- runApp (
7- BaseflowPluginExample (
8- pluginName: 'Permission Handler' ,
9- githubURL: 'https://github.com/Baseflow/flutter-permission-handler' ,
10- pubDevURL: 'https://pub.dev/packages/permission_handler' ,
11- pages: [PermissionHandlerWidget .createPage ()],
12- ),
13- );
5+ runApp (const PermissionHandlerExampleApp ());
146}
157
16- ///Defines the main theme color
17- final MaterialColor themeMaterialColor =
18- BaseflowPluginExample .createMaterialColor (
19- const Color .fromRGBO (48 , 49 , 60 , 1 ),
8+ /// A Flutter application demonstrating the functionality of this plugin
9+ class PermissionHandlerExampleApp extends StatelessWidget {
10+ const PermissionHandlerExampleApp ({super .key});
11+
12+ @override
13+ Widget build (BuildContext context) {
14+ return MaterialApp (
15+ title: 'Permission Handler Example' ,
16+ theme: ThemeData (
17+ colorScheme: ColorScheme .fromSeed (seedColor: Colors .blue),
18+ useMaterial3: true ,
19+ ),
20+ home: const PermissionHandlerWidget (),
2021 );
22+ }
23+ }
2124
2225/// A Flutter application demonstrating the functionality of this plugin
2326class PermissionHandlerWidget extends StatefulWidget {
24- /// Creates a [PermissionHandlerWidget] .
2527 const PermissionHandlerWidget ({super .key});
2628
27- /// Create a page containing the functionality of this plugin
28- static ExamplePage createPage () {
29- return ExamplePage (
30- Icons .location_on,
31- (context) => const PermissionHandlerWidget (),
32- );
33- }
34-
3529 @override
3630 State <PermissionHandlerWidget > createState () =>
3731 _PermissionHandlerWidgetState ();
@@ -40,31 +34,33 @@ class PermissionHandlerWidget extends StatefulWidget {
4034class _PermissionHandlerWidgetState extends State <PermissionHandlerWidget > {
4135 @override
4236 Widget build (BuildContext context) {
43- return Center (
44- child: ListView (
45- children:
46- Permission .values
47- .where ((permission) {
48- return permission != Permission .unknown &&
49- permission != Permission .mediaLibrary &&
50- permission != Permission .photosAddOnly &&
51- permission != Permission .reminders &&
52- permission != Permission .bluetooth &&
53- permission != Permission .appTrackingTransparency &&
54- permission != Permission .criticalAlerts &&
55- permission != Permission .assistant &&
56- permission != Permission .backgroundRefresh;
57- })
58- .map ((permission) => PermissionWidget (permission))
59- .toList (),
37+ return Scaffold (
38+ appBar: AppBar (title: const Text ('Permission Handler' )),
39+ body: Center (
40+ child: ListView (
41+ children:
42+ Permission .values
43+ .where ((permission) {
44+ return permission != Permission .unknown &&
45+ permission != Permission .mediaLibrary &&
46+ permission != Permission .photosAddOnly &&
47+ permission != Permission .reminders &&
48+ permission != Permission .bluetooth &&
49+ permission != Permission .appTrackingTransparency &&
50+ permission != Permission .criticalAlerts &&
51+ permission != Permission .assistant &&
52+ permission != Permission .backgroundRefresh;
53+ })
54+ .map ((permission) => PermissionWidget (permission))
55+ .toList (),
56+ ),
6057 ),
6158 );
6259 }
6360}
6461
6562/// Permission widget containing information about the passed [Permission]
6663class PermissionWidget extends StatefulWidget {
67- /// Constructs a [PermissionWidget] for the supplied [Permission]
6864 const PermissionWidget (this ._permission, {super .key});
6965
7066 final Permission _permission;
@@ -121,7 +117,7 @@ class _PermissionState extends State<PermissionWidget> {
121117 trailing:
122118 (widget._permission is PermissionWithService )
123119 ? IconButton (
124- icon: const Icon (Icons .info, color : Colors .white ),
120+ icon: const Icon (Icons .info),
125121 onPressed: () {
126122 checkServiceStatus (
127123 context,
0 commit comments