Skip to content

Commit 9bc7b03

Browse files
authored
[permission_handler] Update README and example (#862)
1 parent 0845016 commit 9bc7b03

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

packages/permission_handler/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 1.4.1
2+
3+
* Update README.
4+
* Update the example app.
5+
16
## 1.4.0
27

38
* Update minimum Flutter and Dart version to 3.13 and 3.1.

packages/permission_handler/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ You can use this plugin to ask the user for runtime permissions if your app perf
2020

2121
```yaml
2222
dependencies:
23-
permission_handler: ^10.4.3
24-
permission_handler_tizen: ^1.3.0
23+
permission_handler: ^12.0.0
24+
permission_handler_tizen: ^1.4.1
2525
```
2626
2727
Then you can import `permission_handler` in your Dart code:

packages/permission_handler/example/lib/main.dart

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,18 @@ final MaterialColor themeMaterialColor =
2121

2222
/// A Flutter application demonstrating the functionality of this plugin
2323
class PermissionHandlerWidget extends StatefulWidget {
24-
/// Default Constructor
25-
const PermissionHandlerWidget({super.key});
24+
const PermissionHandlerWidget._();
2625

2726
/// Create a page containing the functionality of this plugin
2827
static ExamplePage createPage() {
2928
return ExamplePage(
3029
Icons.location_on,
31-
(context) => const PermissionHandlerWidget(),
30+
(context) => const PermissionHandlerWidget._(),
3231
);
3332
}
3433

3534
@override
36-
_PermissionHandlerWidgetState createState() =>
35+
State<PermissionHandlerWidget> createState() =>
3736
_PermissionHandlerWidgetState();
3837
}
3938

@@ -79,30 +78,29 @@ class _PermissionHandlerWidgetState extends State<PermissionHandlerWidget> {
7978
/// Permission widget containing information about the passed [Permission]
8079
class PermissionWidget extends StatefulWidget {
8180
/// Constructs a [PermissionWidget] for the supplied [Permission]
82-
const PermissionWidget(this._permission, {super.key});
81+
const PermissionWidget(this.permission, {super.key});
8382

84-
final Permission _permission;
83+
/// The [Permission] for which this widget is rendered.
84+
final Permission permission;
8585

8686
@override
87-
_PermissionState createState() {
88-
return _PermissionState();
89-
}
87+
State<PermissionWidget> createState() => _PermissionState();
9088
}
9189

9290
class _PermissionState extends State<PermissionWidget> {
93-
late Permission _permission;
91+
_PermissionState();
92+
9493
PermissionStatus _permissionStatus = PermissionStatus.denied;
9594

9695
@override
9796
void initState() {
9897
super.initState();
99-
_permission = widget._permission;
10098

10199
_listenForPermissionStatus();
102100
}
103101

104102
void _listenForPermissionStatus() async {
105-
final status = await _permission.status;
103+
final status = await widget.permission.status;
106104
setState(() => _permissionStatus = status);
107105
}
108106

@@ -123,26 +121,26 @@ class _PermissionState extends State<PermissionWidget> {
123121
Widget build(BuildContext context) {
124122
return ListTile(
125123
title: Text(
126-
_permission.toString(),
124+
widget.permission.toString(),
127125
style: Theme.of(context).textTheme.bodyLarge,
128126
),
129127
subtitle: Text(
130128
_permissionStatus.toString(),
131129
style: TextStyle(color: getPermissionColor()),
132130
),
133-
trailing: (_permission is PermissionWithService)
131+
trailing: (widget.permission is PermissionWithService)
134132
? IconButton(
135133
icon: const Icon(Icons.info, color: Colors.white),
136134
onPressed: () {
137135
checkServiceStatus(
138136
context,
139-
_permission as PermissionWithService,
137+
widget.permission as PermissionWithService,
140138
);
141139
},
142140
)
143141
: null,
144142
onTap: () {
145-
requestPermission(_permission);
143+
requestPermission(widget.permission);
146144
},
147145
);
148146
}
@@ -160,9 +158,7 @@ class _PermissionState extends State<PermissionWidget> {
160158
final status = await permission.request();
161159

162160
setState(() {
163-
debugPrint(status.toString());
164161
_permissionStatus = status;
165-
debugPrint(_permissionStatus.toString());
166162
});
167163
}
168164
}

packages/permission_handler/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: permission_handler_tizen
22
description: Tizen implementation of the permission_handler plugin.
33
homepage: https://github.com/flutter-tizen/plugins
44
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/permission_handler
5-
version: 1.4.0
5+
version: 1.4.1
66

77
environment:
88
sdk: ">=3.1.0 <4.0.0"

0 commit comments

Comments
 (0)