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

restored app to a basic working demo

This commit is contained in:
benimautner 2022-04-10 15:31:56 +02:00
parent 88bf3f9bc7
commit 714a816cbd
17 changed files with 51 additions and 34 deletions

View File

@ -8,7 +8,7 @@ if (localPropertiesFile.exists()) {
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
throw new Exception("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
@ -26,7 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 28
compileSdkVersion 31
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
@ -50,11 +50,11 @@ android {
productFlavors {
fdroid {
dimension "deploy"
signingConfig null
//signingConfig null
}
unsigned {
dimension "deploy"
signingConfig null
//signingConfig null
}
main {
dimension "deploy"
@ -84,7 +84,7 @@ flutter {
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:1.2.71"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

View File

@ -1,12 +1,13 @@
buildscript {
ext.kotlin_version = '1.2.30'
ext.kotlin_version = '1.6.20'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:4.2.0'
classpath 'com.android.tools.build:gradle:7.1.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

View File

@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip

View File

@ -25,28 +25,29 @@ class Client {
'Content-Type': 'application/json'
};
// TODO: use Uri properly
Future<dynamic> get(String url) {
return http
.get('${this.base}$url', headers: _headers)
.get(Uri.parse('${this.base}$url'), headers: _headers)
.then(_handleResponse);
}
Future<dynamic> delete(String url) {
return http
.delete('${this.base}$url', headers: _headers)
.delete(Uri.parse('${this.base}$url'), headers: _headers)
.then(_handleResponse);
}
Future<dynamic> post(String url, {dynamic body}) {
return http
.post('${this.base}$url',
.post(Uri.parse('${this.base}$url'),
headers: _headers, body: _encoder.convert(body))
.then(_handleResponse);
}
Future<dynamic> put(String url, {dynamic body}) {
return http
.put('${this.base}$url',
.put(Uri.parse('${this.base}$url'),
headers: _headers, body: _encoder.convert(body))
.then(_handleResponse);
}

View File

@ -22,7 +22,13 @@ class ListAPIService extends APIService implements ListService {
@override
Future<TaskList> get(int listId) {
return client.get('/lists/$listId').then((map) => TaskList.fromJson(map));
return client.get('/lists/$listId').then((listmap) {
return client.get('/lists/$listId/tasks').then((value) {
listmap["tasks"] = value;
return TaskList.fromJson(listmap);
});
}
);
}
@override

View File

@ -1,7 +1,10 @@
import 'dart:async';
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:vikunja_app/api/client.dart';
import 'package:vikunja_app/api/service.dart';
import 'package:vikunja_app/models/list.dart';
import 'package:vikunja_app/models/task.dart';
import 'package:vikunja_app/service/services.dart';
@ -15,6 +18,11 @@ class TaskAPIService extends APIService implements TaskService {
.then((map) => Task.fromJson(map));
}
@override
Future<List<Task>> get(int listId) {
return client.get('/list/$listId/tasks');
}
@override
Future delete(int taskId) {
return client.delete('/tasks/$taskId');

View File

@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:vikunja_app/global.dart';
@ -85,7 +86,7 @@ class TaskTileState extends State<TaskTile> {
done: checked,
title: task.title,
description: task.description,
owner: null,
owner: task.owner,
));
}
}

View File

@ -19,8 +19,7 @@ class VikunjaGlobal extends StatefulWidget {
VikunjaGlobalState createState() => VikunjaGlobalState();
static VikunjaGlobalState of(BuildContext context) {
var widget = context.inheritFromWidgetOfExactType(_VikunjaGlobalInherited)
as _VikunjaGlobalInherited;
var widget = context.dependOnInheritedWidgetOfExactType<_VikunjaGlobalInherited>();
return widget.data;
}
}
@ -85,7 +84,7 @@ class VikunjaGlobalState extends State<VikunjaGlobal> {
_currentUser = null;
});
}).catchError((err) {
Scaffold.of(context).showSnackBar(SnackBar(
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('An error occured while logging out!'),
));
});

View File

@ -102,7 +102,7 @@ class HomePageState extends State<HomePage> with AfterLayoutMixin<HomePage> {
currentAccountPicture: currentUser == null
? null
: CircleAvatar(
backgroundImage: NetworkImage(currentUser.avatarUrl(context)),
//backgroundImage: NetworkImage(currentUser.avatarUrl(context)),
),
decoration: BoxDecoration(
image: DecorationImage(
@ -160,7 +160,7 @@ class HomePageState extends State<HomePage> with AfterLayoutMixin<HomePage> {
.create(Namespace(id: null, title: name))
.then((_) {
_loadNamespaces();
Scaffold.of(context).showSnackBar(SnackBar(
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('The namespace was created successfully!'),
));
}).catchError((error) => showDialog(

View File

@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:vikunja_app/components/AddDialog.dart';
@ -120,7 +121,7 @@ class _ListPageState extends State<ListPage> {
}).then((_) {
_loadList();
setState(() => _loadingTasks.remove(newTask));
Scaffold.of(context).showSnackBar(SnackBar(
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('The task was added successfully!'),
));
});

View File

@ -101,17 +101,17 @@ class _ListEditPageState extends State<ListEditPage> {
VikunjaGlobal.of(context).listService.update(updatedList).then((_) {
setState(() => _loading = false);
Scaffold.of(context).showSnackBar(SnackBar(
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('The list was updated successfully!'),
));
}).catchError((err) {
setState(() => _loading = false);
Scaffold.of(context).showSnackBar(
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Something went wrong: ' + err.toString()),
action: SnackBarAction(
label: 'CLOSE',
onPressed: Scaffold.of(context).hideCurrentSnackBar),
onPressed: ScaffoldMessenger.of(context).hideCurrentSnackBar),
),
);
});

View File

@ -56,7 +56,7 @@ class _NamespacePageState extends State<NamespacePage>
color: Colors.white, size: 36.0)),
),
onDismissed: (direction) {
_removeList(ls).then((_) => Scaffold.of(
_removeList(ls).then((_) => ScaffoldMessenger.of(
context)
.showSnackBar(SnackBar(
content:
@ -120,7 +120,7 @@ class _NamespacePageState extends State<NamespacePage>
.then((_) {
setState(() {});
_loadLists();
Scaffold.of(context).showSnackBar(
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('The list was successfully created!'),
),

View File

@ -107,17 +107,17 @@ class _NamespaceEditPageState extends State<NamespaceEditPage> {
.update(updatedNamespace)
.then((_) {
setState(() => _loading = false);
Scaffold.of(context).showSnackBar(SnackBar(
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text('The namespace was updated successfully!'),
));
}).catchError((err) {
setState(() => _loading = false);
Scaffold.of(context).showSnackBar(
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Something went wrong: ' + err.toString()),
action: SnackBarAction(
label: 'CLOSE',
onPressed: Scaffold.of(context).hideCurrentSnackBar),
onPressed: ScaffoldMessenger.of(context).hideCurrentSnackBar),
),
);
});

View File

@ -12,11 +12,11 @@ class PlaceholderPage extends StatelessWidget {
padding: EdgeInsets.only(top: 32.0),
child: new Text(
'Welcome to Vikunja',
style: Theme.of(context).textTheme.headline,
style: Theme.of(context).textTheme.headline4,
),
),
new Text('Please select a namespace by tapping the ☰ icon.',
style: Theme.of(context).textTheme.subhead),
style: Theme.of(context).textTheme.subtitle1),
],
));
}

View File

@ -24,7 +24,7 @@ class _LoginPageState extends State<LoginPage> {
padding: const EdgeInsets.all(16.0),
child: Builder(
builder: (BuildContext context) => Form(
autovalidate: true,
autovalidateMode: AutovalidateMode.always,
key: _formKey,
child: Center(
child: Column(

View File

@ -27,10 +27,10 @@ ThemeData _buildVikunjaTheme(ThemeData base) {
),
),
textTheme: base.textTheme.copyWith(
headline: base.textTheme.headline.copyWith(
headline1: base.textTheme.headline1.copyWith(
fontFamily: 'Quicksand',
),
title: base.textTheme.title.copyWith(
subtitle1: base.textTheme.subtitle1.copyWith(
fontFamily: 'Quicksand',
),
button: base.textTheme.button.copyWith(

View File

@ -11,7 +11,7 @@ dependencies:
sdk: flutter
cupertino_icons: ^0.1.3
flutter_secure_storage: 3.3.5
http: 0.12.0+3
http: 0.13.4
after_layout: ^1.0.7
dev_dependencies: