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