fixed kanban by moving is_default_bucket from bucket to list
This commit is contained in:
parent
ae34f6be7b
commit
b0d60e1c12
|
@ -45,6 +45,7 @@ class KanbanClass {
|
|||
if (_pageController == null || _pageController!.viewportFraction != bucketFraction)
|
||||
_pageController = PageController(viewportFraction: bucketFraction);
|
||||
|
||||
print(_list.doneBucketId);
|
||||
|
||||
return ReorderableListView.builder(
|
||||
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(
|
||||
String title, BuildContext context) async {
|
||||
|
@ -277,7 +283,7 @@ class KanbanClass {
|
|||
minLeadingWidth: 15,
|
||||
horizontalTitleGap: 4,
|
||||
contentPadding: const EdgeInsets.only(left: 16, right: 10),
|
||||
leading: bucket.isDoneBucket
|
||||
leading: bucket.id == _list.doneBucketId
|
||||
? Icon(
|
||||
Icons.done_all,
|
||||
color: Colors.green,
|
||||
|
@ -347,8 +353,11 @@ class KanbanClass {
|
|||
});
|
||||
break;
|
||||
case BucketMenu.done:
|
||||
bucket.isDoneBucket = !bucket.isDoneBucket;
|
||||
_updateBucket(context, bucket);
|
||||
//bucket.isDoneBucket = !(bucket.id == _list.doneBucketId);
|
||||
_list = _list.copyWith(doneBucketId: bucket.id);
|
||||
_setDoneBucket(context, bucket.id);
|
||||
notify();
|
||||
//_updateBucket(context, bucket);
|
||||
break;
|
||||
case BucketMenu.delete:
|
||||
_deleteBucket(context, bucket);
|
||||
|
@ -370,7 +379,7 @@ class KanbanClass {
|
|||
padding: const EdgeInsets.only(right: 4),
|
||||
child: Icon(
|
||||
Icons.done_all,
|
||||
color: bucket.isDoneBucket
|
||||
color: bucket.id == _list.doneBucketId
|
||||
? Colors.green
|
||||
: null,
|
||||
),
|
||||
|
|
|
@ -10,7 +10,7 @@ class Bucket {
|
|||
double? position;
|
||||
final DateTime created, updated;
|
||||
User createdBy;
|
||||
bool isDoneBucket;
|
||||
bool? isDoneBucket;
|
||||
final List<Task> tasks;
|
||||
|
||||
Bucket({
|
||||
|
|
|
@ -12,6 +12,7 @@ class Project {
|
|||
final DateTime created, updated;
|
||||
final Color? color;
|
||||
final bool isArchived, isFavourite;
|
||||
final int? doneBucketId;
|
||||
|
||||
Iterable<Project>? subprojects;
|
||||
|
||||
|
@ -22,6 +23,7 @@ class Project {
|
|||
this.parentProjectId = 0,
|
||||
this.description = '',
|
||||
this.position = 0,
|
||||
this.doneBucketId,
|
||||
this.color,
|
||||
this.isArchived = false,
|
||||
this.isFavourite = false,
|
||||
|
@ -38,6 +40,7 @@ class Project {
|
|||
position = json['position'].toDouble(),
|
||||
isArchived = json['is_archived'],
|
||||
isFavourite = json['is_archived'],
|
||||
doneBucketId = json['done_bucket_id'],
|
||||
parentProjectId = json['parent_project_id'],
|
||||
created = DateTime.parse(json['created']),
|
||||
updated = DateTime.parse(json['updated']),
|
||||
|
@ -57,6 +60,7 @@ class Project {
|
|||
'hex_color': color?.value.toRadixString(16).padLeft(8, '0').substring(2),
|
||||
'is_archived': isArchived,
|
||||
'is_favourite': isFavourite,
|
||||
'done_bucket_id': doneBucketId,
|
||||
'position': position
|
||||
};
|
||||
|
||||
|
@ -71,6 +75,7 @@ class Project {
|
|||
Color? color,
|
||||
bool? isArchived,
|
||||
bool? isFavourite,
|
||||
int? doneBucketId,
|
||||
double? position,
|
||||
|
||||
}) {
|
||||
|
@ -82,6 +87,7 @@ class Project {
|
|||
owner: owner ?? this.owner,
|
||||
description: description ?? this.description,
|
||||
parentProjectId: parentProjectId ?? this.parentProjectId,
|
||||
doneBucketId: doneBucketId ?? this.doneBucketId,
|
||||
color: color ?? this.color,
|
||||
isArchived: isArchived ?? this.isArchived,
|
||||
isFavourite: isFavourite ?? this.isFavourite,
|
||||
|
|
|
@ -426,11 +426,11 @@ class _TaskEditPageState extends State<TaskEditPage> {
|
|||
title: Text(widget.task.attachments[index].file.name),
|
||||
trailing: IconButton(
|
||||
icon: Icon(Icons.download),
|
||||
onPressed: () {
|
||||
onPressed: () async {
|
||||
String url = VikunjaGlobal.of(context).client.base;
|
||||
url += '/tasks/${widget.task.id}/attachments/${widget.task.attachments[index].id}';
|
||||
print(url);
|
||||
final taskId = FlutterDownloader.enqueue(
|
||||
final taskId = await FlutterDownloader.enqueue(
|
||||
url: url,
|
||||
fileName: widget.task.attachments[index].file.name,
|
||||
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)
|
||||
openFileFromNotification: true, // click on notification to open downloaded file (for Android)
|
||||
);
|
||||
if(taskId == null) return;
|
||||
FlutterDownloader.open(taskId: taskId);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
|
|
@ -27,6 +27,7 @@ class LoginWithWebViewState extends State<LoginWithWebView> {
|
|||
void initState() {
|
||||
super.initState();
|
||||
webViewController = WebViewController()
|
||||
..clearLocalStorage()
|
||||
..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")
|
||||
..setNavigationDelegate(NavigationDelegate(
|
||||
|
|
Loading…
Reference in New Issue