mirror of
https://github.com/go-vikunja/app
synced 2024-06-01 02:06:51 +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 title;
|
||||
final DateTime created, updated;
|
||||
Iterable<Project>? subprojects;
|
||||
|
||||
Project(
|
||||
{this.id = 0,
|
||||
|
|
|
@ -56,7 +56,7 @@ class _ProjectOverviewPageState extends State<ProjectOverviewPage>
|
|||
ListTile(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_onSelectItem(project);
|
||||
onSelectProject(context, project);
|
||||
});
|
||||
},
|
||||
contentPadding: insets,
|
||||
|
@ -83,6 +83,7 @@ class _ProjectOverviewPageState extends State<ProjectOverviewPage>
|
|||
List<Widget> addProjectChildren(Project project, level) {
|
||||
Iterable<Project> children =
|
||||
_projects.where((element) => element.parentProjectId == project.id);
|
||||
project.subprojects = children;
|
||||
List<Widget> widgets = [];
|
||||
children.forEach((element) {
|
||||
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) {
|
||||
showDialog(
|
||||
|
|
|
@ -16,7 +16,49 @@ class ProjectPage extends StatefulWidget {
|
|||
class _ProjectPageState extends State<ProjectPage> {
|
||||
@override
|
||||
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