Project section started

This commit is contained in:
Sewmina
2022-03-24 21:20:35 +05:30
parent 3f8ae3f5f5
commit ac9609b3b6
4 changed files with 67 additions and 46 deletions

View File

@@ -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{

View File

@@ -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>(

View File

@@ -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,6 +115,9 @@ class _ProjectsState extends State<Projects> {
children:[ children:[
Expanded( Expanded(
child: Card( child: Card(
child:AnimatedContainer(
duration: const Duration(milliseconds: 200),
height: 100,
child: InkWell( child: InkWell(
onLongPress: (){ onLongPress: (){
Dialogs.showProjectDetails(project); Dialogs.showProjectDetails(project);
@@ -145,6 +163,7 @@ class _ProjectsState extends State<Projects> {
], ],
), ),
), ),
),
) )
) )
) )

View File

@@ -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);