Skip to content

Commit 94262a2

Browse files
committed
version conflicts resolved
1 parent 21e5df7 commit 94262a2

19 files changed

+434
-325
lines changed

android/app/build.gradle

+10-8
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

2828
android {
29-
compileSdkVersion 29
30-
29+
compileSdkVersion 34 // Updated compile SDK version
30+
namespace 'com.example.task_management'
3131
sourceSets {
3232
main.java.srcDirs += 'src/main/kotlin'
3333
}
@@ -37,18 +37,15 @@ android {
3737
}
3838

3939
defaultConfig {
40-
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4140
applicationId "com.example.task_management"
42-
minSdkVersion 16
43-
targetSdkVersion 29
41+
minSdkVersion flutter.minSdkVersion
42+
targetSdkVersion 33 // Updated target SDK version
4443
versionCode flutterVersionCode.toInteger()
4544
versionName flutterVersionName
4645
}
4746

4847
buildTypes {
4948
release {
50-
// TODO: Add your own signing config for the release build.
51-
// Signing with the debug keys for now, so `flutter run --release` works.
5249
signingConfig signingConfigs.debug
5350
}
5451
}
@@ -59,5 +56,10 @@ flutter {
5956
}
6057

6158
dependencies {
62-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
59+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version" // Updated to jdk8
60+
}
61+
62+
repositories {
63+
google()
64+
mavenCentral() // Use mavenCentral instead of jcenter
6365
}
+38-34
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,59 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.example.task_management">
3-
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
4-
calls FlutterMain.startInitialization(this); in its onCreate method.
5-
In most cases you can leave this as-is, but you if you want to provide
6-
additional functionality it is fine to subclass or reimplement
7-
FlutterApplication and put your custom class here. -->
8-
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
9-
<uses-permission android:name="android.permission.VIBRATE" />
3+
4+
<!-- Permissions -->
5+
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
6+
<uses-permission android:name="android.permission.VIBRATE"/>
7+
108
<application
11-
android:name="io.flutter.app.FlutterApplication"
9+
android:name="${applicationName}"
1210
android:label="task_management"
1311
android:icon="@mipmap/ic_launcher">
14-
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver">
15-
<intent-filter>
16-
<action android:name="android.intent.action.BOOT_COMPLETED"></action>
17-
</intent-filter>
18-
</receiver>
19-
<receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />
12+
13+
<!-- Receiver for Scheduled Notifications After Boot -->
14+
<receiver
15+
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver"
16+
android:exported="true">
17+
<intent-filter>
18+
<action android:name="android.intent.action.BOOT_COMPLETED"/>
19+
</intent-filter>
20+
</receiver>
21+
22+
<!-- Receiver for Scheduled Notifications -->
23+
<receiver
24+
android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver"
25+
android:exported="true"/>
26+
27+
<!-- Main Activity -->
2028
<activity
2129
android:name=".MainActivity"
2230
android:launchMode="singleTop"
31+
android:exported="true"
2332
android:theme="@style/LaunchTheme"
2433
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
2534
android:hardwareAccelerated="true"
2635
android:windowSoftInputMode="adjustResize">
27-
<!-- Specifies an Android theme to apply to this Activity as soon as
28-
the Android process has started. This theme is visible to the user
29-
while the Flutter UI initializes. After that, this theme continues
30-
to determine the Window background behind the Flutter UI. -->
36+
37+
<!-- Normal Theme Metadata -->
38+
<meta-data
39+
android:name="io.flutter.embedding.android.NormalTheme"
40+
android:resource="@style/NormalTheme"/>
41+
42+
<!-- Splash Screen Metadata -->
3143
<meta-data
32-
android:name="io.flutter.embedding.android.NormalTheme"
33-
android:resource="@style/NormalTheme"
34-
/>
35-
<!-- Displays an Android View that continues showing the launch screen
36-
Drawable until Flutter paints its first frame, then this splash
37-
screen fades out. A splash screen is useful to avoid any visual
38-
gap between the end of Android's launch screen and the painting of
39-
Flutter's first frame. -->
44+
android:name="io.flutter.embedding.android.SplashScreenDrawable"
45+
android:resource="@drawable/launch_background"/>
46+
47+
<!-- Flutter Embedding Version -->
4048
<meta-data
41-
android:name="io.flutter.embedding.android.SplashScreenDrawable"
42-
android:resource="@drawable/launch_background"
43-
/>
49+
android:name="flutterEmbedding"
50+
android:value="2"/>
51+
52+
<!-- Intent Filter for Main Activity -->
4453
<intent-filter>
4554
<action android:name="android.intent.action.MAIN"/>
4655
<category android:name="android.intent.category.LAUNCHER"/>
4756
</intent-filter>
4857
</activity>
49-
<!-- Don't delete the meta-data below.
50-
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
51-
<meta-data
52-
android:name="flutterEmbedding"
53-
android:value="2" />
5458
</application>
5559
</manifest>

android/build.gradle

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
buildscript {
2-
ext.kotlin_version = '1.3.50'
2+
ext.kotlin_version = '1.7.10'
33
repositories {
44
google()
5-
jcenter()
5+
mavenCentral()
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.5.0'
9+
classpath 'com.android.tools.build:gradle:7.3.1'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}
1313

1414
allprojects {
1515
repositories {
1616
google()
17-
jcenter()
17+
mavenCentral()
1818
}
1919
}
2020

@@ -26,6 +26,6 @@ subprojects {
2626
project.evaluationDependsOn(':app')
2727
}
2828

29-
task clean(type: Delete) {
29+
tasks.register("clean", Delete) {
3030
delete rootProject.buildDir
3131
}

android/gradle.properties

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ org.gradle.jvmargs=-Xmx1536M
22
android.useAndroidX=true
33
android.enableJetifier=true
44
android.enableR8=true
5+
# org.gradle.java.home=C:\Program Files\Java\jdk-17

android/gradle/wrapper/gradle-wrapper.properties

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ 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-5.6.2-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
7+

lib/controllers/task_controller.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ class TaskController extends GetxController {
1111
super.onReady();
1212
}
1313

14-
final taskList = List<Task>().obs;
14+
final RxList<Task> taskList = new RxList<Task>();
1515

1616
// add data to table
17-
Future<void> addTask({Task task}) async {
17+
Future<int> addTask(Task task) async {
1818
return await DBHelper.insert(task);
1919
}
2020

lib/db/db_helper.dart

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import 'package:sqflite/sqflite.dart';
22
import 'package:task_management/models/task.dart';
33

44
class DBHelper {
5-
static Database _db;
5+
static Database? _db;
66
static final int _version = 1;
77
static final String _tableName = 'tasks';
88

@@ -28,20 +28,20 @@ class DBHelper {
2828

2929
static Future<int> insert(Task task) async {
3030
print("insert function called");
31-
return await _db.insert(_tableName, task.toJson());
31+
return await _db!.insert(_tableName, task.toJson());
3232
}
3333

3434
static Future<int> delete(Task task) async =>
35-
await _db.delete(_tableName, where: 'id = ?', whereArgs: [task.id]);
35+
await _db!.delete(_tableName, where: 'id = ?', whereArgs: [task.id]);
3636

3737
static Future<List<Map<String, dynamic>>> query() async {
3838
print("query function called");
39-
return _db.query(_tableName);
39+
return _db!.query(_tableName);
4040
}
4141

4242
static Future<int> update(int id) async {
4343
print("update function called");
44-
return await _db.rawUpdate('''
44+
return await _db!.rawUpdate('''
4545
UPDATE tasks
4646
SET isCompleted = ?
4747
WHERE id = ?

lib/main.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class MyApp extends StatelessWidget {
1818
Widget build(BuildContext context) {
1919
return GetMaterialApp(
2020
debugShowCheckedModeBanner: false,
21-
theme: Themes.light,
21+
// theme: Themes.light,
2222
darkTheme: Themes.dark,
2323
themeMode: ThemeService().theme,
2424
home: HomePage(),

lib/models/task.dart

+32-33
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
class Task {
2-
int id;
2+
int? id;
33
String title;
44
String note;
55
int isCompleted;
@@ -12,42 +12,41 @@ class Task {
1212

1313
Task({
1414
this.id,
15-
this.title,
16-
this.note,
17-
this.isCompleted,
18-
this.date,
19-
this.startTime,
20-
this.endTime,
21-
this.color,
22-
this.remind,
23-
this.repeat,
15+
required this.title,
16+
required this.note,
17+
required this.isCompleted,
18+
required this.date,
19+
required this.startTime,
20+
required this.endTime,
21+
required this.color,
22+
required this.remind,
23+
required this.repeat,
2424
});
2525

26-
Task.fromJson(Map<String, dynamic> json) {
27-
id = json['id'];
28-
title = json['title'];
29-
note = json['note'];
30-
isCompleted = json['isCompleted'];
31-
date = json['date'];
32-
startTime = json['startTime'];
33-
endTime = json['endTime'];
34-
color = json['color'];
35-
remind = json['remind'];
36-
repeat = json['repeat'];
37-
}
26+
Task.fromJson(Map<String, dynamic> json)
27+
: id = json['id'] ?? "",
28+
title = json['title'],
29+
note = json['note'],
30+
isCompleted = json['isCompleted'],
31+
date = json['date'],
32+
startTime = json['startTime'],
33+
endTime = json['endTime'],
34+
color = json['color'],
35+
remind = json['remind'],
36+
repeat = json['repeat'];
3837

3938
Map<String, dynamic> toJson() {
40-
final Map<String, dynamic> data = new Map<String, dynamic>();
41-
data['id'] = this.id;
42-
data['title'] = this.title;
43-
data['date'] = this.date;
44-
data['note'] = this.note;
45-
data['isCompleted'] = this.isCompleted;
46-
data['startTime'] = this.startTime;
47-
data['endTime'] = this.endTime;
48-
data['color'] = this.color;
49-
data['remind'] = this.remind;
50-
data['repeat'] = this.repeat;
39+
final Map<String, dynamic> data = <String, dynamic>{};
40+
data['id'] = id;
41+
data['title'] = title;
42+
data['note'] = note;
43+
data['isCompleted'] = isCompleted;
44+
data['date'] = date;
45+
data['startTime'] = startTime;
46+
data['endTime'] = endTime;
47+
data['color'] = color;
48+
data['remind'] = remind;
49+
data['repeat'] = repeat;
5150
return data;
5251
}
5352
}

lib/services/notification_services.dart

+10-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import 'package:flutter/cupertino.dart';
2-
import 'package:flutter/material.dart';
31
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
4-
import 'package:timezone/data/latest.dart' as tz;
5-
import 'package:timezone/timezone.dart' as tz;
62

73
class NotifyHelper {
84
FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
@@ -23,8 +19,10 @@ class NotifyHelper {
2319
// iOS: initializationSettingsIOS,
2420
// macOS: initializationSettingsMacOS
2521
);
26-
await flutterLocalNotificationsPlugin.initialize(initializationSettings,
27-
onSelectNotification: selectNotification);
22+
await flutterLocalNotificationsPlugin.initialize(
23+
initializationSettings,
24+
// onSelectNotification: selectNotification
25+
);
2826
}
2927

3028
// Future<void> _configureLocalTimeZone() async {
@@ -72,10 +70,9 @@ class NotifyHelper {
7270
// );
7371
// }
7472

75-
displayNotification({@required String title, @required String body}) async {
73+
displayNotification({required String title, required String body}) async {
7674
const AndroidNotificationDetails androidPlatformChannelSpecifics =
77-
AndroidNotificationDetails(
78-
'your channel id', 'your channel name', 'your channel description',
75+
AndroidNotificationDetails('your channel id', 'your channel name',
7976
importance: Importance.max,
8077
priority: Priority.high,
8178
showWhen: false);
@@ -101,8 +98,10 @@ class NotifyHelper {
10198

10299
periodicalyNotification() async {
103100
const AndroidNotificationDetails androidPlatformChannelSpecifics =
104-
AndroidNotificationDetails('repeating channel id',
105-
'repeating channel name', 'repeating description');
101+
AndroidNotificationDetails(
102+
'repeating channel id',
103+
'repeating channel name',
104+
);
106105
const NotificationDetails platformChannelSpecifics =
107106
NotificationDetails(android: androidPlatformChannelSpecifics);
108107
await flutterLocalNotificationsPlugin.periodicallyShow(0, 'repeating title',

0 commit comments

Comments
 (0)