Skip to content

Commit 5428c8c

Browse files
committed
refactor: update widget constructors to use 'super.key' syntax and improve code structure
1 parent 6fa736f commit 5428c8c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+860
-477
lines changed

Diff for: .metadata

+17-17
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled.
4+
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: f1875d570e39de09040c8f79aa13cc56baab8db1
8-
channel: stable
7+
revision: "17025dd88227cd9532c33fa78f5250d548d87e9a"
8+
channel: "stable"
99

1010
project_type: app
1111

1212
# Tracks metadata for the flutter migrate command
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
17-
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
16+
create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
17+
base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
1818
- platform: android
19-
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
20-
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
19+
create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
20+
base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
2121
- platform: ios
22-
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
23-
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
22+
create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
23+
base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
2424
- platform: linux
25-
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
26-
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
25+
create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
26+
base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
2727
- platform: macos
28-
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
29-
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
28+
create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
29+
base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
3030
- platform: web
31-
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
32-
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
31+
create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
32+
base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
3333
- platform: windows
34-
create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
35-
base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
34+
create_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
35+
base_revision: 17025dd88227cd9532c33fa78f5250d548d87e9a
3636

3737
# User provided section
3838

Diff for: .vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"java.configuration.updateBuildConfiguration": "automatic"
2+
"java.configuration.updateBuildConfiguration": "automatic",
3+
"cmake.ignoreCMakeListsMissing": true
34
}

Diff for: android/app/build.gradle

+8-11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
}
6+
17
def localProperties = new Properties()
28
def localPropertiesFile = rootProject.file('local.properties')
39
if (localPropertiesFile.exists()) {
@@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
612
}
713
}
814

