Project section started
This commit is contained in:
@@ -118,6 +118,7 @@ class Project{
|
|||||||
static String colCat="category_id";
|
static String colCat="category_id";
|
||||||
static String colSteps = "steps";
|
static String colSteps = "steps";
|
||||||
static String colDeadline = "deadline";
|
static String colDeadline = "deadline";
|
||||||
|
static String colEta = "eta";
|
||||||
}
|
}
|
||||||
|
|
||||||
class ProjectStep{
|
class ProjectStep{
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class _NewTaskState extends State<NewTask> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
List<String> cats = getCategoryNames();
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: Text('New Task Type')),
|
appBar: AppBar(title: Text('New Task Type')),
|
||||||
body: Container(
|
body: Container(
|
||||||
@@ -77,7 +78,7 @@ class _NewTaskState extends State<NewTask> {
|
|||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
value: selectedCat,
|
value: selectedCat,
|
||||||
isExpanded: true,
|
isExpanded: true,
|
||||||
items: getCategoryNames().map<DropdownMenuItem<String>>(
|
items: cats.map<DropdownMenuItem<String>>(
|
||||||
(String value) {
|
(String value) {
|
||||||
|
|
||||||
return DropdownMenuItem<String>(
|
return DropdownMenuItem<String>(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:tasktracker/Data.dart';
|
import 'package:tasktracker/Data.dart';
|
||||||
import 'package:tasktracker/NewProject.dart';
|
import 'package:tasktracker/NewProject.dart';
|
||||||
@@ -30,7 +31,7 @@ class _ProjectsState extends State<Projects> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
refreshSub?.close();
|
refreshSub?.close();
|
||||||
}
|
}
|
||||||
|
int selectedPage = 0;
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SafeArea(child: Scaffold(
|
return SafeArea(child: Scaffold(
|
||||||
@@ -40,6 +41,18 @@ class _ProjectsState extends State<Projects> {
|
|||||||
},
|
},
|
||||||
label: Text("New Project"),
|
label: Text("New Project"),
|
||||||
icon: Icon(Icons.add)),
|
icon: Icon(Icons.add)),
|
||||||
|
bottomNavigationBar: BottomNavigationBar(
|
||||||
|
items: <BottomNavigationBarItem>[
|
||||||
|
BottomNavigationBarItem(icon: FaIcon(FontAwesomeIcons.newspaper),label:'Summary'),
|
||||||
|
BottomNavigationBarItem(icon: FaIcon(FontAwesomeIcons.info),label:'Details'),
|
||||||
|
],
|
||||||
|
onTap: (val){
|
||||||
|
selectedPage= val;
|
||||||
|
setState(() {
|
||||||
|
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Column(
|
title: Column(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
@@ -72,7 +85,9 @@ class _ProjectsState extends State<Projects> {
|
|||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
drawer: navDrawer(context, 7),
|
drawer: navDrawer(context, 7),
|
||||||
body: Container(
|
body: (selectedPage == 0) ?
|
||||||
|
Container(child:Text('Summary goes here'))
|
||||||
|
:Container(
|
||||||
padding: EdgeInsets.all(10),
|
padding: EdgeInsets.all(10),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: printProjects(),
|
children: printProjects(),
|
||||||
@@ -100,49 +115,53 @@ class _ProjectsState extends State<Projects> {
|
|||||||
children:[
|
children:[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Card(
|
child: Card(
|
||||||
child:InkWell(
|
child:AnimatedContainer(
|
||||||
onLongPress: (){
|
duration: const Duration(milliseconds: 200),
|
||||||
Dialogs.showProjectDetails(project);
|
height: 100,
|
||||||
},
|
child: InkWell(
|
||||||
child: Padding(
|
onLongPress: (){
|
||||||
padding: const EdgeInsets.all(10.0),
|
Dialogs.showProjectDetails(project);
|
||||||
child: Column(
|
},
|
||||||
children: [
|
child: Padding(
|
||||||
Row(
|
padding: const EdgeInsets.all(10.0),
|
||||||
mainAxisSize: MainAxisSize.max,
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
children: [
|
||||||
children: [
|
Row(
|
||||||
Text(project.name ,style: TextStyle(fontSize: 18)),
|
mainAxisSize: MainAxisSize.max,
|
||||||
Container(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
decoration: BoxDecoration(
|
children: [
|
||||||
color: (project.cat!.productive) ?Colors.green : Colors.red,
|
Text(project.name ,style: TextStyle(fontSize: 18)),
|
||||||
borderRadius: BorderRadius.circular(8)
|
Container(
|
||||||
),
|
|
||||||
child:Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2),
|
|
||||||
child: Text(project.cat!.name),
|
|
||||||
))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Divider(),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text("${project.steps.length} steps"),
|
|
||||||
Container(
|
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Colors.redAccent,
|
color: (project.cat!.productive) ?Colors.green : Colors.red,
|
||||||
borderRadius: BorderRadius.circular(8)
|
borderRadius: BorderRadius.circular(8)
|
||||||
),
|
),
|
||||||
child:Padding(
|
child:Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2),
|
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2),
|
||||||
// padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2),
|
child: Text(project.cat!.name),
|
||||||
child: Text(durationToDays(timeLeft)),
|
))
|
||||||
// child: Text("Deadline : " +DateFormat("yyyy-MM-dd").format(project.deadline)),
|
],
|
||||||
))
|
),
|
||||||
],
|
Divider(),
|
||||||
)
|
Row(
|
||||||
],
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text("${project.steps.length} steps"),
|
||||||
|
Container(
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.redAccent,
|
||||||
|
borderRadius: BorderRadius.circular(8)
|
||||||
|
),
|
||||||
|
child:Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2),
|
||||||
|
// padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2),
|
||||||
|
child: Text(durationToDays(timeLeft)),
|
||||||
|
// child: Text("Deadline : " +DateFormat("yyyy-MM-dd").format(project.deadline)),
|
||||||
|
))
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ void onCacheDatabaseCreate(Database db, int newVersion) async {
|
|||||||
await db.execute(ActivityTableSQL);
|
await db.execute(ActivityTableSQL);
|
||||||
|
|
||||||
String ProjectsTableSQL =
|
String ProjectsTableSQL =
|
||||||
'CREATE TABLE Projects(id TEXT PRIMARY KEY, ${Project.colName} TEXT, ${Project.colCat} TEXT, ${Project.colSteps} TEXT, ${Project.colDeadline} DATETIME)';
|
'CREATE TABLE Projects(id TEXT PRIMARY KEY, ${Project.colName} TEXT, ${Project.colCat} TEXT, ${Project.colSteps} TEXT, ${Project.colEta} INT, ${Project.colDeadline} DATETIME)';
|
||||||
await db.execute(ProjectsTableSQL);
|
await db.execute(ProjectsTableSQL);
|
||||||
|
|
||||||
String QueriesTableSQL = 'CREATE TABLE Queries(id INTEGER PRIMARY KEY AUTOINCREMENT, ${Queries.colLink} TEXT,${Queries.colData} TEXT)';
|
String QueriesTableSQL = 'CREATE TABLE Queries(id INTEGER PRIMARY KEY AUTOINCREMENT, ${Queries.colLink} TEXT,${Queries.colData} TEXT)';
|
||||||
@@ -327,7 +327,7 @@ Future<void> UpdateCategoriesFromServer() async {
|
|||||||
|
|
||||||
print(response.body);
|
print(response.body);
|
||||||
List<String> data = response.body.split("<td>");
|
List<String> data = response.body.split("<td>");
|
||||||
// await cacheDb.delete("Categories");
|
await cacheDb.delete("Categories");
|
||||||
for (var value in data) {
|
for (var value in data) {
|
||||||
Map<String, dynamic> cat = jsonDecode(value);
|
Map<String, dynamic> cat = jsonDecode(value);
|
||||||
//print(catData);
|
//print(catData);
|
||||||
|
|||||||
Reference in New Issue
Block a user