mirror of
https://github.com/go-vikunja/app
synced 2024-11-04 12:00:00 +00:00
chore: dart fix
This commit is contained in:
parent
19ece39f39
commit
e0c71bfb29
@ -1,5 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:vikunja_app/api/client.dart';
|
||||
import 'package:vikunja_app/api/response.dart';
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'dart:convert';
|
||||
|
@ -1,9 +1,6 @@
|
||||
import 'package:after_layout/after_layout.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vikunja_app/components/datetimePicker.dart';
|
||||
import 'package:vikunja_app/global.dart';
|
||||
import 'dart:developer';
|
||||
import '../models/task.dart';
|
||||
|
||||
enum NewTaskDue { day, week, month, custom }
|
||||
|
||||
|
@ -303,9 +303,9 @@ class _BucketTaskCardState extends State<BucketTaskCard>
|
||||
height: (cardSize.height / 2) +
|
||||
(dropAbove ? dropBoxSize.height : 0),
|
||||
child: DragTarget<TaskData>(
|
||||
onWillAccept: (data) =>
|
||||
dragTargetOnWillAccept(data!, DropLocation.above),
|
||||
onAccept: dragTargetOnAccept,
|
||||
onWillAcceptWithDetails: (data) =>
|
||||
dragTargetOnWillAccept(data, DropLocation.above),
|
||||
onAcceptWithDetails: dragTargetOnAccept,
|
||||
onLeave: dragTargetOnLeave,
|
||||
builder: (_, __, ___) => SizedBox.expand(),
|
||||
),
|
||||
@ -314,9 +314,9 @@ class _BucketTaskCardState extends State<BucketTaskCard>
|
||||
height: (cardSize.height / 2) +
|
||||
(dropBelow ? dropBoxSize.height : 0),
|
||||
child: DragTarget<TaskData>(
|
||||
onWillAccept: (data) =>
|
||||
dragTargetOnWillAccept(data!, DropLocation.below),
|
||||
onAccept: dragTargetOnAccept,
|
||||
onWillAcceptWithDetails: (data) =>
|
||||
dragTargetOnWillAccept(data, DropLocation.below),
|
||||
onAcceptWithDetails: dragTargetOnAccept,
|
||||
onLeave: dragTargetOnLeave,
|
||||
builder: (_, __, ___) => SizedBox.expand(),
|
||||
),
|
||||
|
@ -504,13 +504,13 @@ class KanbanClass {
|
||||
// DragTarget to drop tasks in empty buckets
|
||||
if (bucket.tasks.length == 0)
|
||||
DragTarget<TaskData>(
|
||||
onWillAccept: (data) {
|
||||
onWillAcceptWithDetails: (data) {
|
||||
/*setState(() =>*/ _bucketProps[bucket.id]!
|
||||
.taskDropSize = data?.size; //);
|
||||
.taskDropSize = data.size; //);
|
||||
notify();
|
||||
return true;
|
||||
},
|
||||
onAccept: (data) {
|
||||
onAcceptWithDetails: (data) {
|
||||
Provider.of<ProjectProvider>(context, listen: false)
|
||||
.moveTaskToBucket(
|
||||
context: context,
|
||||
|
@ -1,8 +1,5 @@
|
||||
import 'package:datetime_picker_formfield/datetime_picker_formfield.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_widget_from_html/flutter_widget_from_html.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:vikunja_app/utils/priority.dart';
|
||||
|
||||
import '../models/label.dart';
|
||||
|
@ -12,13 +12,11 @@ class UserManager {
|
||||
userMap.keys
|
||||
.where((id) => _isNumeric(id))
|
||||
.map((idString) => int.tryParse(idString));
|
||||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
bool _isNumeric(String str) {
|
||||
if (str == null) {
|
||||
return false;
|
||||
}
|
||||
return double.tryParse(str) != null;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:vikunja_app/models/label.dart';
|
||||
import 'package:vikunja_app/models/task.dart';
|
||||
import 'package:vikunja_app/models/user.dart';
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:vikunja_app/models/label.dart';
|
||||
|
||||
class LabelTaskBulk {
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum ViewKind { LIST, GANTT, TABLE, KANBAN }
|
||||
|
@ -1,6 +1,4 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
@ -55,7 +53,7 @@ class HomePageState extends State<HomePage> {
|
||||
);
|
||||
}
|
||||
|
||||
_getDrawerItemWidget(int pos, {bool forceReload = false}) {
|
||||
_getDrawerItemWidget(int pos) {
|
||||
_previousDrawerIndex = pos;
|
||||
return widgets[pos];
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:after_layout/after_layout.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:vikunja_app/global.dart';
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:after_layout/after_layout.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vikunja_app/pages/project/project_task_list.dart';
|
||||
|
||||
|
@ -111,7 +111,7 @@ class _ProjectEditPageState extends State<ProjectEditPage> {
|
||||
onPressed: !_loading
|
||||
? () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
Form.of(context)?.save();
|
||||
Form.of(context).save();
|
||||
_saveList(context);
|
||||
}
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ class _TaskEditPageState extends State<TaskEditPage> {
|
||||
? null
|
||||
: ButtonStyle(
|
||||
backgroundColor:
|
||||
MaterialStateProperty.resolveWith(
|
||||
WidgetStateProperty.resolveWith(
|
||||
(_) => _color ?? widget.task.color),
|
||||
),
|
||||
onPressed: _onColorEdit,
|
||||
@ -469,7 +469,7 @@ class _TaskEditPageState extends State<TaskEditPage> {
|
||||
onPressed: !_loading
|
||||
? () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
Form.of(_listKey.currentContext!)!.save();
|
||||
Form.of(_listKey.currentContext!).save();
|
||||
_saveTask(_listKey.currentContext!);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:vikunja_app/global.dart';
|
||||
|
@ -1,9 +1,7 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vikunja_app/models/user.dart';
|
||||
import 'package:vikunja_app/api/client.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class LoginWithWebView extends StatefulWidget {
|
||||
@ -32,7 +30,7 @@ class LoginWithWebViewState extends State<LoginWithWebView> {
|
||||
onPageFinished: (value) => _handlePageFinished(value),
|
||||
))
|
||||
..loadRequest(Uri.parse(widget.frontEndUrl)).then((value) => {
|
||||
webViewController!.runJavaScript(
|
||||
webViewController.runJavaScript(
|
||||
"localStorage.clear(); location.href=location.href;")
|
||||
});
|
||||
|
||||
@ -59,7 +57,7 @@ class LoginWithWebViewState extends State<LoginWithWebView> {
|
||||
controller: webViewController,
|
||||
)),
|
||||
onWillPop: () async {
|
||||
String? currentUrl = await webViewController?.currentUrl();
|
||||
String? currentUrl = await webViewController.currentUrl();
|
||||
if (currentUrl != null) {
|
||||
bool hasPopped = await _handlePageFinished(currentUrl);
|
||||
return Future.value(!hasPopped);
|
||||
@ -71,37 +69,35 @@ class LoginWithWebViewState extends State<LoginWithWebView> {
|
||||
|
||||
Future<bool> _handlePageFinished(String pageLocation) async {
|
||||
log("handlePageFinished");
|
||||
if (webViewController != null) {
|
||||
String localStorage = (await webViewController!
|
||||
.runJavaScriptReturningResult("JSON.stringify(localStorage);"))
|
||||
.toString();
|
||||
String localStorage = (await webViewController
|
||||
.runJavaScriptReturningResult("JSON.stringify(localStorage);"))
|
||||
.toString();
|
||||
|
||||
String apiUrl =
|
||||
(await webViewController!.runJavaScriptReturningResult("API_URL"))
|
||||
.toString();
|
||||
String token = (await webViewController!
|
||||
.runJavaScriptReturningResult("localStorage['token']"))
|
||||
.toString();
|
||||
if (localStorage.toString() != "{}") {
|
||||
apiUrl = apiUrl.replaceAll("\"", "");
|
||||
token = token.replaceAll("\"", "");
|
||||
if (!apiUrl.startsWith("http")) {
|
||||
if (pageLocation.endsWith("/"))
|
||||
pageLocation = pageLocation.substring(0, pageLocation.length - 1);
|
||||
apiUrl = pageLocation + apiUrl;
|
||||
}
|
||||
String apiUrl =
|
||||
(await webViewController.runJavaScriptReturningResult("API_URL"))
|
||||
.toString();
|
||||
String token = (await webViewController
|
||||
.runJavaScriptReturningResult("localStorage['token']"))
|
||||
.toString();
|
||||
if (localStorage.toString() != "{}") {
|
||||
apiUrl = apiUrl.replaceAll("\"", "");
|
||||
token = token.replaceAll("\"", "");
|
||||
if (!apiUrl.startsWith("http")) {
|
||||
if (pageLocation.endsWith("/"))
|
||||
pageLocation = pageLocation.substring(0, pageLocation.length - 1);
|
||||
apiUrl = pageLocation + apiUrl;
|
||||
}
|
||||
|
||||
if (apiUrl != "null" && token != "null") {
|
||||
BaseTokenPair baseTokenPair = BaseTokenPair(apiUrl, token);
|
||||
if (destroyed) return true;
|
||||
destroyed = true;
|
||||
print("pop now");
|
||||
Navigator.pop(context, baseTokenPair);
|
||||
if (apiUrl != "null" && token != "null") {
|
||||
BaseTokenPair baseTokenPair = BaseTokenPair(apiUrl, token);
|
||||
if (destroyed) return true;
|
||||
destroyed = true;
|
||||
print("pop now");
|
||||
Navigator.pop(context, baseTokenPair);
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:vikunja_app/theme/constants.dart';
|
||||
|
||||
class VikunjaButtonText extends StatelessWidget {
|
||||
final String text;
|
||||
|
@ -9,19 +9,18 @@ ThemeData buildVikunjaDarkTheme() =>
|
||||
|
||||
ThemeData buildVikunjaMaterialLightTheme() {
|
||||
return ThemeData.light().copyWith(
|
||||
useMaterial3: true,
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
ThemeData buildVikunjaMaterialDarkTheme() {
|
||||
return ThemeData.dark().copyWith(
|
||||
useMaterial3: true,
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
ThemeData _buildVikunjaTheme(ThemeData base, {bool isDark = false}) {
|
||||
return base.copyWith(
|
||||
useMaterial3: true,
|
||||
primaryColor: vPrimaryDark,
|
||||
primaryColorLight: vPrimary,
|
||||
primaryColorDark: vBlueDark,
|
||||
|
Loading…
Reference in New Issue
Block a user