-
Notifications
You must be signed in to change notification settings - Fork 179
Fixed: Task server is not configured #579
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4e11c2d
9f7813b
eb65d40
067d869
4a8a400
8c60251
7bd6b29
984cb12
b91ed32
d5a4c57
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| // lib/app/models/tag_filters.dart | ||
|
|
||
| class TagFilterMetadata { | ||
| const TagFilterMetadata({ | ||
| required this.display, | ||
| required this.selected, | ||
| }); | ||
|
|
||
| final String display; | ||
| final bool selected; | ||
| } | ||
|
|
||
| class TagFilters { | ||
| const TagFilters({ | ||
| required this.tagUnion, | ||
| required this.toggleTagUnion, | ||
| required this.tags, | ||
| required this.toggleTagFilter, | ||
| }); | ||
|
|
||
| final bool tagUnion; | ||
| final void Function() toggleTagUnion; | ||
| final Map<String, TagFilterMetadata> tags; | ||
| final void Function(String) toggleTagFilter; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,12 @@ | ||
| // ignore_for_file: use_build_context_synchronously, unrelated_type_equality_checks | ||
|
|
||
| import 'package:taskwarrior/app/utils/language/sentences.dart'; | ||
|
|
||
| import 'dart:collection'; | ||
| import 'dart:io'; | ||
|
|
||
| import 'package:taskwarrior/app/routes/app_pages.dart'; | ||
|
|
||
| import 'package:connectivity_plus/connectivity_plus.dart'; | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:get/get.dart'; | ||
|
|
@@ -18,7 +22,8 @@ import 'package:taskwarrior/app/models/tag_meta_data.dart'; | |
| import 'package:taskwarrior/app/modules/home/controllers/widget.controller.dart'; | ||
| import 'package:taskwarrior/app/modules/splash/controllers/splash_controller.dart'; | ||
| import 'package:taskwarrior/app/services/deep_link_service.dart'; | ||
| import 'package:taskwarrior/app/services/tag_filter.dart'; | ||
| import 'package:taskwarrior/app/models/tag_filters.dart'; | ||
|
|
||
| import 'package:taskwarrior/app/tour/filter_drawer_tour.dart'; | ||
| import 'package:taskwarrior/app/tour/home_page_tour.dart'; | ||
| import 'package:taskwarrior/app/tour/task_swipe_tour.dart'; | ||
|
|
@@ -40,12 +45,18 @@ 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'; | ||
|
|
||
|
|
||
|
|
||
| class HomeController extends GetxController { | ||
| final SplashController splashController = Get.find<SplashController>(); | ||
| late Storage storage; | ||
| final RxBool taskServerBannerShown = false.obs; | ||
| final Sentences sentences = Sentences(); | ||
| final RxBool pendingFilter = false.obs; | ||
| final RxBool waitingFilter = false.obs; | ||
| final RxString projectFilter = ''.obs; | ||
| final RxBool completedFilter = false.obs; | ||
| final RxBool deletedFilter = false.obs; | ||
| final RxBool tagUnion = false.obs; | ||
| final RxString selectedSort = ''.obs; | ||
| final RxSet<String> selectedTags = <String>{}.obs; | ||
|
|
@@ -100,6 +111,8 @@ class HomeController extends GetxController { | |
| everAll([ | ||
| pendingFilter, | ||
| waitingFilter, | ||
| completedFilter, | ||
| deletedFilter, | ||
| projectFilter, | ||
| tagUnion, | ||
| selectedSort, | ||
|
|
@@ -244,15 +257,35 @@ class HomeController extends GetxController { | |
| } | ||
|
|
||
| void _refreshTasks() { | ||
| if (pendingFilter.value) { | ||
|
|
||
| if (deletedFilter.value) { | ||
| // Show ONLY deleted tasks | ||
| queriedTasks.value = storage.data | ||
| .completedData() | ||
| .where((task) => task.status == 'deleted') | ||
| .toList(); | ||
| } | ||
| else if (completedFilter.value) { | ||
| // Show completed tasks (EXCLUDE deleted) | ||
| queriedTasks.value = storage.data | ||
| .completedData() | ||
| .where((task) => task.status == 'completed') | ||
| .toList(); | ||
| } | ||
| else if (pendingFilter.value) { | ||
| // Show pending tasks (default behaviour) | ||
| queriedTasks.value = storage.data | ||
| .pendingData() | ||
| .where((task) => task.status == 'pending') | ||
| .toList(); | ||
| } else { | ||
| queriedTasks.value = storage.data.completedData(); | ||
| } | ||
| else { | ||
| // Fallback: pending tasks | ||
| queriedTasks.value = storage.data.pendingData(); | ||
| } | ||
|
|
||
|
|
||
| // Rest of the method stays the same... | ||
| if (waitingFilter.value) { | ||
| var currentTime = DateTime.now(); | ||
| queriedTasks.value = queriedTasks | ||
|
|
@@ -354,6 +387,22 @@ class HomeController extends GetxController { | |
| _refreshTasks(); | ||
| } | ||
|
|
||
| void toggleCompletedFilter() { | ||
| completedFilter.toggle(); | ||
| if (completedFilter.value) { | ||
| deletedFilter.value = false; | ||
| } | ||
| _refreshTasks(); | ||
| } | ||
|
|
||
| void toggleDeletedFilter() { | ||
| deletedFilter.toggle(); | ||
| if (deletedFilter.value) { | ||
| completedFilter.value = false; | ||
| } | ||
| _refreshTasks(); | ||
| } | ||
|
|
||
| void toggleProjectFilter(String project) { | ||
| Query(storage.tabs.tab()).toggleProjectFilter(project); | ||
| projectFilter.value = Query(storage.tabs.tab()).projectFilter(); | ||
|
|
@@ -544,6 +593,44 @@ class HomeController extends GetxController { | |
| _refreshTasks(); | ||
| } | ||
|
|
||
| void showTaskServerNotConfiguredBanner(BuildContext context) { | ||
| if (taskServerBannerShown.value) return; | ||
|
|
||
| taskServerBannerShown.value = true; | ||
| final messenger = ScaffoldMessenger.of(context); | ||
|
|
||
| messenger.clearMaterialBanners(); | ||
|
|
||
| messenger.showMaterialBanner( | ||
| MaterialBanner( | ||
| content: Text(sentences.homePageTaskWarriorNotConfigured), | ||
| actions: [ | ||
| TextButton( | ||
| onPressed: () { | ||
| messenger.hideCurrentMaterialBanner(); | ||
| taskServerBannerShown.value = false; // ✅ RESET flag | ||
| Get.toNamed(Routes.TASKSERVER_SETUP), | ||
| }, | ||
| child: Text(sentences.homePageSetup), | ||
| ), | ||
| TextButton( | ||
| onPressed: () { | ||
| messenger.hideCurrentMaterialBanner(); | ||
| taskServerBannerShown.value = false; // ✅ RESET flag | ||
| }, | ||
| child: const Text('Dismiss'), | ||
| ), | ||
| ], | ||
| ), | ||
| ); | ||
|
|
||
| Future.delayed(const Duration(seconds: 5), () { | ||
| messenger.hideCurrentMaterialBanner(); | ||
| taskServerBannerShown.value = false; // ✅ RESET flag | ||
| }); | ||
|
Comment on lines
+596
to
+630
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The auto-dismiss task can clear the wrong banner. Line 602 clears every material banner up front, and the delayed callback on Line 627 later calls 🛠️ Safer banner lifecycle sketch+import 'dart:async';
import 'dart:collection';
import 'dart:io';
class HomeController extends GetxController {
+ Timer? _taskServerBannerTimer;
+ ScaffoldFeatureController<MaterialBanner, MaterialBannerClosedReason>?
+ _taskServerBannerController;
+
void showTaskServerNotConfiguredBanner(BuildContext context) {
if (taskServerBannerShown.value) return;
taskServerBannerShown.value = true;
final messenger = ScaffoldMessenger.of(context);
- messenger.clearMaterialBanners();
-
- messenger.showMaterialBanner(
+ _taskServerBannerTimer?.cancel();
+ _taskServerBannerController?.close();
+ _taskServerBannerController = messenger.showMaterialBanner(
MaterialBanner(
content: Text(sentences.homePageTaskWarriorNotConfigured),
actions: [
TextButton(
onPressed: () {
- messenger.hideCurrentMaterialBanner();
+ _taskServerBannerTimer?.cancel();
+ _taskServerBannerController?.close();
taskServerBannerShown.value = false;
Get.toNamed(Routes.TASKSERVER_SETUP);
},
child: Text(sentences.homePageSetup),
),
TextButton(
onPressed: () {
- messenger.hideCurrentMaterialBanner();
+ _taskServerBannerTimer?.cancel();
+ _taskServerBannerController?.close();
taskServerBannerShown.value = false;
},
child: const Text('Dismiss'),
),
],
),
);
- Future.delayed(const Duration(seconds: 5), () {
- messenger.hideCurrentMaterialBanner();
+ _taskServerBannerTimer = Timer(const Duration(seconds: 5), () {
+ _taskServerBannerController?.close();
taskServerBannerShown.value = false;
});
}
`@override`
void onClose() {
+ _taskServerBannerTimer?.cancel();
searchFocusNode.dispose();
super.onClose();
}
}🤖 Prompt for AI Agents |
||
| } | ||
|
|
||
|
|
||
| void renameTab({ | ||
| required String tab, | ||
| required String name, | ||
|
|
@@ -656,11 +743,17 @@ class HomeController extends GetxController { | |
| tags: tags, | ||
| toggleTagFilter: toggleTagFilter, | ||
| ); | ||
|
|
||
| // REPLACE this entire Filters() instantiation: | ||
| var filters = Filters( | ||
| pendingFilter: pendingFilter.value, | ||
| waitingFilter: waitingFilter.value, | ||
| completedFilter: completedFilter.value, // NEW - Add this line | ||
| deletedFilter: deletedFilter.value, // NEW - Add this line | ||
| togglePendingFilter: togglePendingFilter, | ||
| toggleWaitingFilter: toggleWaitingFilter, | ||
| toggleCompletedFilter: toggleCompletedFilter, // NEW - Add this line | ||
| toggleDeletedFilter: toggleDeletedFilter, // NEW - Add this line | ||
| projects: projects, | ||
| projectFilter: projectFilter.value, | ||
| toggleProjectFilter: toggleProjectFilter, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: CCExtractor/taskwarrior-flutter
Length of output: 141
Fix compilation errors:
Sentencesis abstract andRoutes.TASKSERVER_SETUPdoes not exist.Line 54 instantiates
Sentences()directly, butSentencesis an abstract class and cannot be instantiated. Line 612 referencesRoutes.TASKSERVER_SETUP, which does not exist in the routes configuration. Both changes will fail to compile and must be corrected before merging.Also applies to: 3-4, 8-8, 606-614
🤖 Prompt for AI Agents