android/ios-adaption feature, markdown, and augment #6
					 1 changed files with 65 additions and 65 deletions
				
			
		| 
						 | 
				
			
			@ -229,6 +229,7 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
 | 
			
		|||
    if (!_isLoaded) {
 | 
			
		||||
      return const Center(child: CircularProgressIndicator()); // loading screen
 | 
			
		||||
    }
 | 
			
		||||
    // final List<AugmentTree> nodesToDisplay;
 | 
			
		||||
 | 
			
		||||
    final AugmentTree
 | 
			
		||||
        currentZoomNodeForThisEmail = //each index is an email in the thread
 | 
			
		||||
| 
						 | 
				
			
			@ -237,77 +238,75 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
 | 
			
		|||
    print(currentZoomNodeForThisEmail.children);
 | 
			
		||||
    print(currentZoomNodeForThisEmail.parent);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // if (_isFilteringActive) {
 | 
			
		||||
    //   nodesToDisplay = queryResults;
 | 
			
		||||
    // } else {
 | 
			
		||||
    //   nodesToDisplay = currentZoomNodeForThisEmail.children;
 | 
			
		||||
    // }
 | 
			
		||||
    final canZoomOut = currentZoomNodeForThisEmail.parent != null;
 | 
			
		||||
    if (currentZoomNodeForThisEmail.children.isEmpty) {
 | 
			
		||||
 | 
			
		||||
    if (_isFilteringActive) {
 | 
			
		||||
      return ListView.builder(
 | 
			
		||||
      itemCount: 1,
 | 
			
		||||
      itemBuilder: (context, index) {
 | 
			
		||||
        final childNode = currentZoomNodeForThisEmail;
 | 
			
		||||
        // final childNode = currentZoomNodeForThisEmail.children[index];
 | 
			
		||||
        final canZoomIn = childNode.children.isNotEmpty;
 | 
			
		||||
        // currentZoomNodeForThisEmail.addNumbering();
 | 
			
		||||
        return Padding(
 | 
			
		||||
          padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 6.0),
 | 
			
		||||
          child: Material(
 | 
			
		||||
            elevation: 1,
 | 
			
		||||
            borderRadius: BorderRadius.circular(12),
 | 
			
		||||
            color: Theme.of(context).colorScheme.surface,
 | 
			
		||||
            surfaceTintColor: Theme.of(context).colorScheme.surfaceBright,
 | 
			
		||||
            child: Padding(
 | 
			
		||||
              padding: const EdgeInsets.all(16.0),
 | 
			
		||||
              child: Row(
 | 
			
		||||
                crossAxisAlignment: CrossAxisAlignment.start,
 | 
			
		||||
                children: [
 | 
			
		||||
                  Wrap(
 | 
			
		||||
                    spacing: 4.0,
 | 
			
		||||
          itemCount: queryResults.length,
 | 
			
		||||
          itemBuilder: (context, index) {
 | 
			
		||||
            AugmentTree childNode = queryResults[index];
 | 
			
		||||
            return Padding(
 | 
			
		||||
              padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
 | 
			
		||||
              child: Material(
 | 
			
		||||
                elevation: 1,
 | 
			
		||||
                borderRadius: BorderRadius.circular(12),
 | 
			
		||||
                color: Theme.of(context).colorScheme.surface,
 | 
			
		||||
                surfaceTintColor: Theme.of(context).colorScheme.surfaceBright,
 | 
			
		||||
                child: Padding(
 | 
			
		||||
                  padding: const EdgeInsets.all(16.0),
 | 
			
		||||
                  child: Row(
 | 
			
		||||
                    crossAxisAlignment: CrossAxisAlignment.start,
 | 
			
		||||
                    children: [
 | 
			
		||||
                      OutlinedButton(
 | 
			
		||||
                        onPressed:
 | 
			
		||||
                            canZoomOut ? () => _goToParent(indexThread) : null,
 | 
			
		||||
                        child: Icon(Icons.north_west_sharp),
 | 
			
		||||
                      Wrap(
 | 
			
		||||
                        spacing: 4.0,
 | 
			
		||||
                        children: [
 | 
			
		||||
                          OutlinedButton(
 | 
			
		||||
                            onPressed: null,
 | 
			
		||||
                            child: Icon(Icons.north_west_sharp),
 | 
			
		||||
                          ),
 | 
			
		||||
                          OutlinedButton(
 | 
			
		||||
                            onPressed: null,
 | 
			
		||||
                            child: Icon(Icons.south_east_sharp),
 | 
			
		||||
                          ),
 | 
			
		||||
                        ],
 | 
			
		||||
                      ),
 | 
			
		||||
                      OutlinedButton(
 | 
			
		||||
                        onPressed: canZoomIn
 | 
			
		||||
                            ? () => _goToChildren(indexThread, index)
 | 
			
		||||
                            : null,
 | 
			
		||||
                        child: Icon(Icons.south_east_sharp),
 | 
			
		||||
                      SizedBox(width: 12.0),
 | 
			
		||||
                      if (leftNumbering)
 | 
			
		||||
                        Padding(
 | 
			
		||||
                          padding: const EdgeInsets.fromLTRB(0, 10, 5, 0),
 | 
			
		||||
                          child: Text(
 | 
			
		||||
                            childNode.numbering,
 | 
			
		||||
                            style:
 | 
			
		||||
                                TextStyle(color: Color(Colors.purple[400]!.value)),
 | 
			
		||||
                          ),
 | 
			
		||||
                        ),
 | 
			
		||||
                      Expanded(
 | 
			
		||||
                        child: MarkdownBlock(
 | 
			
		||||
                          data: childNode.data,
 | 
			
		||||
                          config: MarkdownConfig
 | 
			
		||||
                              .darkConfig, // or lightConfig depending on theme
 | 
			
		||||
                        ),
 | 
			
		||||
                      ),
 | 
			
		||||
                      if (rightNumbering)
 | 
			
		||||
                        Padding(
 | 
			
		||||
                          padding: const EdgeInsets.fromLTRB(5, 10, 5, 0),
 | 
			
		||||
                          child: Text(
 | 
			
		||||
                            childNode.numbering,
 | 
			
		||||
                            style:
 | 
			
		||||
                                TextStyle(color: Color(Colors.purple[400]!.value)),
 | 
			
		||||
                          ),
 | 
			
		||||
                        ),
 | 
			
		||||
                    ],
 | 
			
		||||
                  ),
 | 
			
		||||
                  SizedBox(width: 12.0),
 | 
			
		||||
                  if (leftNumbering)
 | 
			
		||||
                    Padding(
 | 
			
		||||
                      padding: const EdgeInsets.fromLTRB(0, 10, 5, 0),
 | 
			
		||||
                      child: Text(
 | 
			
		||||
                        childNode.numbering,
 | 
			
		||||
                        style:
 | 
			
		||||
                            TextStyle(color: Color(Colors.purple[400]!.value)),
 | 
			
		||||
                      ),
 | 
			
		||||
                    ),
 | 
			
		||||
                  Expanded(
 | 
			
		||||
                    child: MarkdownBlock(
 | 
			
		||||
                      data: childNode.data,
 | 
			
		||||
                      config: MarkdownConfig
 | 
			
		||||
                          .darkConfig, // or lightConfig depending on theme
 | 
			
		||||
                    ),
 | 
			
		||||
                  ),
 | 
			
		||||
                  if (rightNumbering)
 | 
			
		||||
                    Padding(
 | 
			
		||||
                      padding: const EdgeInsets.fromLTRB(5, 10, 5, 0),
 | 
			
		||||
                      child: Text(
 | 
			
		||||
                        childNode.numbering,
 | 
			
		||||
                        style:
 | 
			
		||||
                            TextStyle(color: Color(Colors.purple[400]!.value)),
 | 
			
		||||
                      ),
 | 
			
		||||
                    ),
 | 
			
		||||
                ],
 | 
			
		||||
                ),
 | 
			
		||||
              ),
 | 
			
		||||
            ),
 | 
			
		||||
          ),
 | 
			
		||||
        );
 | 
			
		||||
      },
 | 
			
		||||
    );
 | 
			
		||||
            );
 | 
			
		||||
          });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return ListView.builder(
 | 
			
		||||
| 
						 | 
				
			
			@ -315,7 +314,6 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
 | 
			
		|||
      itemBuilder: (context, index) {
 | 
			
		||||
        final childNode = currentZoomNodeForThisEmail.children[index];
 | 
			
		||||
        final canZoomIn = childNode.children.isNotEmpty;
 | 
			
		||||
        // currentZoomNodeForThisEmail.addNumbering();
 | 
			
		||||
        return Padding(
 | 
			
		||||
          padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 6.0),
 | 
			
		||||
          child: Material(
 | 
			
		||||
| 
						 | 
				
			
			@ -479,8 +477,10 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
 | 
			
		|||
    }
 | 
			
		||||
    if (results.isNotEmpty) {
 | 
			
		||||
      setState(() {
 | 
			
		||||
        currentZoomTree[targetEmailIndex] = results.first; // Update the state
 | 
			
		||||
        queryResults = results;
 | 
			
		||||
        // currentZoomTree[targetEmailIndex] = results.first; // Update the state
 | 
			
		||||
        _isFilteringActive = true;
 | 
			
		||||
        currentZoomTree[targetEmailIndex] = root;
 | 
			
		||||
      });
 | 
			
		||||
      print(currentZoomTree);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue