modified for using the markdown
This commit is contained in:
parent
e26146ead2
commit
1fb4cfd64c
@ -3,13 +3,13 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
class CollapsableEmails extends StatefulWidget {
|
class CollapsableEmails extends StatefulWidget {
|
||||||
final List<String> thread; // email id's in the form xyz@gmail.com
|
final List<String> thread; // email id's in the form xyz@gmail.com
|
||||||
final List<String> threadHTML;
|
final List<String> threadMarkdown;
|
||||||
final String threadIDs;
|
final String threadIDs;
|
||||||
|
|
||||||
CollapsableEmails(
|
CollapsableEmails(
|
||||||
{required this.thread,
|
{required this.thread,
|
||||||
required this.threadHTML,
|
required this.threadMarkdown,
|
||||||
required this.threadIDs});
|
required this.threadIDs, String? targetJumpNumbering, String? targetViewspecs});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<CollapsableEmails> createState() => _CollapsableEmailsState();
|
State<CollapsableEmails> createState() => _CollapsableEmailsState();
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:english_words/english_words.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'api_service.dart';
|
import 'api_service.dart';
|
||||||
import 'structs.dart';
|
import 'structs.dart';
|
||||||
@ -7,14 +8,16 @@ import 'package:markdown/markdown.dart' as md;
|
|||||||
|
|
||||||
class CollapsableEmails extends StatefulWidget {
|
class CollapsableEmails extends StatefulWidget {
|
||||||
final List<String> thread; // email id's in the form xyz@gmail.com
|
final List<String> thread; // email id's in the form xyz@gmail.com
|
||||||
final List<String> threadHTML;
|
// final List<String> threadHTML; to be replaced with the MD
|
||||||
|
final List<String> threadMarkdown;
|
||||||
final String threadIDs;
|
final String threadIDs;
|
||||||
final String? targetJumpNumbering;
|
final String? targetJumpNumbering;
|
||||||
final String? targetViewspecs;
|
final String? targetViewspecs;
|
||||||
|
|
||||||
const CollapsableEmails({
|
const CollapsableEmails({
|
||||||
required this.thread,
|
required this.thread,
|
||||||
required this.threadHTML,
|
// required this.threadHTML,
|
||||||
|
required this.threadMarkdown,
|
||||||
required this.threadIDs,
|
required this.threadIDs,
|
||||||
this.targetJumpNumbering,
|
this.targetJumpNumbering,
|
||||||
this.targetViewspecs,
|
this.targetViewspecs,
|
||||||
@ -63,9 +66,9 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
threadNodes = [];
|
threadNodes = [];
|
||||||
currentZoomTree = [];
|
currentZoomTree = [];
|
||||||
_markdownConverter();
|
// _markdownConverter();
|
||||||
_serializableData(widget.threadIDs); // this
|
_serializableData(widget.threadIDs); // this
|
||||||
_markdown2Tree(allMarkdown);
|
_markdown2Tree(widget.threadMarkdown);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -87,12 +90,16 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
|
|||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
void _markdownConverter() async {
|
// void _markdownConverter() async {
|
||||||
for (int email = 0; email < widget.threadHTML.length; email++) {
|
// // to list of markdown
|
||||||
String markdown = html2md.convert(widget.threadHTML[email]);
|
// // for (int email = 0; email < widget.threadHTML.length; email++) {
|
||||||
allMarkdown.add(markdown);
|
// // String markdown = html2md.convert(widget.threadHTML[email]);
|
||||||
}
|
// // allMarkdown.add(markdown);
|
||||||
}
|
// // }
|
||||||
|
// for (int email = 0; email < widget.threadMarkdown.length; email++) {
|
||||||
|
// allMarkdown.add(email);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
void _add2Tree(AugmentTree tree, md.Element node2add) {
|
void _add2Tree(AugmentTree tree, md.Element node2add) {
|
||||||
// adds node to its corresponding place
|
// adds node to its corresponding place
|
||||||
@ -369,7 +376,7 @@ class _CollapsableEmailsState extends State<CollapsableEmails> {
|
|||||||
rightNumbering = !rightNumbering;
|
rightNumbering = !rightNumbering;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (viewspecsQuery.contrains('w')) {
|
if (viewspecsQuery.contains('w')) {
|
||||||
setState(() {
|
setState(() {
|
||||||
showWhole = true;
|
showWhole = true;
|
||||||
});
|
});
|
||||||
|
@ -140,7 +140,8 @@ class EmailPageState extends State<EmailPage> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: EmailListScreen(
|
body: EmailListScreen(
|
||||||
emails: emails,
|
emails: emails,
|
||||||
getEmailContent: apiService.fetchEmailContent,
|
// getEmailContent: apiService.fetchEmailContent,
|
||||||
|
getEmailContent: apiService.fetchMarkdownContent,
|
||||||
folder: widget.selectedFolder, //try to grab from it directly
|
folder: widget.selectedFolder, //try to grab from it directly
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -128,7 +128,8 @@ class _EmailViewState extends State<EmailView> {
|
|||||||
child: CollapsableEmails(
|
child: CollapsableEmails(
|
||||||
//change here
|
//change here
|
||||||
thread: widget.messages, //this wont work in serializable
|
thread: widget.messages, //this wont work in serializable
|
||||||
threadHTML: widget.emailContent,
|
// threadHTML: widget.emailContent, // old html
|
||||||
|
threadMarkdown: widget.emailContent,
|
||||||
threadIDs: widget.id,
|
threadIDs: widget.id,
|
||||||
targetJumpNumbering: _targetJumpNumbering,
|
targetJumpNumbering: _targetJumpNumbering,
|
||||||
targetViewspecs: _targetViewspecs,
|
targetViewspecs: _targetViewspecs,
|
||||||
|
Loading…
Reference in New Issue
Block a user