android/ios-adaption feature, markdown, and augment #6
					 1 changed files with 15 additions and 84 deletions
				
			
		| 
						 | 
					@ -1,9 +1,6 @@
 | 
				
			||||||
import 'dart:collection';
 | 
					 | 
				
			||||||
import 'dart:js_interop';
 | 
					import 'dart:js_interop';
 | 
				
			||||||
import 'dart:js_interop_unsafe';
 | 
					 | 
				
			||||||
import 'package:web/web.dart' as web;
 | 
					import 'package:web/web.dart' as web;
 | 
				
			||||||
import 'package:flutter/material.dart';
 | 
					import 'package:flutter/material.dart';
 | 
				
			||||||
import 'dart:ui_web' as ui;
 | 
					 | 
				
			||||||
import 'api_service.dart';
 | 
					import 'api_service.dart';
 | 
				
			||||||
import 'structs.dart';
 | 
					import 'structs.dart';
 | 
				
			||||||
import 'package:html2md/html2md.dart' as html2md;
 | 
					import 'package:html2md/html2md.dart' as html2md;
 | 
				
			||||||
| 
						 | 
					@ -117,13 +114,6 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
 | 
				
			||||||
          newNode.parent = tree;
 | 
					          newNode.parent = tree;
 | 
				
			||||||
          tree.children.add(newNode);
 | 
					          tree.children.add(newNode);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        // } else{ // so the node should go high
 | 
					 | 
				
			||||||
        //   _add2Tree(tree.children.last, node2add);
 | 
					 | 
				
			||||||
        // }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        //maybe?
 | 
					 | 
				
			||||||
        // } else {
 | 
					 | 
				
			||||||
        // }
 | 
					 | 
				
			||||||
      } else if ((hirarchyDict[node2add.tag] ??
 | 
					      } else if ((hirarchyDict[node2add.tag] ??
 | 
				
			||||||
              -1) > // go down e.g. new node is h3 and old is h2 or something
 | 
					              -1) > // go down e.g. new node is h3 and old is h2 or something
 | 
				
			||||||
          (hirarchyDict[tree.children.last.ogTag] ?? -1)) {
 | 
					          (hirarchyDict[tree.children.last.ogTag] ?? -1)) {
 | 
				
			||||||
| 
						 | 
					@ -135,8 +125,6 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
 | 
				
			||||||
          return;
 | 
					          return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // print("> ${node2add.tag}");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        _add2Tree(tree.children.last, node2add);
 | 
					        _add2Tree(tree.children.last, node2add);
 | 
				
			||||||
      } else if ((hirarchyDict[node2add.tag] ?? -1) ==
 | 
					      } else if ((hirarchyDict[node2add.tag] ?? -1) ==
 | 
				
			||||||
          (hirarchyDict[tree.children.last.ogTag] ?? -1)) {
 | 
					          (hirarchyDict[tree.children.last.ogTag] ?? -1)) {
 | 
				
			||||||
| 
						 | 
					@ -194,32 +182,6 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    this.sentinel = [h1List, h2List, h3List, h4List, h5List, h6List, pList];
 | 
					    this.sentinel = [h1List, h2List, h3List, h4List, h5List, h6List, pList];
 | 
				
			||||||
    sentinel.removeWhere((hList) => hList.isEmpty);
 | 
					    sentinel.removeWhere((hList) => hList.isEmpty);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    // print('algorithm adding: ');
 | 
					 | 
				
			||||||
    // print("first layer: ${zoomTreeRoot.children}");
 | 
					 | 
				
			||||||
    // print("first node: ${zoomTreeRoot.children[0].data}"); //good
 | 
					 | 
				
			||||||
    // print("second layer: ${zoomTreeRoot.children.last.children}"); //good
 | 
					 | 
				
			||||||
    // print(
 | 
					 | 
				
			||||||
    //     "first node: ${zoomTreeRoot.children.last.children.first.data}"); //good
 | 
					 | 
				
			||||||
    // for (int n = 1; n < zoomTreeRoot.children.last.children.length - 1; n++) {
 | 
					 | 
				
			||||||
    //   //good
 | 
					 | 
				
			||||||
    //   print(zoomTreeRoot.children.last.children[n].data);
 | 
					 | 
				
			||||||
    // }
 | 
					 | 
				
			||||||
    // print("last node: ${zoomTreeRoot.children.last.children.last.data}"); //good
 | 
					 | 
				
			||||||
    // print("third layer");
 | 
					 | 
				
			||||||
    // for (int thirdLayer = 0;
 | 
					 | 
				
			||||||
    //     thirdLayer < zoomTreeRoot.children.last.children.length;
 | 
					 | 
				
			||||||
    //     thirdLayer++) {
 | 
					 | 
				
			||||||
    //   print(zoomTreeRoot.children.last.children[thirdLayer].children);
 | 
					 | 
				
			||||||
    // }
 | 
					 | 
				
			||||||
    // print("third layer contents first"); //not sure
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // print(zoomTreeRoot.children.last.children[5].children[0].data); //good
 | 
					 | 
				
			||||||
    // for (int contentsOf4 = 1;
 | 
					 | 
				
			||||||
    //     contentsOf4 < zoomTreeRoot.children.last.children[5].children.length;
 | 
					 | 
				
			||||||
    //     contentsOf4++) {
 | 
					 | 
				
			||||||
    //   print(zoomTreeRoot.children.last.children[5].children[contentsOf4].data);
 | 
					 | 
				
			||||||
    // }
 | 
					 | 
				
			||||||
    currentZoomNode = zoomTreeRoot;
 | 
					    currentZoomNode = zoomTreeRoot;
 | 
				
			||||||
    if (!mounted) return;
 | 
					    if (!mounted) return;
 | 
				
			||||||
    setState(() {
 | 
					    setState(() {
 | 
				
			||||||
| 
						 | 
					@ -253,50 +215,16 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
      print("This child has no further children.");
 | 
					      print("This child has no further children.");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    // if (currentZoomNode.children.isNotEmpty) {
 | 
					 | 
				
			||||||
    //   setState(() {
 | 
					 | 
				
			||||||
    //     zoomIn = true;
 | 
					 | 
				
			||||||
    //     zoomOut = true;
 | 
					 | 
				
			||||||
    //     currentZoomNode = currentZoomNode.children[index];
 | 
					 | 
				
			||||||
    //     if (currentZoomNode.children[index].children.isEmpty) {
 | 
					 | 
				
			||||||
    //       print('disable in');
 | 
					 | 
				
			||||||
    //       setState(() {
 | 
					 | 
				
			||||||
    //         zoomIn = false;
 | 
					 | 
				
			||||||
    //       });
 | 
					 | 
				
			||||||
    //     }
 | 
					 | 
				
			||||||
    //   });
 | 
					 | 
				
			||||||
    // } else {
 | 
					 | 
				
			||||||
    //   print("disable zoom down");
 | 
					 | 
				
			||||||
    //   setState(() {
 | 
					 | 
				
			||||||
    //     zoomIn = false;
 | 
					 | 
				
			||||||
    //   });
 | 
					 | 
				
			||||||
    // }
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void _goToParent() async {
 | 
					  void _goToParent() async {
 | 
				
			||||||
     if (currentZoomNode.parent != null) {
 | 
					    if (currentZoomNode.parent != null) {
 | 
				
			||||||
    setState(() {
 | 
					      setState(() {
 | 
				
			||||||
      currentZoomNode = currentZoomNode.parent!;
 | 
					        currentZoomNode = currentZoomNode.parent!;
 | 
				
			||||||
    });
 | 
					      });
 | 
				
			||||||
  } else {
 | 
					    } else {
 | 
				
			||||||
    print("Already at root.");
 | 
					      print("Already at root.");
 | 
				
			||||||
  }
 | 
					    }
 | 
				
			||||||
 | 
					 | 
				
			||||||
    // print("parent ${currentZoomNode.parent}");
 | 
					 | 
				
			||||||
    // print("parent ${currentZoomNode.parent!.parent}");
 | 
					 | 
				
			||||||
    // if (currentZoomNode.parent != null) {
 | 
					 | 
				
			||||||
    //   setState(() {
 | 
					 | 
				
			||||||
    //     currentZoomNode = currentZoomNode.parent!;
 | 
					 | 
				
			||||||
    //     if (currentZoomNode.parent == null) {
 | 
					 | 
				
			||||||
    //       setState(() {
 | 
					 | 
				
			||||||
    //         zoomOut = false;
 | 
					 | 
				
			||||||
    //       });
 | 
					 | 
				
			||||||
    //     }
 | 
					 | 
				
			||||||
    //   });
 | 
					 | 
				
			||||||
    // } else if (currentZoomNode.parent == null ||
 | 
					 | 
				
			||||||
    //     currentZoomNode.parent!.parent == null) {
 | 
					 | 
				
			||||||
    //   print("disable zoom up");
 | 
					 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void _serializableData(String threadID) async {
 | 
					  void _serializableData(String threadID) async {
 | 
				
			||||||
| 
						 | 
					@ -449,16 +377,19 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
 | 
				
			||||||
                        },
 | 
					                        },
 | 
				
			||||||
                      ),
 | 
					                      ),
 | 
				
			||||||
                      if (isExpanded)
 | 
					                      if (isExpanded)
 | 
				
			||||||
                        SizedBox(
 | 
					                        ConstrainedBox(
 | 
				
			||||||
                            height: 800,
 | 
					                          constraints: BoxConstraints(
 | 
				
			||||||
                            child:
 | 
					                            minHeight: 100,
 | 
				
			||||||
                                _buildForZooms(key: ValueKey(currentZoomNode))),
 | 
					                            maxHeight: MediaQuery.of(context).size.height * 0.6,
 | 
				
			||||||
 | 
					                          ),
 | 
				
			||||||
 | 
					                          child: _buildForZooms(key: ValueKey(currentZoomNode)),
 | 
				
			||||||
 | 
					                        ),
 | 
				
			||||||
                      Divider(),
 | 
					                      Divider(),
 | 
				
			||||||
                    ],
 | 
					                    ],
 | 
				
			||||||
                  );
 | 
					                  );
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
              ),
 | 
					              ),
 | 
				
			||||||
            )
 | 
					            ),
 | 
				
			||||||
          ])
 | 
					          ])
 | 
				
			||||||
        : const Center(child: CircularProgressIndicator());
 | 
					        : const Center(child: CircularProgressIndicator());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue