1
0
mirror of https://github.com/go-vikunja/app synced 2024-06-02 18:49:47 +00:00

fixed kanban by moving is_default_bucket from bucket to list

This commit is contained in:
Benimautner 2024-01-06 01:06:47 +01:00
parent ae34f6be7b
commit b0d60e1c12
5 changed files with 25 additions and 7 deletions

View File

@ -45,6 +45,7 @@ class KanbanClass {
if (_pageController == null || _pageController!.viewportFraction != bucketFraction) if (_pageController == null || _pageController!.viewportFraction != bucketFraction)
_pageController = PageController(viewportFraction: bucketFraction); _pageController = PageController(viewportFraction: bucketFraction);
print(_list.doneBucketId);
return ReorderableListView.builder( return ReorderableListView.builder(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
@ -170,6 +171,11 @@ class KanbanClass {
), ),
)); ));
} }
Future<void> _setDoneBucket(BuildContext context, int bucketId) async {
//setState(() {});
_list = (await VikunjaGlobal.of(context).projectService.update(_list.copyWith(doneBucketId: bucketId)))!;
notify();
}
Future<void> _addBucket( Future<void> _addBucket(
String title, BuildContext context) async { String title, BuildContext context) async {
@ -277,7 +283,7 @@ class KanbanClass {
minLeadingWidth: 15, minLeadingWidth: 15,
horizontalTitleGap: 4, horizontalTitleGap: 4,
contentPadding: const EdgeInsets.only(left: 16, right: 10), contentPadding: const EdgeInsets.only(left: 16, right: 10),
leading: bucket.isDoneBucket leading: bucket.id == _list.doneBucketId
? Icon( ? Icon(
Icons.done_all, Icons.done_all,
color: Colors.green, color: Colors.green,
@ -347,8 +353,11 @@ class KanbanClass {
}); });
break; break;
case BucketMenu.done: case BucketMenu.done:
bucket.isDoneBucket = !bucket.isDoneBucket; //bucket.isDoneBucket = !(bucket.id == _list.doneBucketId);
_updateBucket(context, bucket); _list = _list.copyWith(doneBucketId: bucket.id);
_setDoneBucket(context, bucket.id);
notify();
//_updateBucket(context, bucket);
break; break;
case BucketMenu.delete: case BucketMenu.delete:
_deleteBucket(context, bucket); _deleteBucket(context, bucket);
@ -370,7 +379,7 @@ class KanbanClass {
padding: const EdgeInsets.only(right: 4), padding: const EdgeInsets.only(right: 4),
child: Icon( child: Icon(
Icons.done_all, Icons.done_all,
color: bucket.isDoneBucket color: bucket.id == _list.doneBucketId
? Colors.green ? Colors.green
: null, : null,
), ),

View File

@ -10,7 +10,7 @@ class Bucket {
double? position; double? position;
final DateTime created, updated; final DateTime created, updated;
User createdBy; User createdBy;
bool isDoneBucket; bool? isDoneBucket;
final List<Task> tasks; final List<Task> tasks;
Bucket({ Bucket({

View File

@ -12,6 +12,7 @@ class Project {
final DateTime created, updated; final DateTime created, updated;
final Color? color; final Color? color;
final bool isArchived, isFavourite; final bool isArchived, isFavourite;
final int? doneBucketId;
Iterable<Project>? subprojects; Iterable<Project>? subprojects;
@ -22,6 +23,7 @@ class Project {
this.parentProjectId = 0, this.parentProjectId = 0,
this.description = '', this.description = '',
this.position = 0, this.position = 0,
this.doneBucketId,
this.color, this.color,
this.isArchived = false, this.isArchived = false,
this.isFavourite = false, this.isFavourite = false,
@ -38,6 +40,7 @@ class Project {
position = json['position'].toDouble(), position = json['position'].toDouble(),
isArchived = json['is_archived'], isArchived = json['is_archived'],
isFavourite = json['is_archived'], isFavourite = json['is_archived'],
doneBucketId = json['done_bucket_id'],
parentProjectId = json['parent_project_id'], parentProjectId = json['parent_project_id'],
created = DateTime.parse(json['created']), created = DateTime.parse(json['created']),
updated = DateTime.parse(json['updated']), updated = DateTime.parse(json['updated']),
@ -57,6 +60,7 @@ class Project {
'hex_color': color?.value.toRadixString(16).padLeft(8, '0').substring(2), 'hex_color': color?.value.toRadixString(16).padLeft(8, '0').substring(2),
'is_archived': isArchived, 'is_archived': isArchived,
'is_favourite': isFavourite, 'is_favourite': isFavourite,
'done_bucket_id': doneBucketId,
'position': position 'position': position
}; };
@ -71,6 +75,7 @@ class Project {
Color? color, Color? color,
bool? isArchived, bool? isArchived,
bool? isFavourite, bool? isFavourite,
int? doneBucketId,
double? position, double? position,
}) { }) {
@ -82,6 +87,7 @@ class Project {
owner: owner ?? this.owner, owner: owner ?? this.owner,
description: description ?? this.description, description: description ?? this.description,
parentProjectId: parentProjectId ?? this.parentProjectId, parentProjectId: parentProjectId ?? this.parentProjectId,
doneBucketId: doneBucketId ?? this.doneBucketId,
color: color ?? this.color, color: color ?? this.color,
isArchived: isArchived ?? this.isArchived, isArchived: isArchived ?? this.isArchived,
isFavourite: isFavourite ?? this.isFavourite, isFavourite: isFavourite ?? this.isFavourite,

View File

@ -426,11 +426,11 @@ class _TaskEditPageState extends State<TaskEditPage> {
title: Text(widget.task.attachments[index].file.name), title: Text(widget.task.attachments[index].file.name),
trailing: IconButton( trailing: IconButton(
icon: Icon(Icons.download), icon: Icon(Icons.download),
onPressed: () { onPressed: () async {
String url = VikunjaGlobal.of(context).client.base; String url = VikunjaGlobal.of(context).client.base;
url += '/tasks/${widget.task.id}/attachments/${widget.task.attachments[index].id}'; url += '/tasks/${widget.task.id}/attachments/${widget.task.attachments[index].id}';
print(url); print(url);
final taskId = FlutterDownloader.enqueue( final taskId = await FlutterDownloader.enqueue(
url: url, url: url,
fileName: widget.task.attachments[index].file.name, fileName: widget.task.attachments[index].file.name,
headers: VikunjaGlobal.of(context).client.headers, // optional: header send with url (auth token etc) headers: VikunjaGlobal.of(context).client.headers, // optional: header send with url (auth token etc)
@ -438,6 +438,8 @@ class _TaskEditPageState extends State<TaskEditPage> {
showNotification: true, // show download progress in status bar (for Android) showNotification: true, // show download progress in status bar (for Android)
openFileFromNotification: true, // click on notification to open downloaded file (for Android) openFileFromNotification: true, // click on notification to open downloaded file (for Android)
); );
if(taskId == null) return;
FlutterDownloader.open(taskId: taskId);
}, },
), ),
); );

View File

@ -27,6 +27,7 @@ class LoginWithWebViewState extends State<LoginWithWebView> {
void initState() { void initState() {
super.initState(); super.initState();
webViewController = WebViewController() webViewController = WebViewController()
..clearLocalStorage()
..setJavaScriptMode(JavaScriptMode.unrestricted) ..setJavaScriptMode(JavaScriptMode.unrestricted)
..setUserAgent("Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Mobile Safari/537.36") ..setUserAgent("Mozilla/5.0 (Linux; Android 8.0; Pixel 2 Build/OPD3.170816.012) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Mobile Safari/537.36")
..setNavigationDelegate(NavigationDelegate( ..setNavigationDelegate(NavigationDelegate(