144 lines
4.4 KiB
Dart
144 lines
4.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'dart:ui_web' as ui;
|
|
import 'augment.dart';
|
|
// import 'dart:js_interop' as js; //eventually for manipulating css
|
|
import 'collapsableEmails.dart';
|
|
import 'api_service.dart';
|
|
|
|
class EmailView extends StatefulWidget {
|
|
final List<String> emailContent;
|
|
final String from;
|
|
final String name;
|
|
final String to;
|
|
final String subject;
|
|
final String date;
|
|
final String id;
|
|
final List<String> messages;
|
|
|
|
const EmailView({
|
|
Key? key,
|
|
required this.emailContent,
|
|
required this.from,
|
|
required this.name,
|
|
required this.to,
|
|
required this.subject,
|
|
required this.date,
|
|
required this.id,
|
|
required this.messages,
|
|
}) : super(key: key);
|
|
@override
|
|
_EmailViewState createState() => _EmailViewState();
|
|
}
|
|
|
|
class _EmailViewState extends State<EmailView> {
|
|
//html css rendering thing
|
|
late Key iframeKey;
|
|
late String currentContent;
|
|
late String viewTypeId; //make this a list too???
|
|
Future<List<Map<String, dynamic>>>? _markerPositionsFuture;
|
|
// TextEditingController _jumpController = TextEditingController();
|
|
final hardcodedMarkers = [
|
|
{'id': 'marker1', 'x': 50, 'y': 100},
|
|
{'id': 'marker2', 'x': 150, 'y': 200},
|
|
{'id': 'marker3', 'x': 250, 'y': 300},
|
|
];
|
|
String? _targetJumpNumbering;
|
|
String? _targetViewspecs;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
print("thread id? ${widget.id}");
|
|
List<String> currentContent = widget
|
|
.emailContent; //html of the email/ actually entire thread, gives me little space to play in between
|
|
// i wonder if the other attributes change? because if so i have to add like some zooms in and out of the emails, as in collapse
|
|
// _registerViewFactory(currentContent);
|
|
}
|
|
|
|
void _scrollToNumber(String spanId) {
|
|
AugmentClasses.handleJump(spanId);
|
|
}
|
|
|
|
void _handleJumpRequest(String numbering) {
|
|
setState(() {
|
|
_targetJumpNumbering = numbering;
|
|
});
|
|
}
|
|
|
|
void _handleViewspecsRequest(String viewspecsCommand) {
|
|
setState(() {
|
|
_targetViewspecs = viewspecsCommand;
|
|
});
|
|
}
|
|
|
|
// TODO: void _invisibility(String ) //to make purple numbers not visible
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
ApiService.currThreadID = widget.id;
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text(widget.name),
|
|
),
|
|
body: Stack(
|
|
children: [
|
|
Column(
|
|
children: [
|
|
EmailToolbar(
|
|
onJumpToNumbering: _handleJumpRequest,
|
|
onViewspecs: _handleViewspecsRequest,
|
|
onButtonPressed: () => {print("email tool bar pressed")},
|
|
),
|
|
Row(
|
|
// title of email
|
|
children: [
|
|
Text(
|
|
widget.subject,
|
|
style: TextStyle(fontSize: 30),
|
|
),
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
Text(
|
|
'from ${widget.name}',
|
|
style: TextStyle(fontSize: 18),
|
|
),
|
|
Text(
|
|
'<${widget.from}>',
|
|
style: TextStyle(fontSize: 18),
|
|
),
|
|
Spacer(),
|
|
Text(
|
|
'${widget.date}',
|
|
textAlign: TextAlign.right,
|
|
)
|
|
],
|
|
),
|
|
// TODO: make a case where if one of these is the user's email it just says me :)))))
|
|
Row(
|
|
children: [
|
|
Text(
|
|
'to ${widget.to.toString()}',
|
|
style: TextStyle(fontSize: 15),
|
|
)
|
|
],
|
|
),
|
|
Expanded(
|
|
child: CollapsableEmails(
|
|
//change here
|
|
thread: widget.messages, //this wont work in serializable
|
|
// threadHTML: widget.emailContent, // old html
|
|
threadMarkdown: widget.emailContent,
|
|
threadIDs: widget.id,
|
|
targetJumpNumbering: _targetJumpNumbering,
|
|
targetViewspecs: _targetViewspecs,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
));
|
|
}
|
|
}
|