mirror of
https://github.com/go-vikunja/app
synced 2024-06-06 04:29:47 +00:00
added subproject view to project home page
This commit is contained in:
parent
1c523d929c
commit
7c7d6be9df
|
@ -7,6 +7,7 @@ class Project {
|
||||||
final String description;
|
final String description;
|
||||||
final String title;
|
final String title;
|
||||||
final DateTime created, updated;
|
final DateTime created, updated;
|
||||||
|
Iterable<Project>? subprojects;
|
||||||
|
|
||||||
Project(
|
Project(
|
||||||
{this.id = 0,
|
{this.id = 0,
|
||||||
|
|
|
@ -56,7 +56,7 @@ class _ProjectOverviewPageState extends State<ProjectOverviewPage>
|
||||||
ListTile(
|
ListTile(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
_onSelectItem(project);
|
onSelectProject(context, project);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
contentPadding: insets,
|
contentPadding: insets,
|
||||||
|
@ -83,6 +83,7 @@ class _ProjectOverviewPageState extends State<ProjectOverviewPage>
|
||||||
List<Widget> addProjectChildren(Project project, level) {
|
List<Widget> addProjectChildren(Project project, level) {
|
||||||
Iterable<Project> children =
|
Iterable<Project> children =
|
||||||
_projects.where((element) => element.parentProjectId == project.id);
|
_projects.where((element) => element.parentProjectId == project.id);
|
||||||
|
project.subprojects = children;
|
||||||
List<Widget> widgets = [];
|
List<Widget> widgets = [];
|
||||||
children.forEach((element) {
|
children.forEach((element) {
|
||||||
widgets.add(createProjectTile(element, level + 1));
|
widgets.add(createProjectTile(element, level + 1));
|
||||||
|
@ -139,16 +140,7 @@ class _ProjectOverviewPageState extends State<ProjectOverviewPage>
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_onSelectItem(Project project) {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (buildContext) => ProjectPage(
|
|
||||||
project: project,
|
|
||||||
),
|
|
||||||
));
|
|
||||||
//setState(() => _selectedDrawerIndex = index);
|
|
||||||
}
|
|
||||||
|
|
||||||
_addProjectDialog(BuildContext context) {
|
_addProjectDialog(BuildContext context) {
|
||||||
showDialog(
|
showDialog(
|
||||||
|
|
|
@ -16,7 +16,49 @@ class ProjectPage extends StatefulWidget {
|
||||||
class _ProjectPageState extends State<ProjectPage> {
|
class _ProjectPageState extends State<ProjectPage> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(body: Text(widget.project.title),);
|
return Scaffold(
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
buildSubProjectSelector(),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(widget.project.title),
|
||||||
|
),);
|
||||||
}
|
}
|
||||||
|
Widget buildSubProjectSelector() {
|
||||||
|
return Container(
|
||||||
|
height: 80,
|
||||||
|
child:
|
||||||
|
ListView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
//mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
|
children: [
|
||||||
|
...?widget.project.subprojects?.map((elem) =>
|
||||||
|
InkWell(
|
||||||
|
onTap: () {onSelectProject(context, elem);},
|
||||||
|
child:
|
||||||
|
Container(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
height: 20,
|
||||||
|
width: 100,
|
||||||
|
child:
|
||||||
|
Text(elem.title, overflow: TextOverflow.ellipsis,softWrap: false,)))
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
onSelectProject(BuildContext context, Project project) {
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
MaterialPageRoute(
|
||||||
|
builder: (buildContext) => ProjectPage(
|
||||||
|
project: project,
|
||||||
|
),
|
||||||
|
));
|
||||||
|
//setState(() => _selectedDrawerIndex = index);
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user