Skip to content

Commit cb8ced2

Browse files
authored
Merge pull request #287 from afjal1/main
Added macOS Support
2 parents 27540c0 + cbcc94a commit cb8ced2

39 files changed

+1762
-103
lines changed

.metadata

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,27 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: 097d3313d8e2c7f901932d63e537c1acefb87800
8-
channel: stable
7+
revision: "78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9"
8+
channel: "stable"
99

1010
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
17+
base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
18+
- platform: macos
19+
create_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
20+
base_revision: 78666c8dc57e9f7548ca9f8dd0740fbf0c658dc9
21+
22+
# User provided section
23+
24+
# List of Local paths (relative to this file) that should be
25+
# ignored by the migrate tool.
26+
#
27+
# Files that are not part of the templates will be ignored by default.
28+
unmanaged_files:
29+
- 'lib/main.dart'
30+
- 'ios/Runner.xcodeproj/project.pbxproj'

lib/controller/WidgetController.dart

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -31,39 +31,41 @@ class WidgetController extends GetxController {
3131
bool stopTraver = false;
3232

3333
void fetchAllData() async {
34-
storageWidget = StorageWidget.of(context!); // Use Get.context from GetX
35-
var currentProfile = ProfilesWidget.of(context!).currentProfile;
36-
37-
baseDirectory = await getApplicationDocumentsDirectory();
38-
storage =
39-
Storage(Directory('${baseDirectory!.path}/profiles/$currentProfile'));
40-
41-
allData.assignAll(storage.data.allData());
42-
43-
if (allData.isNotEmpty) {
44-
List<Task> temp = [];
45-
for (int i = 0; i < allData.length; i++) {
46-
if (allData[i].status == "pending") {
47-
if (temp.length < 3) {
48-
temp.add(allData[i]);
49-
} else {
50-
break;
34+
if (Platform.isAndroid || Platform.isIOS) {
35+
storageWidget = StorageWidget.of(context!); // Use Get.context from GetX
36+
var currentProfile = ProfilesWidget.of(context!).currentProfile;
37+
38+
baseDirectory = await getApplicationDocumentsDirectory();
39+
storage =
40+
Storage(Directory('${baseDirectory!.path}/profiles/$currentProfile'));
41+
42+
allData.assignAll(storage.data.allData());
43+
44+
if (allData.isNotEmpty) {
45+
List<Task> temp = [];
46+
for (int i = 0; i < allData.length; i++) {
47+
if (allData[i].status == "pending") {
48+
if (temp.length < 3) {
49+
temp.add(allData[i]);
50+
} else {
51+
break;
52+
}
5153
}
5254
}
53-
}
5455

55-
allData.assignAll(temp);
56-
// allData = allData.reversed.toList().obs;
57-
_sendAndUpdate();
56+
allData.assignAll(temp);
57+
// allData = allData.reversed.toList().obs;
58+
sendAndUpdate();
59+
}
5860
}
5961
}
6062

61-
Future<void> _sendAndUpdate() async {
62-
await _sendData();
63-
await _updateWidget();
63+
Future<void> sendAndUpdate() async {
64+
await sendData();
65+
await updateWidget();
6466
}
6567

66-
Future<void> _sendData() async {
68+
Future<void> sendData() async {
6769
try {
6870
for (int i = 0; i < allData.length && i < 3; i++) {
6971
String subtitle = 'No Pending Task';
@@ -98,7 +100,7 @@ class WidgetController extends GetxController {
98100
}
99101
}
100102

101-
Future _updateWidget() async {
103+
Future updateWidget() async {
102104
try {
103105
return HomeWidget.updateWidget(
104106
name: 'TaskWarriorWidgetProvider', iOSName: 'HomeWidgetExample');

lib/drawer/filter_drawer.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ class _FilterDrawerState extends State<FilterDrawer> {
123123
border: Border.all(color: Colors.grey.shade300),
124124
),
125125
child: ListTile(
126+
contentPadding: EdgeInsets.only(
127+
left: 8,
128+
),
126129
title: RichText(
127130
key: statusKey,
128131
maxLines: 2,

lib/services/notification_services.dart

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,17 @@ class NotificationService {
1919
requestCriticalPermission: true,
2020
requestSoundPermission: true);
2121

22+
DarwinInitializationSettings macSettings = const DarwinInitializationSettings(
23+
requestAlertPermission: true,
24+
requestBadgePermission: true,
25+
requestCriticalPermission: true,
26+
requestSoundPermission: true);
2227
void initiliazeNotification() async {
2328
InitializationSettings initializationSettings = InitializationSettings(
24-
android: _androidInitializationSettings, iOS: iosSettings);
29+
android: _androidInitializationSettings,
30+
iOS: iosSettings,
31+
macOS: macSettings,
32+
);
2533

2634
await _flutterLocalNotificationsPlugin.initialize(initializationSettings);
2735
}
@@ -60,8 +68,26 @@ class NotificationService {
6068
importance: Importance.max,
6169
priority: Priority.max);
6270

63-
NotificationDetails notificationDetails =
64-
NotificationDetails(android: androidNotificationDetails);
71+
// iOS and macOS Notification Details
72+
DarwinNotificationDetails iOSNotificationDetails =
73+
const DarwinNotificationDetails(
74+
presentAlert: true,
75+
presentBadge: true,
76+
presentSound: true,
77+
);
78+
79+
DarwinNotificationDetails macOsNotificationDetails =
80+
const DarwinNotificationDetails(
81+
presentAlert: true,
82+
presentBadge: true,
83+
presentSound: true,
84+
);
85+
86+
NotificationDetails notificationDetails = NotificationDetails(
87+
android: androidNotificationDetails,
88+
iOS: iOSNotificationDetails,
89+
macOS: macOsNotificationDetails,
90+
);
6591

6692
// Generate a unique notification ID based on the scheduled time and task name
6793
int notificationId = calculateNotificationId(dtb, taskname, taskid);

lib/services/task_list_tem.dart

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,10 @@ class _TaskListItemState extends State<TaskListItem> {
7373
decoration: BoxDecoration(
7474
border: Border.all(
7575
color: (widget.task.due != null &&
76-
isDueWithinOneDay(widget.task.due!) && useDelayTask)
77-
? Colors.red // Set border color to red if due within 1 day and useDelayTask is true
76+
isDueWithinOneDay(widget.task.due!) &&
77+
useDelayTask)
78+
? Colors
79+
.red // Set border color to red if due within 1 day and useDelayTask is true
7880
: dimColor, // Set default border color
7981
),
8082
borderRadius: BorderRadius.circular(8.0),
@@ -91,13 +93,9 @@ class _TaskListItemState extends State<TaskListItem> {
9193
),
9294
const SizedBox(width: 8),
9395
SizedBox(
94-
width: MediaQuery
95-
.of(context)
96-
.size
97-
.width * 0.70,
96+
width: MediaQuery.of(context).size.width * 0.70,
9897
child: Text(
99-
'${(widget.task.id == 0) ? '#' : widget.task.id}. ${widget
100-
.task.description}',
98+
'${(widget.task.id == 0) ? '#' : widget.task.id}. ${widget.task.description}',
10199
maxLines: 1,
102100
overflow: TextOverflow.ellipsis,
103101
style: GoogleFonts.poppins(
@@ -124,14 +122,9 @@ class _TaskListItemState extends State<TaskListItem> {
124122
child: SingleChildScrollView(
125123
scrollDirection: Axis.horizontal,
126124
child: Text(
127-
'${widget.pendingFilter ? '' : '${widget.task.status[0]
128-
.toUpperCase()}\n'}'
129-
'Last Modified: ${(widget.task.modified != null) ? age(
130-
widget.task.modified!) : ((widget.task.start != null)
131-
? age(widget.task.start!)
132-
: '-')} | '
133-
'Due: ${(widget.task.due != null) ? when(
134-
widget.task.due!) : '-'}'
125+
'${widget.pendingFilter ? '' : '${widget.task.status[0].toUpperCase()}\n'}'
126+
'Last Modified: ${(widget.task.modified != null) ? age(widget.task.modified!) : ((widget.task.start != null) ? age(widget.task.start!) : '-')} | '
127+
'Due: ${(widget.task.due != null) ? when(widget.task.due!) : '-'}'
135128
.replaceFirst(RegExp(r' \[\]$'), '')
136129
.replaceAll(RegExp(r' +'), ' '),
137130
overflow: TextOverflow.ellipsis,
@@ -166,13 +159,9 @@ class _TaskListItemState extends State<TaskListItem> {
166159
),
167160
const SizedBox(width: 8),
168161
SizedBox(
169-
width: MediaQuery
170-
.of(context)
171-
.size
172-
.width * 0.65,
162+
width: MediaQuery.of(context).size.width * 0.65,
173163
child: Text(
174-
'${(widget.task.id == 0) ? '#' : widget.task.id}. ${widget
175-
.task.description}',
164+
'${(widget.task.id == 0) ? '#' : widget.task.id}. ${widget.task.description}',
176165
maxLines: 1,
177166
overflow: TextOverflow.ellipsis,
178167
style: GoogleFonts.poppins(
@@ -191,13 +180,8 @@ class _TaskListItemState extends State<TaskListItem> {
191180
child: SingleChildScrollView(
192181
scrollDirection: Axis.horizontal,
193182
child: Text(
194-
'Last Modified: ${(widget.task.modified != null) ? age(
195-
widget.task.modified!) : ((widget.task.start != null)
196-
? age(widget.task.start!)
197-
: '-')} | '
198-
'Due: ${(widget.task.due != null)
199-
? when(widget.task.due!)
200-
: '-'}'
183+
'Last Modified: ${(widget.task.modified != null) ? age(widget.task.modified!) : ((widget.task.start != null) ? age(widget.task.start!) : '-')} | '
184+
'Due: ${(widget.task.due != null) ? when(widget.task.due!) : '-'}'
201185
.replaceFirst(RegExp(r' \[\]$'), '')
202186
.replaceAll(RegExp(r' +'), ' '),
203187
overflow: TextOverflow.ellipsis,

lib/widgets/project_filter.dart

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class ProjectsColumn extends StatelessWidget {
5050
Padding(
5151
padding: const EdgeInsets.all(10.0),
5252
child: Row(
53-
mainAxisAlignment: MainAxisAlignment.center,
53+
mainAxisAlignment: MainAxisAlignment.start,
5454
crossAxisAlignment: CrossAxisAlignment.center,
5555
children: [
5656
Text(
@@ -63,7 +63,6 @@ class ProjectsColumn extends StatelessWidget {
6363
),
6464
),
6565
SizedBox(
66-
width: 40.w,
6766
child: SingleChildScrollView(
6867
scrollDirection: Axis.horizontal,
6968
child: Row(
@@ -145,7 +144,7 @@ class ProjectTile extends StatelessWidget {
145144
var callback = inheritedProjects.callback;
146145

147146
var title = Row(
148-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
147+
mainAxisAlignment: MainAxisAlignment.start,
149148
children: [
150149
Flexible(
151150
child: Text(project,
@@ -179,22 +178,19 @@ class ProjectTile extends StatelessWidget {
179178
? GestureDetector(
180179
onTap: () => callback(project),
181180
child: Row(
181+
mainAxisAlignment: MainAxisAlignment.start,
182182
children: [
183183
radio,
184-
SizedBox(
185-
width: 45.w,
186-
child: Text(project,
187-
maxLines: 3,
188-
style: GoogleFonts.poppins(
189-
color: AppSettings.isDarkMode
190-
? Colors.white
191-
: Colors.black)),
192-
),
193-
const SizedBox(
194-
width: 5,
195-
),
184+
Text(project,
185+
maxLines: 3,
186+
style: GoogleFonts.poppins(
187+
color: AppSettings.isDarkMode
188+
? Colors.white
189+
: Colors.black)),
190+
const Spacer(),
196191
Container(
197-
padding: const EdgeInsets.all(4),
192+
padding: const EdgeInsets.symmetric(horizontal: 4),
193+
margin: const EdgeInsets.only(right: 10),
198194
decoration: BoxDecoration(
199195
color: (AppSettings.isDarkMode
200196
? Colors.white

lib/widgets/taskfunctions/datetime_differences.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ String difference(Duration difference) {
2121
} else {
2222
result = '${difference.abs().inSeconds}s';
2323
}
24-
return '${(difference.isNegative) ? '-' : ''}$result';
24+
return '$result ${(difference.isNegative) ? 'ago ' : ''}';
2525
}

macos/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Flutter-related
2+
**/Flutter/ephemeral/
3+
**/Pods/
4+
5+
# Xcode-related
6+
**/dgph
7+
**/xcuserdata/
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2+
#include "ephemeral/Flutter-Generated.xcconfig"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2+
#include "ephemeral/Flutter-Generated.xcconfig"

0 commit comments

Comments
 (0)