Skip to content

Commit

Permalink
Fix dart analysis issues
Browse files Browse the repository at this point in the history
  • Loading branch information
agordn52 committed Jan 1, 2024
1 parent 0d7e20e commit 5489415
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/Users/anthony/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.0.0/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/anthony/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/anthony/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.3.4/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"flutter_secure_storage","path":"/Users/anthony/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.0.0/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/Users/anthony/.pub-cache/hosted/pub.dev/path_provider_android-2.2.1/","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"/Users/anthony/.pub-cache/hosted/pub.dev/shared_preferences_android-2.2.1/","native_build":true,"dependencies":[]}],"macos":[{"name":"flutter_secure_storage_macos","path":"/Users/anthony/.pub-cache/hosted/pub.dev/flutter_secure_storage_macos-3.0.1/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/anthony/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/anthony/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.3.4/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"flutter_secure_storage_linux","path":"/Users/anthony/.pub-cache/hosted/pub.dev/flutter_secure_storage_linux-1.2.0/","native_build":true,"dependencies":[]},{"name":"path_provider_linux","path":"/Users/anthony/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/anthony/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.3.2/","native_build":false,"dependencies":["path_provider_linux"]}],"windows":[{"name":"flutter_secure_storage_windows","path":"/Users/anthony/.pub-cache/hosted/pub.dev/flutter_secure_storage_windows-3.0.0/","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"/Users/anthony/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/anthony/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.3.2/","native_build":false,"dependencies":["path_provider_windows"]}],"web":[{"name":"flutter_secure_storage_web","path":"/Users/anthony/.pub-cache/hosted/pub.dev/flutter_secure_storage_web-1.1.2/","dependencies":[]},{"name":"shared_preferences_web","path":"/Users/anthony/.pub-cache/hosted/pub.dev/shared_preferences_web-2.2.1/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":["flutter_secure_storage_linux","flutter_secure_storage_macos","flutter_secure_storage_web","flutter_secure_storage_windows"]},{"name":"flutter_secure_storage_linux","dependencies":[]},{"name":"flutter_secure_storage_macos","dependencies":[]},{"name":"flutter_secure_storage_web","dependencies":[]},{"name":"flutter_secure_storage_windows","dependencies":["path_provider"]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2024-01-01 22:20:54.951924","version":"3.16.5"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/Users/anthony/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.0.0/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/anthony/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/anthony/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.3.4/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"flutter_secure_storage","path":"/Users/anthony/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.0.0/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/Users/anthony/.pub-cache/hosted/pub.dev/path_provider_android-2.2.1/","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"/Users/anthony/.pub-cache/hosted/pub.dev/shared_preferences_android-2.2.1/","native_build":true,"dependencies":[]}],"macos":[{"name":"flutter_secure_storage_macos","path":"/Users/anthony/.pub-cache/hosted/pub.dev/flutter_secure_storage_macos-3.0.1/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/anthony/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.1/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/anthony/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.3.4/","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"flutter_secure_storage_linux","path":"/Users/anthony/.pub-cache/hosted/pub.dev/flutter_secure_storage_linux-1.2.0/","native_build":true,"dependencies":[]},{"name":"path_provider_linux","path":"/Users/anthony/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/anthony/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.3.2/","native_build":false,"dependencies":["path_provider_linux"]}],"windows":[{"name":"flutter_secure_storage_windows","path":"/Users/anthony/.pub-cache/hosted/pub.dev/flutter_secure_storage_windows-3.0.0/","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"/Users/anthony/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/anthony/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.3.2/","native_build":false,"dependencies":["path_provider_windows"]}],"web":[{"name":"flutter_secure_storage_web","path":"/Users/anthony/.pub-cache/hosted/pub.dev/flutter_secure_storage_web-1.1.2/","dependencies":[]},{"name":"shared_preferences_web","path":"/Users/anthony/.pub-cache/hosted/pub.dev/shared_preferences_web-2.2.1/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":["flutter_secure_storage_linux","flutter_secure_storage_macos","flutter_secure_storage_web","flutter_secure_storage_windows"]},{"name":"flutter_secure_storage_linux","dependencies":[]},{"name":"flutter_secure_storage_macos","dependencies":[]},{"name":"flutter_secure_storage_web","dependencies":[]},{"name":"flutter_secure_storage_windows","dependencies":["path_provider"]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2024-01-01 22:38:39.981001","version":"3.16.5"}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Update license date
* Update pubspec.yaml
* Add GitHub actions
* Fix dart analysis issues

## [1.1.1] - 2023-12-10

Expand Down
45 changes: 22 additions & 23 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:nylo_support/helpers/extensions.dart';
import 'package:permission_policy/permission_policy.dart';

void main() {
Expand All @@ -11,7 +10,7 @@ void main() {
};
PermissionPolicy.instance.addRoles(roleAndPermissions);

runApp(MyApp());
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
Expand Down Expand Up @@ -43,23 +42,23 @@ class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Permission Policy")),
appBar: AppBar(title: const Text("Permission Policy")),
body: SafeArea(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 8),
padding: const EdgeInsets.symmetric(horizontal: 8),
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
ListView(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
children: [
Text("Your role").fontWeightBold(),
physics: const NeverScrollableScrollPhysics(),
children: const [
Text("Your role"),
UserRoles(), // This widget will show the users current role

Text("Your Permissions").fontWeightBold(),
Text("Your Permissions"),
UserPermissions(), // This widget will show the users current permissions
],
),
Expand All @@ -69,7 +68,7 @@ class _MyHomePageState extends State<MyHomePage> {
border: Border.all(color: Colors.black12, width: 2)),
child: Column(
children: [
Padding(
const Padding(
padding: EdgeInsets.symmetric(vertical: 16),
child: Text("Select a role"),
),
Expand All @@ -82,23 +81,23 @@ class _MyHomePageState extends State<MyHomePage> {
),
),
),
RoleView(
const RoleView(
roles: ['user', 'subscriber'],
child: Text("The user and subscriber UI"),
),
PermissionView(
child: Text("You can subscribe"),
permissions: ['can_subscribe']),
PermissionView(
child: Text("You can unsubscribe"),
permissions: ['can_unsubscribe']),
PermissionView(
child: Text("You can view Content 🚀"),
permissions: ['view_content']),
PermissionView(
child: Text("You can view exclusive Content 🎩"),
permissions: ['view_exclusive_content']),
Divider(),
const PermissionView(
permissions: ['can_subscribe'],
child: Text("You can subscribe")),
const PermissionView(
permissions: ['can_unsubscribe'],
child: Text("You can unsubscribe")),
const PermissionView(
permissions: ['view_content'],
child: Text("You can view Content 🚀")),
const PermissionView(
permissions: ['view_exclusive_content'],
child: Text("You can view exclusive Content 🎩")),
const Divider(),
...PermissionPolicy.instance.assignableRoles().map((role) {
return MaterialButton(
onPressed: () async {
Expand Down
18 changes: 17 additions & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "5.1.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7
url: "https://pub.dev"
source: hosted
version: "3.0.1"
flutter_localizations:
dependency: transitive
description: flutter
Expand Down Expand Up @@ -197,6 +205,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.6.7"
lints:
dependency: transitive
description:
name: lints
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
url: "https://pub.dev"
source: hosted
version: "3.0.0"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -294,7 +310,7 @@ packages:
source: hosted
version: "2.2.0"
permission_policy:
dependency: "direct dev"
dependency: "direct main"
description:
path: ".."
relative: true
Expand Down
6 changes: 3 additions & 3 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ environment:
sdk: '>=2.19.0 <3.0.0'

dependencies:
permission_policy:
path: ../
flutter:
sdk: flutter

dev_dependencies:
flutter_test:
sdk: flutter

permission_policy:
path: ../
flutter_lints: ^3.0.1

flutter:

Expand Down
6 changes: 4 additions & 2 deletions lib/widgets/permission_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import 'package:permission_policy/permission_policy.dart';
/// ```
class PermissionView extends StatelessWidget {
const PermissionView(
{Key? key, required this.child, required this.permissions, this.loading})
: super(key: key);
{super.key,
required this.child,
required this.permissions,
this.loading});

final List<String> permissions;
final Widget? loading;
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/role_selector_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:permission_policy/permission_policy.dart';
/// RoleSelector is a widget that shows a list of roles that can be assigned to
/// a user.
class RoleSelector extends StatelessWidget {
const RoleSelector({Key? key, this.onUpdate, this.builder}) : super(key: key);
const RoleSelector({super.key, this.onUpdate, this.builder});

final Widget Function(String data)? builder;
final Function()? onUpdate;
Expand Down
5 changes: 2 additions & 3 deletions lib/widgets/role_view_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ import 'package:permission_policy/permission_policy.dart';
/// ```
class RoleView extends StatelessWidget {
const RoleView(
{Key? key,
{super.key,
required this.roles,
required this.child,
this.defaultView,
this.loading})
: super(key: key);
this.loading});

final Widget? loading, defaultView;
final List<String> roles;
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/user_permissions_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import 'package:permission_policy/permission_policy.dart';

/// UserPermissions is a widget that shows the permissions for the current user.
class UserPermissions extends StatefulWidget {
const UserPermissions({Key? key}) : super(key: key);
const UserPermissions({super.key});

static String state = "user_permissions";

@override
_UserPermissionsState createState() => _UserPermissionsState();
createState() => _UserPermissionsState();
}

class _UserPermissionsState extends NyState<UserPermissions> {
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/user_roles_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import 'package:permission_policy/permission_policy.dart';

/// UserRole is a widget that shows the role for the current user.
class UserRoles extends StatefulWidget {
const UserRoles({Key? key}) : super(key: key);
const UserRoles({super.key});

static String state = "user_roles";

@override
_UserRolesState createState() => _UserRolesState();
createState() => _UserRolesState();
}

class _UserRolesState extends NyState<UserRoles> {
Expand Down

0 comments on commit 5489415

Please sign in to comment.