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

fix: resolve flutter static analysis issues (beta) #852

Merged
merged 18 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
eadcbef
fix: resolve flutter static analysis issues (beta)
srieteja May 27, 2024
54615a6
chore: dependency overrides added to showcaseview until the packages …
CurtlyCritchlow May 28, 2024
454712d
chore: showcaseview dependency_override removed
CurtlyCritchlow May 30, 2024
88f0287
Merge branch 'trunk' into static_analysis_beta_fixes
srieteja Jun 3, 2024
1a6a01b
fix: update implementation to replace now removed BuilderWidget in sh…
srieteja Jun 3, 2024
0f33822
Merge remote-tracking branch 'origin/static_analysis_beta_fixes' into…
srieteja Jun 3, 2024
7aeeb7b
chore: showcaseview updated to 3.0.0
CurtlyCritchlow Jun 3, 2024
046f1df
fix: [android] set android:exported="true" for required apps
srieteja Jun 5, 2024
559f750
Merge branch 'trunk' into static_analysis_beta_fixes
srieteja Jun 5, 2024
f15ba42
fix: [android] upgrade all example app compileSdkVersion/targetSdkVer…
srieteja Jun 5, 2024
4f1c917
build[deps]: upgrade at_backupkey_flutter version to 4.0.14(ready to …
srieteja Jun 5, 2024
e851d73
Merge remote-tracking branch 'origin/static_analysis_beta_fixes' into…
srieteja Jun 5, 2024
ea7614c
fix: more analyzer warnings
srieteja Jun 5, 2024
5a2a02f
chore: cached_network_image version number increased to latest.
CurtlyCritchlow Jun 5, 2024
bdce08c
chore: flutter_slidable updated to 3.1.0
CurtlyCritchlow Jun 5, 2024
499c69b
fix: set android:exported to true and fix some analyzer warnings
srieteja Jun 6, 2024
6be04c8
build[deps]: optimize dependencies for some example apps
srieteja Jun 6, 2024
6f27a46
Merge remote-tracking branch 'origin/static_analysis_beta_fixes' into…
srieteja Jun 6, 2024
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
3 changes: 3 additions & 0 deletions packages/at_backupkey_flutter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 4.0.14
- **FIX**: Replace deprecated/removed elements in Flutter 3.22.* with up-to-date alternatives
- **CHORE**: Bumped up dependency versions.
## 4.0.13:
- **CHORE**: Bumped up dependency versions
- **CHORE**: Improved pub score
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 33

compileSdkVersion 34
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
Expand All @@ -40,7 +39,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.atsign.at_backupkey_flutter_example"
minSdkVersion 23
targetSdkVersion flutter.targetSdkVersion
compileSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
5 changes: 2 additions & 3 deletions packages/at_backupkey_flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:at_client_mobile/at_client_mobile.dart';
import 'package:at_onboarding_flutter/at_onboarding_flutter.dart'
show AtOnboardingConfig, AtOnboardingResultStatus, BackupKeyWidget;

// import 'package:at_utils/at_logger.dart' show AtSignLogger;
import 'package:path_provider/path_provider.dart'
show getApplicationSupportDirectory;
import 'package:at_app_flutter/at_app_flutter.dart' show AtEnv;
Expand Down Expand Up @@ -54,7 +53,7 @@ class _MyAppState extends State<MyApp> {
primaryColor: const Color(0xFFf4533d),
colorScheme: ThemeData.light().colorScheme.copyWith(
primary: const Color(0xFFf4533d),
background: Colors.white,
surface: Colors.white,
),
scaffoldBackgroundColor: Colors.white,
),
Expand All @@ -63,7 +62,7 @@ class _MyAppState extends State<MyApp> {
primaryColor: Colors.blue,
colorScheme: ThemeData.dark().colorScheme.copyWith(
primary: Colors.blue,
background: Colors.grey[850],
surface: Colors.grey[850],
),
scaffoldBackgroundColor: Colors.grey[850],
),
Expand Down
20 changes: 10 additions & 10 deletions packages/at_backupkey_flutter/lib/widgets/backup_key_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ import 'dart:io';
import 'dart:typed_data';

import 'package:at_backupkey_flutter/services/backupkey_service.dart';
import 'package:at_backupkey_flutter/utils/size_config.dart';
import 'package:at_backupkey_flutter/utils/strings.dart';
import 'package:at_file_saver/at_file_saver.dart';
import 'package:at_utils/at_logger.dart';
import 'package:file_selector/file_selector.dart';
import 'package:flutter/material.dart';
import 'package:at_backupkey_flutter/utils/size_config.dart';
import 'package:path_provider/path_provider.dart' as path_provider;
import 'package:path_provider/path_provider.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:path_provider/path_provider.dart' as path_provider;
import 'package:share_plus/share_plus.dart';
import 'package:at_utils/at_logger.dart';
import 'package:at_file_saver/at_file_saver.dart';
import 'package:file_selector/file_selector.dart';
import 'package:showcaseview/showcaseview.dart';

class BackupKeyWidget extends StatelessWidget {
Expand Down Expand Up @@ -101,7 +101,7 @@ class BackupKeyWidget extends StatelessWidget {
showDialog(
context: context,
barrierDismissible: false,
builder: (_) {
builder: (context1) {
return AlertDialog(
title: Row(
children: [
Expand All @@ -114,14 +114,14 @@ class BackupKeyWidget extends StatelessWidget {
],
),
content: Text(
'Couldn\'t able to backup the key file',
'Could not backup the key file',
style:
TextStyle(fontWeight: FontWeight.bold, fontSize: 14.toFont),
),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.pop(_);
Navigator.pop(context1);
},
child: const Text('Close'),
)
Expand All @@ -137,7 +137,7 @@ class BackupKeyWidget extends StatelessWidget {
showDialog(
context: context,
builder: (BuildContext ctxt) {
return ShowCaseWidget(builder: Builder(builder: (context) {
return ShowCaseWidget(builder: (context) {
myContext = context;
return Dialog(
child: Container(
Expand Down Expand Up @@ -237,7 +237,7 @@ class BackupKeyWidget extends StatelessWidget {
),
),
);
}));
});
});
}

Expand Down
6 changes: 3 additions & 3 deletions packages/at_backupkey_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: at_backupkey_flutter
description: A Flutter plugin project for saving the backup key of any atSign that is being onboarded with atPlatform apps. The backup key can be used to authenticate in other atPlatform apps.
version: 4.0.13
version: 4.0.14
homepage: https://docs.atsign.com/
repository: https://github.com/atsign-foundation/at_widgets/tree/trunk/packages/at_backupkey_flutter
issue_tracker: https://github.com/atsign-foundation/at_widgets/issues
Expand All @@ -19,7 +19,7 @@ dependencies:
at_file_saver: ^0.1.2
at_utils: ^3.0.15
at_client_mobile: ^3.2.12
showcaseview: ^2.0.3
showcaseview: ^3.0.0
device_info_plus: ^9.0.3
# desktop - dependencies
file_selector: ^1.0.1
Expand All @@ -30,7 +30,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.1
flutter_lints: ^4.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down
4 changes: 2 additions & 2 deletions packages/at_chat_flutter/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"


android {
compileSdkVersion 33
compileSdkVersion 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -46,7 +46,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.at_chat_flutter_example"
minSdkVersion 23
targetSdkVersion 30
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
Expand Down
4 changes: 2 additions & 2 deletions packages/at_chat_flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class _MyAppState extends State<MyApp> {
setState(() {
atClientPreference = preference;
});
if (mounted) {
if (context.mounted) {
final result = await AtOnboarding.onboard(
context: context,
config: AtOnboardingConfig(
Expand Down Expand Up @@ -127,7 +127,7 @@ class _MyAppState extends State<MyApp> {
child: TextButton(
style: ButtonStyle(
backgroundColor:
MaterialStateProperty.all<Color>(Colors.black12),
WidgetStateProperty.all<Color>(Colors.black12),
),
onPressed: () {
FlutterKeychain.remove(key: '@atsign');
Expand Down
2 changes: 1 addition & 1 deletion packages/at_chat_flutter/example/lib/second_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ class _SecondScreenState extends State<SecondScreen> {
const SizedBox(height: 10),
TextButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(Colors.black),
backgroundColor: WidgetStateProperty.all<Color>(Colors.black),
),
onPressed: () {
setGroupToChatWith(context);
Expand Down
2 changes: 1 addition & 1 deletion packages/at_chat_flutter/example/lib/third_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class _ThirdScreenState extends State<ThirdScreen> {

var result = await deleteMessages();
var message = result ? 'Messages are deleted' : 'Failed to delete';
if (mounted) {
if (context.mounted) {
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(content: Text(message)));
}
Expand Down
4 changes: 2 additions & 2 deletions packages/at_chat_flutter/lib/screens/chat_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@ class _ChatScreenState extends State<ChatScreen> {
(id) async {
var result = await _chatService
.deleteSelectedMessage(id);
if (mounted) {
if (context.mounted) {
Navigator.of(context).pop();
}

var message = result
? 'Message is deleted'
: 'Failed to delete';
if (mounted) {
if (context.mounted) {
ScaffoldMessenger.of(context)
.showSnackBar(SnackBar(
content:
Expand Down
5 changes: 0 additions & 5 deletions packages/at_chat_flutter/lib/services/chat_service.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
/// A service to handle save and retrieve operation on chat
import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'dart:typed_data';

import 'package:at_chat_flutter/models/message_model.dart';

// ignore: import_of_legacy_library_into_null_safe
import 'package:at_client_mobile/at_client_mobile.dart';

// ignore: import_of_legacy_library_into_null_safe
import 'package:flutter/material.dart';

/// Service to manage the chat messages for different atsigns
Expand Down
2 changes: 1 addition & 1 deletion packages/at_chat_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies:
sdk: flutter

dev_dependencies:
flutter_lints: ^2.0.3
flutter_lints: ^4.0.0
flutter_test:
sdk: flutter
mocktail: ^0.3.0
Expand Down
5 changes: 2 additions & 3 deletions packages/at_common_flutter/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 32

compileSdkVersion 34
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand All @@ -45,7 +44,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.at_common_flutter_example"
minSdkVersion 23
targetSdkVersion 30
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:exported="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
Expand Down
2 changes: 1 addition & 1 deletion packages/at_common_flutter/example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 33
compileSdkVersion 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand Down
53 changes: 30 additions & 23 deletions packages/at_contacts_flutter/example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:async';
import 'package:at_contacts_flutter_example/second_screen.dart';
import 'package:at_onboarding_flutter/at_onboarding_result.dart';
import 'package:flutter/material.dart';
import 'package:at_client_mobile/at_client_mobile.dart';
import 'package:at_onboarding_flutter/at_onboarding_flutter.dart'
Expand Down Expand Up @@ -33,10 +34,10 @@ class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);

@override
_MyAppState createState() => _MyAppState();
MyAppState createState() => MyAppState();
}

class _MyAppState extends State<MyApp> {
class MyAppState extends State<MyApp> {
// * load the AtClientPreference in the background
Future<AtClientPreference> futurePreference = loadAtClientPreference();
AtClientPreference? atClientPreference;
Expand All @@ -55,7 +56,7 @@ class _MyAppState extends State<MyApp> {
primaryColor: const Color(0xFFf4533d),
colorScheme: ThemeData.light().colorScheme.copyWith(
primary: const Color(0xFFf4533d),
background: Colors.white,
surface: Colors.white,
),
scaffoldBackgroundColor: Colors.white,
),
Expand All @@ -64,7 +65,7 @@ class _MyAppState extends State<MyApp> {
primaryColor: Colors.blue,
colorScheme: ThemeData.dark().colorScheme.copyWith(
primary: Colors.blue,
background: Colors.grey[850],
surface: Colors.grey[850],
),
scaffoldBackgroundColor: Colors.grey[850],
),
Expand Down Expand Up @@ -98,22 +99,26 @@ class _MyAppState extends State<MyApp> {
setState(() {
atClientPreference = preference;
});
final result = await AtOnboarding.onboard(
context: context,
config: AtOnboardingConfig(
atClientPreference: atClientPreference!,
domain: AtEnv.rootDomain,
rootEnvironment: AtEnv.rootEnvironment,
appAPIKey: AtEnv.appApiKey,
),
);
switch (result.status) {
AtOnboardingResult? result;
if (context.mounted) {
result = await AtOnboarding.onboard(
context: context,
config: AtOnboardingConfig(
atClientPreference: atClientPreference!,
domain: AtEnv.rootDomain,
rootEnvironment: AtEnv.rootEnvironment,
appAPIKey: AtEnv.appApiKey,
),
);
}
switch (result?.status) {
case AtOnboardingResultStatus.success:
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => const SecondScreen()));
break;
case null:
case AtOnboardingResultStatus.error:
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
Expand All @@ -133,15 +138,17 @@ class _MyAppState extends State<MyApp> {
onPressed: () async {
var preference = await futurePreference;
atClientPreference = preference;
AtOnboarding.reset(
context: context,
config: AtOnboardingConfig(
atClientPreference: atClientPreference!,
domain: AtEnv.rootDomain,
rootEnvironment: AtEnv.rootEnvironment,
appAPIKey: AtEnv.appApiKey,
),
);
if(context.mounted) {
AtOnboarding.reset(
context: context,
config: AtOnboardingConfig(
atClientPreference: atClientPreference!,
domain: AtEnv.rootDomain,
rootEnvironment: AtEnv.rootEnvironment,
appAPIKey: AtEnv.appApiKey,
),
);
}
},
child: const Text('Reset'),
),
Expand Down
Loading