After a long time, No idea whats changed
This commit is contained in:
@@ -56,6 +56,8 @@ class _AnalyticsPageState extends State<AnalyticsPage> {
|
||||
children: [
|
||||
landscape?navDrawer(context, 1) : Container(),
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.topCenter ,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
child: Container(
|
||||
@@ -109,12 +111,37 @@ class _AnalyticsPageState extends State<AnalyticsPage> {
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
Card(
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text("Compare",style: TextStyle(fontSize: 17)),
|
||||
],
|
||||
),
|
||||
Divider(),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
MaterialButton(color: Colors.blue,onPressed: (){}, child: Text("Task Types"),),
|
||||
MaterialButton(color: Colors.blue,onPressed: (){}, child: Text("Categories"),),
|
||||
MaterialButton(color: Colors.blue,onPressed: (){}, child: Text("Days"),),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
);
|
||||
|
||||
@@ -184,9 +184,9 @@ class Settings{
|
||||
}else{
|
||||
var uuid = Uuid();
|
||||
String _uuid = uuid.v4();
|
||||
if(Platform.isAndroid){
|
||||
|
||||
}
|
||||
// if(Platform.isAndroid){
|
||||
//
|
||||
// }
|
||||
await prefs.setString('uuid',_uuid);
|
||||
return Future.value(_uuid);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart' as K;
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:tasktracker/NewProject.dart';
|
||||
@@ -19,7 +20,7 @@ import 'package:sqflite_common/sqlite_api.dart';
|
||||
import 'Tasks.dart';
|
||||
import 'Dialogs.dart';
|
||||
|
||||
bool cacheEnabled = true;
|
||||
bool cacheEnabled = !K.kIsWeb;
|
||||
|
||||
late http.Response loginResponse;
|
||||
|
||||
@@ -63,7 +64,6 @@ Future<http.Response> login(String _username, String password) async {
|
||||
Future<void> initUserData() async {
|
||||
if (cacheEnabled) {
|
||||
await initCacheDatabase();
|
||||
}
|
||||
int catCount = Sqflite.firstIntValue(await cacheDb.rawQuery('SELECT COUNT(*) FROM Categories')) ?? 0;
|
||||
int taskCount = Sqflite.firstIntValue(await cacheDb.rawQuery('SELECT COUNT(*) FROM TaskTypes')) ?? 0;
|
||||
if(catCount > 0 && taskCount > 0){
|
||||
@@ -72,6 +72,8 @@ Future<void> initUserData() async {
|
||||
}else{
|
||||
await refreshUserData();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BuildBridgeToServer();
|
||||
Debug.Log('Initializing UserData...');
|
||||
@@ -156,7 +158,7 @@ Future<void> refreshUserData({bool forceOffline = false}) async {
|
||||
|
||||
refreshStream.add(false);
|
||||
} else {
|
||||
if(false) {
|
||||
if(K.kIsWeb) {
|
||||
Debug.LogTest('updating cats ${DateTime.now()}');
|
||||
categories = await GetCategories(false);
|
||||
Debug.LogTest('updating projs ${DateTime.now()}');
|
||||
@@ -197,6 +199,7 @@ Future<void> refreshUserData({bool forceOffline = false}) async {
|
||||
|
||||
Debug.LogTest('Done filling @ ${DateTime.now()}');
|
||||
|
||||
|
||||
categories = await GetCategories(true);
|
||||
projects = await GetProjects(true);
|
||||
taskTypes = await GetTaskTypes(true);
|
||||
@@ -220,7 +223,7 @@ Future<void> refreshUserData({bool forceOffline = false}) async {
|
||||
}
|
||||
|
||||
Future<bool> cacheDbExist() async {
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
if (!K.kIsWeb && Platform.isAndroid || Platform.isIOS) {
|
||||
Directory directory = await getApplicationDocumentsDirectory();
|
||||
return databaseFactory.databaseExists(directory.path + 'cache.db');
|
||||
} else {
|
||||
@@ -248,7 +251,7 @@ Future<void> updateProjectsList() async {
|
||||
Future<void> initCacheDatabase() async {
|
||||
Directory directory = await getApplicationDocumentsDirectory();
|
||||
Debug.LogResponse('database at ' + directory.path + '/cache.db');
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
if (!K.kIsWeb && Platform.isAndroid || Platform.isIOS) {
|
||||
cacheDb = await openDatabase(directory.path + 'cache.db', version: 1, onCreate: onCacheDatabaseCreate, onUpgrade: onCacheDatabaseUpgrade);
|
||||
} else {
|
||||
cacheDb = await SqlFF.databaseFactoryFfi
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/foundation.dart' as K;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
@@ -29,6 +30,7 @@ import 'package:syncfusion_flutter_charts/charts.dart';
|
||||
import 'Dialogs.dart';
|
||||
import 'CustomWidgets.dart';
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
|
||||
final GlobalKey<NavigatorState> navigatorKey = new GlobalKey<NavigatorState>();
|
||||
showAlertDialog(BuildContext context, String title, String message) {
|
||||
// set up the button
|
||||
@@ -76,9 +78,9 @@ extension HexColor on Color {
|
||||
|
||||
void main() async {
|
||||
//Wakelock.enable(); // or Wakelock.toggle(on: true);
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
if(Platform.isAndroid || Platform.isIOS){
|
||||
|
||||
if(!K.kIsWeb &&(Platform.isAndroid || Platform.isIOS)){
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await Firebase.initializeApp();
|
||||
}
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user