Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class DetailRouteController extends GetxController {
super.onInit();
var arguments = Get.arguments;
uuid = arguments[1] as String;
// uuid = Get.arguments['uuid'];
var storageWidget = Get.find<HomeController>();
modify = Modify(
getTask: storageWidget.getTask,
Expand Down Expand Up @@ -192,7 +191,8 @@ class DetailRouteController extends GetxController {
const Duration(milliseconds: 500),
() {
SaveTourStatus.getDetailsTourStatus().then((value) => {
if (!value) {tutorialCoachMark.show(context: context)}
if (!value && context.mounted)
{tutorialCoachMark.show(context: context)}
});
},
);
Expand Down
66 changes: 7 additions & 59 deletions lib/app/modules/detailRoute/views/dateTimePicker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ class DateTimeWidget extends StatelessWidget {
text: value ??
SentenceManager(
currentLanguage: AppSettings.selectedLanguage)
.sentences.notSelected,
.sentences
.notSelected,
// style: GoogleFonts.poppins(
// fontSize: TaskWarriorFonts.fontSizeMedium,
// color: AppSettings.isDarkMode
Expand All @@ -89,61 +90,6 @@ class DateTimeWidget extends StatelessWidget {
],
),
),
// onTap: () async {
// var initialDate = DateFormat("E, M/d/y h:mm:ss a").parse(
// value?.replaceAll(RegExp(r'\s+'), ' ') ??
// DateFormat("E, M/d/y h:mm:ss a").format(DateTime.now()));

// var date = await showDatePicker(
// context: context,
// initialDate: initialDate,
// firstDate: DateTime
// .now(), // sets the earliest selectable date to the current date. This prevents the user from selecting a date in the past.
// lastDate: DateTime(2037, 12, 31), // < 2038-01-19T03:14:08.000Z
// );
// if (date != null) {
// var time = await showTimePicker(
// context: context,
// initialTime: TimeOfDay.now(),
// );
// if (time != null) {
// var dateTime = date.add(
// Duration(
// hours: time.hour,
// minutes: time.minute,
// ),
// );
// dateTime = dateTime.add(
// Duration(
// hours: time.hour - dateTime.hour,
// ),
// );
// // Check if the selected time is in the past
// if (dateTime.isBefore(DateTime.now())) {
// // Show a message that past times can't be set
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(
// content: Text(
// "Can't set times in the past",
// style: TextStyle(
// color: AppSettings.isDarkMode
// ? TaskWarriorColors.kprimaryTextColor
// : TaskWarriorColors.kLightPrimaryTextColor,
// ),
// ),
// backgroundColor: AppSettings.isDarkMode
// ? TaskWarriorColors.ksecondaryBackgroundColor
// : TaskWarriorColors.kLightSecondaryBackgroundColor,
// duration: const Duration(seconds: 2),
// ),
// );
// } else {
// // If the time is not in the past, proceed as usual
// return callback(dateTime.toUtc());
// }
// }
// }
// },
onTap: () async {
var parsedDate = DateFormat("E, M/d/y h:mm:ss a").parse(
value?.replaceAll(RegExp(r'\s+'), ' ') ??
Expand Down Expand Up @@ -250,9 +196,11 @@ class StartWidget extends StatelessWidget {
),
),
TextSpan(
text: value ?? SentenceManager(
currentLanguage: AppSettings.selectedLanguage)
.sentences.notSelected,
text: value ??
SentenceManager(
currentLanguage: AppSettings.selectedLanguage)
.sentences
.notSelected,
// style: GoogleFonts.poppins(
// fontSize: TaskWarriorFonts.fontSizeMedium,
// color: AppSettings.isDarkMode
Expand Down
2 changes: 0 additions & 2 deletions lib/app/modules/detailRoute/views/detail_route_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ class DetailRouteView extends GetView<DetailRouteController> {
if (!controller.onEdit.value) {
debugPrint(
'DetailRouteView: No edits made, navigating back without prompt.');
// Get.offAll(() => const HomeView());
Navigator.of(context).pop();
// Get.toNamed(Routes.HOME);
return false;
}
debugPrint(
Expand Down
12 changes: 8 additions & 4 deletions lib/app/modules/detailRoute/views/status_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:taskwarrior/app/utils/constants/constants.dart';
import 'package:taskwarrior/app/utils/themes/theme_extension.dart';
import 'package:taskwarrior/app/utils/language/sentence_manager.dart';


class StatusWidget extends StatelessWidget {
const StatusWidget(
{required this.name,
Expand All @@ -22,7 +21,8 @@ class StatusWidget extends StatelessWidget {

@override
Widget build(BuildContext context) {
TaskwarriorColorTheme tColors = Theme.of(context).extension<TaskwarriorColorTheme>()!;
TaskwarriorColorTheme tColors =
Theme.of(context).extension<TaskwarriorColorTheme>()!;
return Card(
color: tColors.secondaryBackgroundColor,
child: ListTile(
Expand All @@ -43,7 +43,11 @@ class StatusWidget extends StatelessWidget {
),
),
TextSpan(
text: value ?? SentenceManager(currentLanguage: AppSettings.selectedLanguage).sentences.notSelected,
text: value ??
SentenceManager(
currentLanguage: AppSettings.selectedLanguage)
.sentences
.notSelected,
style: GoogleFonts.poppins(
fontSize: TaskWarriorFonts.fontSizeMedium,
color: tColors.primaryTextColor,
Expand All @@ -57,7 +61,7 @@ class StatusWidget extends StatelessWidget {
),
onTap: () {
if (kDebugMode) {
print(value);
debugPrint(value);
}
switch (value) {
case 'pending':
Expand Down
2 changes: 0 additions & 2 deletions lib/app/modules/detailRoute/views/tags_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ class TagsRouteState extends State<TagsRoute> {
actions: [
TextButton(
onPressed: () {
// Navigator.of(context).pop();
Get.back();
},
child: Text(
Expand All @@ -266,7 +265,6 @@ class TagsRouteState extends State<TagsRoute> {
try {
validateTaskTags(controller.text);
_addTag(controller.text);
// Navigator.of(context).pop();
Get.back();
} on FormatException catch (e, trace) {
logError(e, trace);
Expand Down
59 changes: 5 additions & 54 deletions lib/app/modules/home/controllers/home_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:home_widget/home_widget.dart';
import 'package:loggy/loggy.dart';
import 'package:path_provider/path_provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:taskwarrior/app/models/filters.dart';

Expand All @@ -17,9 +16,7 @@ import 'package:taskwarrior/app/models/storage.dart';
import 'package:taskwarrior/app/models/storage/client.dart';
import 'package:taskwarrior/app/models/tag_meta_data.dart';
import 'package:taskwarrior/app/modules/home/controllers/widget.controller.dart';
import 'package:taskwarrior/app/modules/home/views/add_task_bottom_sheet_new.dart';
import 'package:taskwarrior/app/modules/splash/controllers/splash_controller.dart';
import 'package:taskwarrior/app/routes/app_pages.dart';
import 'package:taskwarrior/app/services/deep_link_service.dart';
import 'package:taskwarrior/app/services/tag_filter.dart';
import 'package:taskwarrior/app/tour/filter_drawer_tour.dart';
Expand All @@ -39,7 +36,6 @@ import 'package:taskwarrior/app/v3/db/task_database.dart';
import 'package:taskwarrior/app/v3/db/update.dart';
import 'package:taskwarrior/app/v3/models/task.dart';
import 'package:taskwarrior/app/v3/net/fetch.dart';
import 'package:taskwarrior/rust_bridge/api.dart';
import 'package:textfield_tags/textfield_tags.dart';
import 'package:taskwarrior/app/utils/themes/theme_extension.dart';
import 'package:tutorial_coach_mark/tutorial_coach_mark.dart';
Expand Down Expand Up @@ -632,7 +628,8 @@ class HomeController extends GetxController {
}

void changeInDirectory() {
print("directory change to ${splashController.baseDirectory.value.path}");
debugPrint(
"directory change to ${splashController.baseDirectory.value.path}");
storage = Storage(
Directory(
'${splashController.baseDirectory.value.path}/profiles/${splashController.currentProfile.value}',
Expand All @@ -658,7 +655,6 @@ class HomeController extends GetxController {
HomeWidget.updateWidget(
androidName: "TaskWarriorWidgetProvider",
iOSName: "TaskWarriorWidgets");
// print("called and value is${isDarkModeOn.value}");
}

final addKey = GlobalKey();
Expand Down Expand Up @@ -745,7 +741,7 @@ class HomeController extends GetxController {
else
{
// ignore: avoid_print
print('User has seen this page'),
debugPrint('User has seen this page'),
}
});
},
Expand All @@ -769,8 +765,8 @@ class HomeController extends GetxController {

void showTaskSwipeTutorial(BuildContext context) {
SaveTourStatus.getTaskSwipeTutorialStatus().then((value) {
print("value is $value");
print("tasks is ${tasks.isNotEmpty}");
debugPrint("value is $value");
debugPrint("tasks is ${tasks.isNotEmpty}");
if (value == false) {
initTaskSwipeTutorial();
tutorialCoachMark.show(context: context);
Expand All @@ -782,49 +778,4 @@ class HomeController extends GetxController {

late RxString uuid = "".obs;
late RxBool isHomeWidgetTaskTapped = false.obs;

// void handleHomeWidgetClicked() async {
// Uri? uri = await HomeWidget.initiallyLaunchedFromHomeWidget();
// if (uri != null) {
// if (uri.host == "cardclicked") {
// if (uri.queryParameters["uuid"] != null &&
// !taskchampion.value &&
// !taskReplica.value) {
// uuid.value = uri.queryParameters["uuid"] as String;
// isHomeWidgetTaskTapped.value = true;
// Future.delayed(Duration.zero, () {
// Get.toNamed(Routes.DETAIL_ROUTE, arguments: ["uuid", uuid.value]);
// });
// }
// } else if (uri.host == "addclicked") {
// showAddDialogAfterWidgetClick();
// }
// }
// HomeWidget.widgetClicked.listen((uri) async {
// if (uri != null) {
// if (uri.host == "cardclicked") {
// if (uri.queryParameters["uuid"] != null &&
// !taskchampion.value &&
// !taskReplica.value) {
// uuid.value = uri.queryParameters["uuid"] as String;
// isHomeWidgetTaskTapped.value = true;

// debugPrint('uuid is $uuid');
// Get.toNamed(Routes.DETAIL_ROUTE, arguments: ["uuid", uuid.value]);
// }
// } else if (uri.host == "addclicked") {
// showAddDialogAfterWidgetClick();
// }
// }
// });
// }

// void showAddDialogAfterWidgetClick() {
// Widget showDialog = Material(
// child: AddTaskBottomSheet(
// homeController: this,
// forTaskC: taskchampion.value,
// forReplica: taskReplica.value));
// Get.dialog(showDialog);
// }
}
3 changes: 0 additions & 3 deletions lib/app/modules/home/controllers/widget.controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import 'package:taskwarrior/app/models/storage.dart';
import 'package:taskwarrior/app/modules/home/controllers/home_controller.dart';
import 'package:taskwarrior/app/modules/splash/controllers/splash_controller.dart';
import 'package:taskwarrior/app/utils/taskfunctions/urgency.dart';
// import 'package:taskwarrior/widgets/taskfunctions/datetime_differences.dart';

class WidgetController extends GetxController {
final HomeController storageWidget = Get.find<HomeController>();
Expand All @@ -27,8 +26,6 @@ class WidgetController extends GetxController {

void fetchAllData() async {
if (Platform.isAndroid || Platform.isIOS) {
// storageWidget = StorageWidget.of(context!); // Use Get.context from GetX
// var currentProfile = ProfilesWidget.of(context!).currentProfile;
var currentProfile = Get.find<SplashController>().currentProfile.value;
baseDirectory = Get.find<SplashController>().baseDirectory();
storage =
Expand Down
8 changes: 6 additions & 2 deletions lib/app/modules/home/views/add_task_bottom_sheet_new.dart
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ class AddTaskBottomSheet extends StatelessWidget {
homeController.due.value = null;
homeController.priority.value = 'M';
homeController.projectcontroller.text = '';
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(
SentenceManager(
Expand Down Expand Up @@ -396,7 +397,7 @@ class AddTaskBottomSheet extends StatelessWidget {
}

homeController.update();

if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(
SentenceManager(
Expand All @@ -420,7 +421,7 @@ class AddTaskBottomSheet extends StatelessWidget {
// late InheritedStorage storageWidget;
// storageWidget = StorageWidget.of(context);
var storageWidget = Get.find<HomeController>();
if (value) {
if (value && context.mounted) {
storageWidget.synchronize(context, true);
}
if (Platform.isAndroid || Platform.isIOS) {
Expand All @@ -430,6 +431,7 @@ class AddTaskBottomSheet extends StatelessWidget {
widgetController.update();
}
} on FormatException catch (e) {
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(
e.message,
Expand Down Expand Up @@ -475,6 +477,7 @@ class AddTaskBottomSheet extends StatelessWidget {
}

homeController.update();
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(
SentenceManager(
Expand Down Expand Up @@ -503,6 +506,7 @@ class AddTaskBottomSheet extends StatelessWidget {
}
await storageWidget.refreshReplicaTaskList();
} on FormatException catch (e) {
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text(
e.message,
Expand Down
22 changes: 4 additions & 18 deletions lib/app/modules/home/views/home_page_floating_action_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,11 @@ class HomePageFloatingActionButton extends StatelessWidget {
forReplica: controller.taskReplica.value,
),
).then((value) {
if (controller.isSyncNeeded.value && value != "cancel") {
if (controller.isSyncNeeded.value &&
value != "cancel" &&
context.mounted) {
controller.isNeededtoSyncOnStart(context);
}
}))

// .then((value) {
// // print(value);

// //if auto sync is turned on
// if (isSyncNeeded) {
// //if user have not created any event then
// //we won't call sync method
// if (value == "cancel") {
// } else {
// //else we can sync new tasks
// isNeededtoSyncOnStart();
// }
// }
// }),
);
})));
}
}
3 changes: 1 addition & 2 deletions lib/app/modules/home/views/tasks_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ class TasksBuilder extends StatelessWidget {

@override
Widget build(BuildContext context) {
// print(taskData);
TaskwarriorColorTheme tColors =
Theme.of(context).extension<TaskwarriorColorTheme>()!;
var storageWidget = Get.find<HomeController>();
Expand Down Expand Up @@ -220,7 +219,7 @@ class TasksBuilder extends StatelessWidget {
dtb!.add(const Duration(minutes: 1));
cancelNotification(task);
}
if (Platform.isAndroid||Platform.isIOS) {
if (Platform.isAndroid || Platform.isIOS) {
WidgetController widgetController =
Get.put(WidgetController());
widgetController.fetchAllData();
Expand Down
Loading