Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/update target sdk to 34 #1368

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions permission_handler/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 3 additions & 3 deletions permission_handler/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ android {
if (project.android.hasProperty("namespace")) {
namespace 'com.baseflow.permissionhandlerexample'
}
compileSdkVersion 33
compileSdkVersion 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -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
}
Expand Down
31 changes: 18 additions & 13 deletions permission_handler/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<PermissionHandlerWidget> createState() =>
_PermissionHandlerWidgetState();
}

Expand Down Expand Up @@ -76,18 +81,20 @@ class _PermissionHandlerWidgetState extends State<PermissionHandlerWidget> {
/// 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<PermissionWidget> {
_PermissionState(this._permission);
_PermissionState();

final Permission _permission;
PermissionStatus _permissionStatus = PermissionStatus.denied;

@override
Expand All @@ -98,7 +105,7 @@ class _PermissionState extends State<PermissionWidget> {
}

void _listenForPermissionStatus() async {
final status = await _permission.status;
final status = await widget._permission.status;
setState(() => _permissionStatus = status);
}

Expand All @@ -119,26 +126,26 @@ class _PermissionState extends State<PermissionWidget> {
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,
color: Colors.white,
),
onPressed: () {
checkServiceStatus(
context, _permission as PermissionWithService);
context, widget._permission as PermissionWithService);
})
: null,
onTap: () {
requestPermission(_permission);
requestPermission(widget._permission);
},
);
}
Expand All @@ -154,9 +161,7 @@ class _PermissionState extends State<PermissionWidget> {
final status = await permission.request();

setState(() {
print(status);
_permissionStatus = status;
print(_permissionStatus);
});
}
}
2 changes: 1 addition & 1 deletion permission_handler/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading