filtering finished, with zooming out and in
This commit is contained in:
parent
072f8274c0
commit
80a0c96e0f
@ -205,6 +205,22 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _goToChildrenFiltering(
|
||||||
|
int indexThread, int index, AugmentTree node) async {
|
||||||
|
final target = node;
|
||||||
|
if (target.children.isNotEmpty) {
|
||||||
|
setState(() {
|
||||||
|
currentZoomTree[indexThread] = target;
|
||||||
|
_isFilteringActive = false;
|
||||||
|
});
|
||||||
|
for (var child in target.children) {
|
||||||
|
print(child.data);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
print("This child has no further children.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void _goToParent(int indexThread) async {
|
void _goToParent(int indexThread) async {
|
||||||
if (currentZoomTree[indexThread].parent != null) {
|
if (currentZoomTree[indexThread].parent != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -215,6 +231,16 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _goToParentFiltering(int indexThread, AugmentTree node) async {
|
||||||
|
if (node.parent != null) {
|
||||||
|
setState(() {
|
||||||
|
currentZoomTree[indexThread] = node.parent!;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
print("Already at root.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void _serializableData(String threadID) async {
|
void _serializableData(String threadID) async {
|
||||||
emailsInThread = await ApiService().threadsInSerializable(threadID);
|
emailsInThread = await ApiService().threadsInSerializable(threadID);
|
||||||
print("done thread serializable");
|
print("done thread serializable");
|
||||||
@ -229,9 +255,8 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
|
|||||||
if (!_isLoaded) {
|
if (!_isLoaded) {
|
||||||
return const Center(child: CircularProgressIndicator()); // loading screen
|
return const Center(child: CircularProgressIndicator()); // loading screen
|
||||||
}
|
}
|
||||||
// final List<AugmentTree> nodesToDisplay;
|
|
||||||
|
|
||||||
final AugmentTree
|
AugmentTree
|
||||||
currentZoomNodeForThisEmail = //each index is an email in the thread
|
currentZoomNodeForThisEmail = //each index is an email in the thread
|
||||||
currentZoomTree[indexThread];
|
currentZoomTree[indexThread];
|
||||||
print(currentZoomNodeForThisEmail.data);
|
print(currentZoomNodeForThisEmail.data);
|
||||||
@ -250,6 +275,7 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
|
|||||||
itemCount: queryResults.length,
|
itemCount: queryResults.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
AugmentTree childNode = queryResults[index];
|
AugmentTree childNode = queryResults[index];
|
||||||
|
bool canZoomIn = childNode.children.isNotEmpty;
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||||
child: Material(
|
child: Material(
|
||||||
@ -266,11 +292,19 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
|
|||||||
spacing: 4.0,
|
spacing: 4.0,
|
||||||
children: [
|
children: [
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
onPressed: null,
|
onPressed: () => {
|
||||||
|
setState(() {
|
||||||
|
_goToParentFiltering(indexThread, childNode);
|
||||||
|
_isFilteringActive = false;
|
||||||
|
})
|
||||||
|
},
|
||||||
child: Icon(Icons.north_west_sharp),
|
child: Icon(Icons.north_west_sharp),
|
||||||
),
|
),
|
||||||
OutlinedButton(
|
OutlinedButton(
|
||||||
onPressed: null,
|
onPressed: canZoomIn
|
||||||
|
? () => _goToChildrenFiltering(
|
||||||
|
indexThread, index, childNode)
|
||||||
|
: null,
|
||||||
child: Icon(Icons.south_east_sharp),
|
child: Icon(Icons.south_east_sharp),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -281,8 +315,8 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
|
|||||||
padding: const EdgeInsets.fromLTRB(0, 10, 5, 0),
|
padding: const EdgeInsets.fromLTRB(0, 10, 5, 0),
|
||||||
child: Text(
|
child: Text(
|
||||||
childNode.numbering,
|
childNode.numbering,
|
||||||
style:
|
style: TextStyle(
|
||||||
TextStyle(color: Color(Colors.purple[400]!.value)),
|
color: Color(Colors.purple[400]!.value)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
@ -297,8 +331,8 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
|
|||||||
padding: const EdgeInsets.fromLTRB(5, 10, 5, 0),
|
padding: const EdgeInsets.fromLTRB(5, 10, 5, 0),
|
||||||
child: Text(
|
child: Text(
|
||||||
childNode.numbering,
|
childNode.numbering,
|
||||||
style:
|
style: TextStyle(
|
||||||
TextStyle(color: Color(Colors.purple[400]!.value)),
|
color: Color(Colors.purple[400]!.value)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user