Todo summary
This commit is contained in:
@@ -1,7 +1,8 @@
|
|||||||
class Debug{
|
class Debug{
|
||||||
static bool enableLogging = true;
|
static bool enableLogging = true;
|
||||||
static bool enableResponseLogging = true;
|
static bool enableResponseLogging = false;
|
||||||
static bool enableErrorLoggin = true;
|
static bool enableErrorLoggin = true;
|
||||||
|
static bool enableTestLogging = true;
|
||||||
|
|
||||||
static void LogResponse(Object? response, {Object src= ''}){
|
static void LogResponse(Object? response, {Object src= ''}){
|
||||||
if(!enableLogging){return;}
|
if(!enableLogging){return;}
|
||||||
@@ -16,8 +17,14 @@ class Debug{
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void Log(Object? msg){
|
static void Log(Object? msg){
|
||||||
if(!enableErrorLoggin) {return;}
|
if(!enableLogging) {return;}
|
||||||
print('\x1B[36m$msg\x1B[0m');
|
print('\x1B[36m$msg\x1B[0m');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void LogTest(Object? msg){
|
||||||
|
if(!enableLogging){return;}
|
||||||
|
if(!enableTestLogging) {return;}
|
||||||
|
print('\x1B[35m$msg\x1B[0m');
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -164,7 +164,7 @@ class _JournalPageState extends State<JournalPage>{
|
|||||||
SizedBox(height: 5,),
|
SizedBox(height: 5,),
|
||||||
if (User.journal[index].description != null && User.journal[index].description!.isNotEmpty)
|
if (User.journal[index].description != null && User.journal[index].description!.isNotEmpty)
|
||||||
(charCount > maxCharCount && expandedIndex != index) ?
|
(charCount > maxCharCount && expandedIndex != index) ?
|
||||||
Text(User.journal[index].description!.substring(0,maxCharCount) + '...') :
|
Text(User.journal[index].description!.substring(0,maxCharCount.clamp(0,User.journal[index].description!.length)) + '...') :
|
||||||
Text(User.journal[index].description!),
|
Text(User.journal[index].description!),
|
||||||
|
|
||||||
if(charCount>maxCharCount) Row(
|
if(charCount>maxCharCount) Row(
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import 'package:scrollable_positioned_list/scrollable_positioned_list.dart';
|
|||||||
import 'package:tasktracker/NewJournal.dart';
|
import 'package:tasktracker/NewJournal.dart';
|
||||||
import 'package:tasktracker/NewTodo.dart';
|
import 'package:tasktracker/NewTodo.dart';
|
||||||
import 'package:tasktracker/main.dart';
|
import 'package:tasktracker/main.dart';
|
||||||
|
import 'package:tasktracker/newActivity.dart';
|
||||||
import 'Data.dart';
|
import 'Data.dart';
|
||||||
import 'DebugHelper.dart';
|
import 'DebugHelper.dart';
|
||||||
import 'User.dart' as User;
|
import 'User.dart' as User;
|
||||||
@@ -267,8 +268,10 @@ class _TodosPageState extends State<TodosPage> {
|
|||||||
}
|
}
|
||||||
setState(() {});
|
setState(() {});
|
||||||
} else {
|
} else {
|
||||||
|
Navigator.of(context).push(MaterialPageRoute(builder: (context)=> NewActivity(selectedTask: TaskType.getDisplayName(todo.task!), metadata: todo.metadata ,)));
|
||||||
|
setState(() {
|
||||||
|
|
||||||
setState(() {});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLongPress: () {
|
onLongPress: () {
|
||||||
@@ -380,6 +383,9 @@ class _TodosPageState extends State<TodosPage> {
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onClickTodo(Todo todo){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void deleteTodos() async{
|
void deleteTodos() async{
|
||||||
if(selectedProjects.length > 0){
|
if(selectedProjects.length > 0){
|
||||||
|
|||||||
@@ -143,12 +143,19 @@ Future<void> refreshUserData({bool forceOffline = false}) async {
|
|||||||
|
|
||||||
refreshStream.add(false);
|
refreshStream.add(false);
|
||||||
} else {
|
} else {
|
||||||
|
Debug.LogTest('updating cats ${DateTime.now()}');
|
||||||
categories = await GetCategories(false);
|
categories = await GetCategories(false);
|
||||||
|
Debug.LogTest('updating projs ${DateTime.now()}');
|
||||||
projects = await GetProjects(false);
|
projects = await GetProjects(false);
|
||||||
|
Debug.LogTest('updating tasks ${DateTime.now()}');
|
||||||
taskTypes = await GetTaskTypes(false);
|
taskTypes = await GetTaskTypes(false);
|
||||||
|
Debug.LogTest('updating acts ${DateTime.now()}');
|
||||||
activities = await GetActivities(false);
|
activities = await GetActivities(false);
|
||||||
|
Debug.LogTest('updating journals ${DateTime.now()}');
|
||||||
journal = await GetJournals(false);
|
journal = await GetJournals(false);
|
||||||
|
Debug.LogTest('updating todos ${DateTime.now()}');
|
||||||
todos= await GetTodos(false);
|
todos= await GetTodos(false);
|
||||||
|
Debug.LogTest('done refreshing ${DateTime.now()}');
|
||||||
}
|
}
|
||||||
|
|
||||||
m_refreshing = false;
|
m_refreshing = false;
|
||||||
|
|||||||
@@ -152,6 +152,8 @@ List<CatMapData> dailyData = <CatMapData>[
|
|||||||
|
|
||||||
List<CatMapData> hourglassCatData = <CatMapData>[];
|
List<CatMapData> hourglassCatData = <CatMapData>[];
|
||||||
|
|
||||||
|
List<Todo> relativeTodos = [];
|
||||||
|
|
||||||
class MyHomePage extends StatefulWidget {
|
class MyHomePage extends StatefulWidget {
|
||||||
const MyHomePage({Key? key}) : super(key: key);
|
const MyHomePage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@@ -293,6 +295,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool loadingStats = false;
|
bool loadingStats = false;
|
||||||
|
|
||||||
DateFormat dFormat = DateFormat("yyyy-MM-dd");
|
DateFormat dFormat = DateFormat("yyyy-MM-dd");
|
||||||
void LoadStats() async {
|
void LoadStats() async {
|
||||||
// return;
|
// return;
|
||||||
@@ -482,6 +485,22 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
catsData.add(CatMapData(key.name, value, barCol));
|
catsData.add(CatMapData(key.name, value, barCol));
|
||||||
});
|
});
|
||||||
catsData.sort((a, b) => a.time.compareTo(b.time));
|
catsData.sort((a, b) => a.time.compareTo(b.time));
|
||||||
|
|
||||||
|
|
||||||
|
//relative TOdos
|
||||||
|
List<String> relativeTodoDays = [];
|
||||||
|
relativeTodos=[];
|
||||||
|
for(int i =0; i < 2; i++){
|
||||||
|
relativeTodoDays.add(dFormat.format(DateTime.now().add(Duration(days: i))));
|
||||||
|
}
|
||||||
|
|
||||||
|
User.todos.forEach((element) {
|
||||||
|
if(relativeTodoDays.contains(dFormat.format(element.dueDate))){
|
||||||
|
//Suitaable
|
||||||
|
relativeTodos.add(element);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//curDay = days[0];
|
//curDay = days[0];
|
||||||
if (this.mounted) {
|
if (this.mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@@ -642,6 +661,68 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
child: Card(
|
||||||
|
color: Colors.white10,
|
||||||
|
elevation: 20,
|
||||||
|
shadowColor: Colors.black,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text('Close To-Do',style: TextStyle(fontSize: 16)),
|
||||||
|
MaterialButton(height: 30,
|
||||||
|
color: Colors.green,
|
||||||
|
onPressed: (){
|
||||||
|
Navigator.of(context).pushNamed('/Todos');
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
Text('More'),
|
||||||
|
Icon(Icons.keyboard_arrow_right)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
LimitedBox(
|
||||||
|
maxHeight: 250,
|
||||||
|
child: ListView.builder(
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: relativeTodos.length,
|
||||||
|
itemBuilder: (context, index){
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsets.all(10),
|
||||||
|
margin: EdgeInsets.symmetric(vertical: 2),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.black26,
|
||||||
|
borderRadius: BorderRadius.circular(10)
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
FittedBox(child: Text('${relativeTodos[index].task!.name} -> ${relativeTodos[index].metadata}')),
|
||||||
|
Container(
|
||||||
|
padding: EdgeInsets.symmetric(horizontal: 5),
|
||||||
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(20), color: Colors.blue),
|
||||||
|
child: Text(DateFormat('MM/dd').format(relativeTodos[index].dueDate))
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
),
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.all(10),
|
padding: EdgeInsets.all(10),
|
||||||
child: Card(
|
child: Card(
|
||||||
|
|||||||
Reference in New Issue
Block a user