Skip to content

Commit

Permalink
Merge branch 'master' into video_player_videhole/add_track_selections…
Browse files Browse the repository at this point in the history
…_function
  • Loading branch information
hyue7 authored Sep 4, 2023
2 parents 1ce735f + 6318eea commit de5742b
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 10 deletions.
4 changes: 3 additions & 1 deletion packages/flutter_secure_storage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## NEXT
## 0.1.1

* Update flutter_secure_storage to 9.0.0.
* Update example app.
* Increase the minimum Flutter version to 3.3.

## 0.1.0
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter_secure_storage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ This package is not an _endorsed_ implementation of `flutter_secure_storage`. Th

```yaml
dependencies:
flutter_secure_storage: ^6.0.0
flutter_secure_storage_tizen: ^0.1.0
flutter_secure_storage: ^9.0.0
flutter_secure_storage_tizen: ^0.1.1
```
Then you can import `flutter_secure_storage` in your Dart code:
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_secure_storage/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:lint/analysis_options_package.yaml
include: package:lint/package.yaml

linter:
# The lint rules applied to this project can be customized in the
Expand Down
54 changes: 51 additions & 3 deletions packages/flutter_secure_storage/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ItemsWidget extends StatefulWidget {

enum _Actions { deleteAll }

enum _ItemActions { delete, edit, containsKey }
enum _ItemActions { delete, edit, containsKey, read }

class ItemsWidgetState extends State<ItemsWidget> {
final _storage = const FlutterSecureStorage();
Expand Down Expand Up @@ -153,6 +153,13 @@ class ItemsWidgetState extends State<ItemsWidget> {
key: Key('contains_row_$index'),
),
),
PopupMenuItem(
value: _ItemActions.read,
child: Text(
'Read',
key: Key('contains_row_$index'),
),
),
],
),
title: Text(
Expand Down Expand Up @@ -202,17 +209,58 @@ class ItemsWidgetState extends State<ItemsWidget> {
}
break;
case _ItemActions.containsKey:
final result = await _storage.containsKey(key: item.key);
if (!context.mounted) return;
final key = await _displayTextInputDialog(context, item.key);
final result = await _storage.containsKey(key: key);
if (!mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Contains Key: $result, key checked: $key'),
backgroundColor: result ? Colors.green : Colors.red,
),
);
break;
case _ItemActions.read:
if (!context.mounted) return;
final key = await _displayTextInputDialog(context, item.key);
final result =
await _storage.read(key: key, aOptions: _getAndroidOptions());
if (!mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Contains Key: $result'),
content: Text('value: $result'),
),
);
break;
}
}

Future<String> _displayTextInputDialog(
BuildContext context,
String key,
) async {
final controller = TextEditingController();
controller.text = key;
await showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text('Check if key exists'),
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('OK'),
),
],
content: TextField(
controller: controller,
),
);
},
);
return controller.text;
}

String _randomValue() {
final rand = Random();
final codeUnits = List.generate(20, (index) {
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_secure_storage/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ environment:
dependencies:
flutter:
sdk: flutter
flutter_secure_storage: ^6.0.0
flutter_secure_storage: ^9.0.0
flutter_secure_storage_tizen:
path: ../

Expand Down
4 changes: 2 additions & 2 deletions packages/flutter_secure_storage/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: flutter_secure_storage_tizen
description: Tizen implementation of the flutter_secure_storage plugin.
homepage: https://github.com/flutter-tizen/plugins
repository: https://github.com/flutter-tizen/plugins/tree/master/packages/flutter_secure_storage
version: 0.1.0
version: 0.1.1

environment:
sdk: ">=2.18.0 <4.0.0"
Expand All @@ -18,7 +18,7 @@ flutter:
dependencies:
flutter:
sdk: flutter
flutter_secure_storage_platform_interface: ^1.0.0
flutter_secure_storage_platform_interface: ^1.0.1

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit de5742b

Please sign in to comment.