9-
def flutterRoot = localProperties.getProperty('flutter.sdk')
10-
if (flutterRoot == null) {
11-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12-
}
13-
1415
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1516
if (flutterVersionCode == null) {
1617
flutterVersionCode = '1'
@@ -24,14 +25,11 @@ if (flutterVersionName == null) {
2425

2526

2627
apply plugin : 'com.google.gms.google-services'
27-
apply plugin: 'com.android.application'
28-
apply plugin: 'kotlin-android'
29-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
3028

3129

3230

3331
android {
34-
compileSdkVersion 33
32+
compileSdkVersion 34
3533
ndkVersion flutter.ndkVersion
3634

3735
compileOptions {
@@ -44,7 +42,7 @@ android {
4442
applicationId "com.nitin.mynotes"
4543
// You can update the following values to match your application needs.
4644
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
47-
minSdkVersion 28
45+
minSdkVersion 21
4846
targetSdkVersion flutter.targetSdkVersion
4947
versionCode flutterVersionCode.toInteger()
5048
versionName flutterVersionName
@@ -64,7 +62,6 @@ flutter {
6462
}
6563

6664
dependencies {
67-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
6865
implementation platform('com.google.firebase:firebase-bom:30.4.1')
6966
implementation("com.squareup.okhttp3:okhttp:4.9.3")
7067
implementation 'com.google.firebase:firebase-analytics'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.nitin.mynotes
2+
3+
import io.flutter.embedding.android.FlutterActivity
4+
5+
class MainActivity: FlutterActivity()

Diff for: android/app/src/main/res/mipmap-hdpi/ic_launcher.png

544 Bytes
Loading

Diff for: android/app/src/main/res/mipmap-mdpi/ic_launcher.png

442 Bytes
Loading
721 Bytes
Loading
1.01 KB
Loading
1.41 KB
Loading

Diff for: android/app/src/main/res/values-night/styles.xml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
4+
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
5+
<!-- Show a splash screen on the activity. Automatically removed when
6+
the Flutter engine draws its first frame -->
7+
<item name="android:windowBackground">@drawable/launch_background</item>
8+
</style>
9+
<!-- Theme applied to the Android Window as soon as the process has started.
10+
This theme determines the color of the Android Window while your
11+
Flutter UI initializes, as well as behind your Flutter UI while its
12+
running.
13+
14+
This Theme is only used starting with V2 of Flutter's Android embedding. -->
15+
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
16+
<item name="android:windowBackground">?android:colorBackground</item>
17+
</style>
18+
</resources>

Diff for: android/build.gradle

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
1-
buildscript {
2-
ext.kotlin_version = '1.6.10'
3-
repositories {
4-
google()
5-
mavenCentral()
6-
}
7-
8-
dependencies {
9-
classpath 'com.android.tools.build:gradle:7.1.2'
10-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11-
classpath 'com.google.gms:google-services:4.3.13'
12-
}
1+
dependencies {
2+
classpath "com.android.tools.build:gradle:8.1.2"
3+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
134
}
145

6+
157
allprojects {
168
repositories {
179
google()
@@ -29,4 +21,4 @@ subprojects {
2921

3022
tasks.register("clean", Delete) {
3123
delete rootProject.buildDir
32-
}
24+
}

Diff for: android/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
org.gradle.jvmargs=-Xmx1536M
22
android.useAndroidX=true
3-
android.enableJetifier=true
3+
android.enableJetifier=true

Diff for: android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-all.zip

Diff for: android/settings.gradle

+13-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
include ':app'
1+
pluginManagement {
2+
repositories {
3+
gradlePluginPortal()
4+
google()
5+
mavenCentral()
6+
}
7+
plugins {
8+
id "com.android.application" version "8.1.2" apply false
9+
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
10+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
11+
}
12+
}
213

3-
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4-
def properties = new Properties()
5-
6-
assert localPropertiesFile.exists()
7-
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8-
9-
def flutterSdkPath = properties.getProperty("flutter.sdk")
10-
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11-
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
14+
include ":app"

Diff for: ios/RunnerTests/RunnerTests.swift

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import Flutter
2+
import UIKit
3+
import XCTest
4+
5+
class RunnerTests: XCTestCase {
6+
7+
func testExample() {
8+
// If you add code to the Runner application, consider adding tests here.
9+
// See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10+
}
11+
12+
}

Diff for: lib/helper/loading/shimmer_loading.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import '/constants/colors.dart';
77

88
class SkeletonNotes extends StatelessWidget {
99
const SkeletonNotes({
10-
Key? key,
11-
}) : super(key: key);
10+
super.key,
11+
});
1212

1313
@override
1414
Widget build(BuildContext context) {
@@ -131,10 +131,10 @@ class ShimmerWidget extends StatelessWidget {
131131

132132
class Skeleton extends StatelessWidget {
133133
const Skeleton({
134-
Key? key,
134+
super.key,
135135
required this.height,
136136
required this.width,
137-
}) : super(key: key);
137+
});
138138

139139
final double? height, width;
140140
@override

Diff for: lib/main.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void main() {
3737
}
3838

3939
class HomePage extends StatelessWidget {
40-
const HomePage({Key? key}) : super(key: key);
40+
const HomePage({super.key});
4141

4242
@override
4343
Widget build(BuildContext context) {

Diff for: lib/services/auth/bloc/auth_state.dart

+13-16
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ abstract class AuthState {
1414
}
1515

1616
class AuthStateUnitialized extends AuthState {
17-
const AuthStateUnitialized({required bool isLoading})
18-
: super(isLoading: isLoading);
17+
const AuthStateUnitialized({required super.isLoading});
1918
}
2019

2120
class AuthStateRegistering extends AuthState {
2221
final Exception? exception;
22+
// ignore: use_super_parameters
2323
const AuthStateRegistering({
2424
required this.exception,
2525
required isLoading,
@@ -32,40 +32,37 @@ class AuthStateForgotPassword extends AuthState {
3232
const AuthStateForgotPassword({
3333
required this.exception,
3434
required this.hasSentEmail,
35-
required bool isLoading,
36-
}) : super(isLoading: isLoading);
35+
required super.isLoading,
36+
});
3737
}
3838

3939
class AuthStateLoggedIn extends AuthState {
4040
final AuthUser user;
4141
const AuthStateLoggedIn({
4242
required this.user,
43-
required bool isLoading,
44-
}) : super(isLoading: isLoading);
43+
required super.isLoading,
44+
});
4545
}
4646

4747
class AuthStateLoggedInWithGmail extends AuthState {
4848
const AuthStateLoggedInWithGmail({
49-
required bool isLoading,
50-
}) : super(isLoading: isLoading);
49+
required super.isLoading,
50+
});
5151
}
5252

5353
class AuthStateNeedsVerification extends AuthState {
5454
const AuthStateNeedsVerification({
55-
required bool isLoading,
56-
}) : super(isLoading: isLoading);
55+
required super.isLoading,
56+
});
5757
}
5858

5959
class AuthStateLoggedOut extends AuthState with EquatableMixin {
6060
final Exception? exception;
6161
const AuthStateLoggedOut({
6262
required this.exception,
63-
required bool isLoading,
64-
String? loadingText,
65-
}) : super(
66-
isLoading: isLoading,
67-
loadingText: loadingText,
68-
);
63+
required super.isLoading,
64+
super.loadingText = null,
65+
});
6966

7067
@override
7168
List<Object?> get props => [exception, isLoading];

Diff for: lib/views/forgot_password_view.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import '/utilities/dialogs/error_dialog.dart';
1212
import '/utilities/dialogs/password_reset.dart';
1313

1414
class ForgotPasswordView extends StatefulWidget {
15-
const ForgotPasswordView({Key? key}) : super(key: key);
15+
const ForgotPasswordView({super.key});
1616

1717
@override
1818
State<ForgotPasswordView> createState() => _ForgotPasswordViewState();
@@ -43,7 +43,6 @@ class _ForgotPasswordViewState extends State<ForgotPasswordView> {
4343
await showPasswordResetSentDialog(context);
4444
}
4545
if (state.exception != null) {
46-
if (!mounted) return;
4746
await showErrorDialog(
4847
context,
4948
context.loc.forgot_password_view_generic_error,

Diff for: lib/views/home/home.dart

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import '/constants/colors.dart';
88
import '/constants/routes.dart';
99
import '/services/auth/bloc/auth_event.dart';
1010
import '/utilities/internet_snak_bar.dart';
11-
import '/views/login_view.dart';
1211
import '/widget/slider.dart';
1312
import '/services/auth/bloc/auth_bloc.dart';
1413

@@ -32,13 +31,14 @@ class _NewNotesViewState extends State<NewNotesView> {
3231
borderRadius: BorderRadius.circular(30),
3332
),
3433
onPressed: () async {
35-
final result = await Connectivity().checkConnectivity();
3634
if (!mounted) return;
37-
bool hasInternet = connectivitySnackBar(result);
38-
39-
hasInternet
40-
? Navigator.of(context).pushNamed(createOrUpdateNoteRoute)
41-
: InternetSnackBar.showTopSnackBar(context);
35+
var connectivityResult = await (Connectivity().checkConnectivity());
36+
if (connectivityResult == ConnectivityResult.none) {
37+
InternetSnackBar.showTopSnackBar(context);
38+
return;
39+
} else {
40+
Navigator.pushNamed(context, createOrUpdateNoteRoute);
41+
}
4242
},
4343
child: Icon(
4444
Icons.add,

0 commit comments

Comments
 (0)