Skip to content

Commit

Permalink
Addition to fixing Due Date Error & Enhancing the Task Widget
Browse files Browse the repository at this point in the history
  • Loading branch information
tank0nf committed Jan 19, 2025
1 parent 9bdc6f6 commit 1edf40e
Show file tree
Hide file tree
Showing 5 changed files with 366 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class DetailRouteController extends GetxController {
void setAttribute(String name, dynamic newValue) {
modify.set(name, newValue);
onEdit.value = true;
if(name == 'start'){
if (name == 'start') {
debugPrint('Start Value Changed to $newValue');
startValue.value = newValue;
}
Expand Down Expand Up @@ -101,9 +101,12 @@ class DetailRouteController extends GetxController {

final GlobalKey dueKey = GlobalKey();
final GlobalKey untilKey = GlobalKey();

final GlobalKey waitKey = GlobalKey();
final GlobalKey priorityKey = GlobalKey();
final GlobalKey modifiedKey = GlobalKey();
final GlobalKey startKey = GlobalKey();
final GlobalKey endKey = GlobalKey();
final GlobalKey entryKey = GlobalKey();

void initDetailsPageTour() {
tutorialCoachMark = TutorialCoachMark(
Expand Down
218 changes: 127 additions & 91 deletions lib/app/modules/detailRoute/views/detail_route_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:taskwarrior/app/modules/detailRoute/views/description_widget.dar
import 'package:taskwarrior/app/modules/detailRoute/views/priority_widget.dart';
import 'package:taskwarrior/app/modules/detailRoute/views/status_widget.dart';
import 'package:taskwarrior/app/modules/detailRoute/views/tags_widget.dart';
import 'package:taskwarrior/app/modules/detailRoute/views/urgency_widget.dart';
import 'package:taskwarrior/app/utils/constants/constants.dart';
import 'package:taskwarrior/app/utils/gen/fonts.gen.dart';
import 'package:taskwarrior/app/utils/language/sentence_manager.dart';
Expand Down Expand Up @@ -118,19 +119,19 @@ class DetailRouteView extends GetView<DetailRouteController> {
const EdgeInsets.symmetric(vertical: 4, horizontal: 2),
children: [
for (var entry in {
'description': controller.descriptionValue.value,
'status': controller.statusValue.value,
'entry': controller.entryValue.value,
'modified': controller.modifiedValue.value,
'start': controller.startValue.value,
'end': controller.endValue.value,
'due': controller.dueValue.value,
'wait': controller.waitValue.value,
'until': controller.untilValue.value,
'priority': controller.priorityValue?.value,
'project': controller.projectValue?.value,
'tags': controller.tagsValue?.value,
'urgency': controller.urgencyValue.value,
'Task Name': controller.descriptionValue.value,
'Status': controller.statusValue.value,
'Due Date': controller.dueValue.value,
'Priority': controller.priorityValue?.value,
'Urgency': controller.urgencyValue.value,
'Tags': controller.tagsValue?.value,
'Project': controller.projectValue?.value,
'Entry': controller.entryValue.value,
'Modified': controller.modifiedValue.value,
'Start': controller.startValue.value,
'End': controller.endValue.value,
'Wait': controller.waitValue.value,
'Until': controller.untilValue.value,
}.entries)
AttributeWidget(
name: entry.key,
Expand All @@ -140,6 +141,9 @@ class DetailRouteView extends GetView<DetailRouteController> {
waitKey: controller.waitKey,
dueKey: controller.dueKey,
untilKey: controller.untilKey,
modifiedKey: controller.modifiedKey,
endKey: controller.endKey,
entryKey: controller.entryKey,
priorityKey: controller.priorityKey,
),
],
Expand Down Expand Up @@ -233,6 +237,9 @@ class AttributeWidget extends StatelessWidget {
required this.callback,
required this.waitKey,
required this.dueKey,
required this.entryKey,
required this.modifiedKey,
required this.endKey,
required this.priorityKey,
required this.untilKey,
super.key,
Expand All @@ -243,6 +250,9 @@ class AttributeWidget extends StatelessWidget {
final void Function(dynamic) callback;
final GlobalKey waitKey;
final GlobalKey dueKey;
final GlobalKey entryKey;
final GlobalKey modifiedKey;
final GlobalKey endKey;
final GlobalKey untilKey;
final GlobalKey priorityKey;

Expand All @@ -253,59 +263,85 @@ class AttributeWidget extends StatelessWidget {
: ((value is BuiltList) ? (value).toBuilder() : value);

switch (name) {
case 'description':
case 'Task Name':
return DescriptionWidget(
name: name,
value: localValue,
callback: callback,
);
case 'status':
case 'Urgency':
return UrgencyWidget(
name: name,
value: localValue,
callback: callback,
);
case 'Status':
return StatusWidget(
name: name,
value: localValue,
callback: callback,
);
case 'start':
case 'Start':
return StartWidget(
name: name,
value: localValue,
callback: callback,
);
case 'End':
return StartWidget(
name: name,
value: localValue,
callback: callback,
);
case 'due':
case 'Modified':
return DateTimeWidget(
name: name,
value: localValue,
callback: callback,
globalKey: modifiedKey,
);
case 'Entry':
return DateTimeWidget(
name: name,
value: localValue,
callback: callback,
globalKey: entryKey,
);
case 'Due Date':
return DateTimeWidget(
name: name,
value: localValue,
callback: callback,
globalKey: dueKey,
);
case 'wait':
case 'Wait':
return DateTimeWidget(
name: name,
value: localValue,
callback: callback,
globalKey: waitKey,
);
case 'until':
case 'Until':
return DateTimeWidget(
name: name,
value: localValue,
callback: callback,
globalKey: untilKey,
);
case 'priority':
case 'Priority':
return PriorityWidget(
name: name,
value: localValue,
callback: callback,
globalKey: priorityKey,
);
case 'project':
case 'Project':
return ProjectWidget(
name: name,
value: localValue,
callback: callback,
);
case 'tags':
case 'Tags':
return TagsWidget(
name: name,
value: localValue,
Expand Down Expand Up @@ -349,73 +385,73 @@ class AttributeWidget extends StatelessWidget {
}
}

class TagsWidget extends StatelessWidget {
const TagsWidget({
required this.name,
required this.value,
required this.callback,
super.key,
});
// class TagsWidget extends StatelessWidget {
// const TagsWidget({
// required this.name,
// required this.value,
// required this.callback,
// super.key,
// });

final String name;
final dynamic value;
final void Function(dynamic) callback;
@override
Widget build(BuildContext context) {
return Card(
color: AppSettings.isDarkMode
? TaskWarriorColors.ksecondaryBackgroundColor
: TaskWarriorColors.kLightSecondaryBackgroundColor,
child: ListTile(
textColor: AppSettings.isDarkMode
? TaskWarriorColors.kprimaryTextColor
: TaskWarriorColors.ksecondaryTextColor,
title: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
RichText(
text: TextSpan(
children: <TextSpan>[
TextSpan(
text: '$name:'.padRight(13),
style: TextStyle(
fontFamily: FontFamily.poppins,
fontSize: TaskWarriorFonts.fontSizeMedium,
color: AppSettings.isDarkMode
? TaskWarriorColors.white
: TaskWarriorColors.black,
)
// style: GoogleFonts.poppins(
// fontWeight: TaskWarriorFonts.bold,
// fontSize: TaskWarriorFonts.fontSizeMedium,
// color: AppSettings.isDarkMode
// ? TaskWarriorColors.white
// : TaskWarriorColors.black,
// ),
),
TextSpan(
text:
'${(value as ListBuilder?)?.build() ?? 'not selected'}',
style: TextStyle(
color: AppSettings.isDarkMode
? TaskWarriorColors.white
: TaskWarriorColors.black,
),
),
],
),
),
],
),
),
onTap: () => Get.to(
TagsRoute(
value: value,
callback: callback,
),
),
),
);
}
}
// final String name;
// final dynamic value;
// final void Function(dynamic) callback;
// @override
// Widget build(BuildContext context) {
// return Card(
// color: AppSettings.isDarkMode
// ? TaskWarriorColors.ksecondaryBackgroundColor
// : TaskWarriorColors.kLightSecondaryBackgroundColor,
// child: ListTile(
// textColor: AppSettings.isDarkMode
// ? TaskWarriorColors.kprimaryTextColor
// : TaskWarriorColors.ksecondaryTextColor,
// title: SingleChildScrollView(
// scrollDirection: Axis.horizontal,
// child: Row(
// children: [
// RichText(
// text: TextSpan(
// children: <TextSpan>[
// TextSpan(
// text: '$name:'.padRight(13),
// style: TextStyle(
// fontFamily: FontFamily.poppins,
// fontSize: TaskWarriorFonts.fontSizeMedium,
// color: AppSettings.isDarkMode
// ? TaskWarriorColors.white
// : TaskWarriorColors.black,
// )
// // style: GoogleFonts.poppins(
// // fontWeight: TaskWarriorFonts.bold,
// // fontSize: TaskWarriorFonts.fontSizeMedium,
// // color: AppSettings.isDarkMode
// // ? TaskWarriorColors.white
// // : TaskWarriorColors.black,
// // ),
// ),
// TextSpan(
// text:
// '${(value as ListBuilder?)?.build() ?? 'not selected'}',
// style: TextStyle(
// color: AppSettings.isDarkMode
// ? TaskWarriorColors.white
// : TaskWarriorColors.black,
// ),
// ),
// ],
// ),
// ),
// ],
// ),
// ),
// onTap: () => Get.to(
// () => TagsRoute(
// value: value,
// callback: callback,
// ),
// ),
// ),
// );
// }
// }
Loading

0 comments on commit 1edf40e

Please sign in to comment.