diff --git a/permission_handler/CHANGELOG.md b/permission_handler/CHANGELOG.md index 65b8ef989..485f5e402 100644 --- a/permission_handler/CHANGELOG.md +++ b/permission_handler/CHANGELOG.md @@ -1,3 +1,7 @@ +## Next + +* Updated targetSdkVersion and compileSdkVersion of the android example project from 33 to 34. + ## 11.3.1 * Documents the use of the `PERMISSION_LOCAITON_WHENINUSE` macro on iOS. diff --git a/permission_handler/example/android/app/build.gradle b/permission_handler/example/android/app/build.gradle index 96967d6ca..af5e0e7e8 100644 --- a/permission_handler/example/android/app/build.gradle +++ b/permission_handler/example/android/app/build.gradle @@ -28,7 +28,7 @@ android { if (project.android.hasProperty("namespace")) { namespace 'com.baseflow.permissionhandlerexample' } - compileSdkVersion 33 + compileSdkVersion 34 compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 @@ -38,8 +38,8 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "com.baseflow.permissionhandler.example" - minSdkVersion 16 - targetSdkVersion 33 + minSdkVersion flutter.minSdkVersion + targetSdkVersion 34 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } diff --git a/permission_handler/example/lib/main.dart b/permission_handler/example/lib/main.dart index b1615f332..10ddf219d 100644 --- a/permission_handler/example/lib/main.dart +++ b/permission_handler/example/lib/main.dart @@ -19,14 +19,19 @@ final MaterialColor themeMaterialColor = /// A Flutter application demonstrating the functionality of this plugin class PermissionHandlerWidget extends StatefulWidget { + /// Creates a [PermissionHandlerWidget]. + const PermissionHandlerWidget({ + super.key, + }); + /// Create a page containing the functionality of this plugin static ExamplePage createPage() { return ExamplePage( - Icons.location_on, (context) => PermissionHandlerWidget()); + Icons.location_on, (context) => const PermissionHandlerWidget()); } @override - _PermissionHandlerWidgetState createState() => + State createState() => _PermissionHandlerWidgetState(); } @@ -76,18 +81,20 @@ class _PermissionHandlerWidgetState extends State { /// Permission widget containing information about the passed [Permission] class PermissionWidget extends StatefulWidget { /// Constructs a [PermissionWidget] for the supplied [Permission] - const PermissionWidget(this._permission); + const PermissionWidget( + this._permission, { + super.key, + }); final Permission _permission; @override - _PermissionState createState() => _PermissionState(_permission); + _PermissionState createState() => _PermissionState(); } class _PermissionState extends State { - _PermissionState(this._permission); + _PermissionState(); - final Permission _permission; PermissionStatus _permissionStatus = PermissionStatus.denied; @override @@ -98,7 +105,7 @@ class _PermissionState extends State { } void _listenForPermissionStatus() async { - final status = await _permission.status; + final status = await widget._permission.status; setState(() => _permissionStatus = status); } @@ -119,14 +126,14 @@ class _PermissionState extends State { Widget build(BuildContext context) { return ListTile( title: Text( - _permission.toString(), + widget._permission.toString(), style: Theme.of(context).textTheme.bodyLarge, ), subtitle: Text( _permissionStatus.toString(), style: TextStyle(color: getPermissionColor()), ), - trailing: (_permission is PermissionWithService) + trailing: (widget._permission is PermissionWithService) ? IconButton( icon: const Icon( Icons.info, @@ -134,11 +141,11 @@ class _PermissionState extends State { ), onPressed: () { checkServiceStatus( - context, _permission as PermissionWithService); + context, widget._permission as PermissionWithService); }) : null, onTap: () { - requestPermission(_permission); + requestPermission(widget._permission); }, ); } @@ -154,9 +161,7 @@ class _PermissionState extends State { final status = await permission.request(); setState(() { - print(status); _permissionStatus = status; - print(_permissionStatus); }); } } diff --git a/permission_handler/example/pubspec.yaml b/permission_handler/example/pubspec.yaml index f72dbeae5..ac5a69050 100644 --- a/permission_handler/example/pubspec.yaml +++ b/permission_handler/example/pubspec.yaml @@ -2,7 +2,7 @@ name: permission_handler_example description: Demonstrates how to use the permission_handler plugin. environment: - sdk: ">=2.15.0 <4.0.0" + sdk: ">=2.17.0 <4.0.0" dependencies: baseflow_plugin_template: ^2.1.1