Compare commits
No commits in common. "254972d2af90445bbf7a2bc6e2453c14f9f8382b" and "42e31f63c59525378564f823beb29f20673ea7c6" have entirely different histories.
254972d2af
...
42e31f63c5
@ -1,5 +1,3 @@
|
|||||||
import 'package:crab_ui/structs.dart';
|
|
||||||
import 'package:english_words/english_words.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
@ -28,56 +26,57 @@ class MailAddress {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// //data structure
|
//data structure
|
||||||
// class SerializableMessage {
|
class SerializableMessage {
|
||||||
// final String name;
|
final String name;
|
||||||
// final String from;
|
final String from;
|
||||||
// final List<MailAddress> to;
|
final List<MailAddress> to;
|
||||||
// final List<MailAddress> cc;
|
final List<MailAddress> cc;
|
||||||
// final String hash;
|
final String hash;
|
||||||
|
|
||||||
// final String subject;
|
// final String path;
|
||||||
// final String date;
|
final String subject;
|
||||||
// final int uid;
|
final String date;
|
||||||
// final String list;
|
final int uid;
|
||||||
// final String id;
|
final String list;
|
||||||
// final String in_reply_to;
|
final String id;
|
||||||
|
final String in_reply_to;
|
||||||
|
|
||||||
// SerializableMessage({
|
SerializableMessage({
|
||||||
// required this.name,
|
required this.name,
|
||||||
// required this.from,
|
required this.from,
|
||||||
// required this.to,
|
required this.to,
|
||||||
// required this.cc,
|
required this.cc,
|
||||||
// required this.hash,
|
required this.hash,
|
||||||
// required this.subject,
|
required this.subject,
|
||||||
// required this.date,
|
required this.date,
|
||||||
// required this.uid,
|
required this.uid,
|
||||||
// required this.list,
|
required this.list,
|
||||||
// required this.id,
|
required this.id,
|
||||||
// required this.in_reply_to,
|
required this.in_reply_to,
|
||||||
// });
|
});
|
||||||
|
|
||||||
// factory SerializableMessage.fromJson(Map<String, dynamic> json) {
|
factory SerializableMessage.fromJson(Map<String, dynamic> json) {
|
||||||
// var toList = json['to'] as List;
|
var toList = json['to'] as List;
|
||||||
// var ccList = json['cc'] as List;
|
var ccList = json['cc'] as List;
|
||||||
|
|
||||||
// return SerializableMessage(
|
return SerializableMessage(
|
||||||
// name: json['name'],
|
name: json['name'],
|
||||||
// from: json['from'],
|
from: json['from'],
|
||||||
// // to: json['name', 'address']
|
// to: json['name', 'address']
|
||||||
// to: toList.map((i) => MailAddress.fromJson(i)).toList(),
|
to: toList.map((i) => MailAddress.fromJson(i)).toList(),
|
||||||
// cc: ccList.map((i) => MailAddress.fromJson(i)).toList(),
|
cc: ccList.map((i) => MailAddress.fromJson(i)).toList(),
|
||||||
// // path: json['path'],
|
// path: json['path'],
|
||||||
// hash: json['hash'],
|
hash: json['hash'],
|
||||||
// subject: json['subject'],
|
subject: json['subject'],
|
||||||
// date: json['date'],
|
date: json['date'],
|
||||||
// uid: json['uid'],
|
uid: json['uid'],
|
||||||
// list: json['list'],
|
list: json['list'],
|
||||||
// id: json['id'],
|
id: json['id'],
|
||||||
// in_reply_to: json['in_reply_to'],
|
in_reply_to: json['in_reply_to'],
|
||||||
// );
|
);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
class EmailPage extends StatefulWidget {
|
class EmailPage extends StatefulWidget {
|
||||||
const EmailPage({super.key});
|
const EmailPage({super.key});
|
||||||
@ -92,23 +91,31 @@ class _EmailPageState extends State<EmailPage> {
|
|||||||
|
|
||||||
void _displayEmailsFromFolder(String folder) async {
|
void _displayEmailsFromFolder(String folder) async {
|
||||||
// Map<String, List<SerializableMessage>> messagesMap = {};
|
// Map<String, List<SerializableMessage>> messagesMap = {};
|
||||||
List<GetThreadResponse> allEmails = []; //all the emails
|
List<SerializableMessage> allEmails = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var url = Uri.http(
|
var url = Uri.http(
|
||||||
'127.0.0.1:3001', 'sorted_threads_by_date', {'folder': folder});
|
'127.0.0.1:3001', 'sorted_threads_by_date', {'folder': folder});
|
||||||
var response = await http.get(url);
|
var response = await http.get(url);
|
||||||
|
print(response.body);
|
||||||
|
// Map<String, dynamic> json = jsonDecode(response.body); original
|
||||||
|
|
||||||
|
// json.forEach((key, value) {
|
||||||
|
// List<SerializableMessage> messages = (value as List)
|
||||||
|
// .map((item) => SerializableMessage.fromJson(item))
|
||||||
|
// .toList();
|
||||||
|
// messagesMap[key] = messages;
|
||||||
|
// });
|
||||||
|
|
||||||
|
// new shit
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
List json = jsonDecode(response.body);
|
List<dynamic> json = jsonDecode(response.body);
|
||||||
for (var item in json.take(1)) {
|
for (var item in json.take(1)) { //each item in the json is a date
|
||||||
//each item in the json is a date
|
|
||||||
if (item.length > 1 && item[0] is String && item[1] is List) {
|
if (item.length > 1 && item[0] is String && item[1] is List) {
|
||||||
List<int> threadIDs = List<int>.from(item[1]);
|
List<int> threadIDs = List<int>.from(item[1]);
|
||||||
for (var threadId in threadIDs) {
|
for (var threadId in threadIDs) {
|
||||||
// print(threadId);
|
print(threadId);
|
||||||
// await fetchThreadMessages(threadId, allEmails);
|
await fetchThreadMessages(threadId, allEmails);
|
||||||
await fetchThreads(threadId, allEmails);
|
|
||||||
}
|
}
|
||||||
//TODO: get exact thread with new api endpoint from chosen thread?
|
//TODO: get exact thread with new api endpoint from chosen thread?
|
||||||
}
|
}
|
||||||
@ -120,43 +127,30 @@ class _EmailPageState extends State<EmailPage> {
|
|||||||
print('_displayEmailsFromFolder caught error: $e');
|
print('_displayEmailsFromFolder caught error: $e');
|
||||||
}
|
}
|
||||||
print("Done");
|
print("Done");
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
emails = allEmails;
|
emails.clear();
|
||||||
|
// emails = messagesMap.values.toList().expand((list) => list).toList();
|
||||||
|
emails.addAll(allEmails);
|
||||||
|
;
|
||||||
});
|
});
|
||||||
// print(emails[0]);
|
|
||||||
// Print allEmails to debug its structure
|
|
||||||
// print("allEmails: ${allEmails[0].messages}");
|
|
||||||
|
|
||||||
// Convert allEmails to a list
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Future<void> fetchThreads(AboutDialog){
|
||||||
// }
|
// }
|
||||||
|
|
||||||
Future<void> fetchThreads(
|
Future<void> fetchThreadMessages(
|
||||||
//complete
|
int threadId, List<SerializableMessage> allEmails) async {
|
||||||
int threadId,
|
|
||||||
List<GetThreadResponse> allEmails) async {
|
|
||||||
try {
|
try {
|
||||||
var url =
|
var url = Uri.http(
|
||||||
Uri.http('127.0.0.1:3001', 'get_thread', {'id': threadId.toString()});
|
'127.0.0.1:3001', 'get_thread_messages', {'id': threadId.toString()});
|
||||||
var response = await http.get(url);
|
|
||||||
// print(response.body);
|
|
||||||
if (response.statusCode == 200) {
|
|
||||||
Map<String, dynamic> messagesJson = jsonDecode(response.body);
|
|
||||||
// print(messagesJson);
|
|
||||||
// List<String> messagesofThread = messagesJson['messages'];
|
|
||||||
// messagesJson.map((mj) => GetThreadResponse.fromJson(mj)).toList();
|
|
||||||
// List<GetThreadResponse> messages = messagesJson.values.map((mj) {
|
|
||||||
// return GetThreadResponse.fromJson(mj as Map<String, dynamic>);
|
|
||||||
// }).toList();
|
|
||||||
// List<GetThreadResponse> thread =
|
|
||||||
// messagesJson.map((mj) => GetThreadResponse.fromJson(mj)).toList();
|
|
||||||
GetThreadResponse threadResponse =
|
|
||||||
GetThreadResponse.fromJson(messagesJson);
|
|
||||||
|
|
||||||
allEmails.add(
|
var response = await http.get(url);
|
||||||
threadResponse); //adds all the messages of the thread into all emails
|
|
||||||
//perhaps should change
|
if (response.statusCode == 200) {
|
||||||
|
List<dynamic> messagesJson = jsonDecode(response.body);
|
||||||
|
List<SerializableMessage> messages =
|
||||||
|
messagesJson.map((mj) => SerializableMessage.fromJson(mj)).toList();
|
||||||
|
allEmails.addAll(messages);
|
||||||
} else {
|
} else {
|
||||||
throw Exception(
|
throw Exception(
|
||||||
'Failed to fetch thread messages for thread ID: $threadId');
|
'Failed to fetch thread messages for thread ID: $threadId');
|
||||||
@ -166,46 +160,23 @@ class _EmailPageState extends State<EmailPage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Future<void> fetchThreadMessages(
|
Future<String> _getEmailContent(String id) async {
|
||||||
// int threadId, List<SerializableMessage> allEmails) async {
|
|
||||||
// try {
|
|
||||||
// var url = Uri.http(
|
|
||||||
// '127.0.0.1:3001', 'get_thread_messages', {'id': threadId.toString()});
|
|
||||||
|
|
||||||
// var response = await http.get(url);
|
|
||||||
|
|
||||||
// if (response.statusCode == 200) {
|
|
||||||
// List<dynamic> messagesJson = jsonDecode(response.body);
|
|
||||||
// List<SerializableMessage> messages =
|
|
||||||
// messagesJson.map((mj) => SerializableMessage.fromJson(mj)).toList();
|
|
||||||
// allEmails.addAll(messages);
|
|
||||||
// } else {
|
|
||||||
// throw Exception(
|
|
||||||
// 'Failed to fetch thread messages for thread ID: $threadId');
|
|
||||||
// }
|
|
||||||
// } catch (e) {
|
|
||||||
// print('Error fetching thread messages: $e');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
Future<String> _getEmailContent(List<String> IDs) async {
|
|
||||||
String content = r"""
|
String content = r"""
|
||||||
|
|
||||||
""";
|
""";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
for (var id in IDs) {
|
|
||||||
var url = Uri.http('127.0.0.1:3001', 'email', {'id': id});
|
var url = Uri.http('127.0.0.1:3001', 'email', {'id': id});
|
||||||
|
|
||||||
var response = await http.get(url);
|
var response = await http.get(url);
|
||||||
|
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
content += response.body;
|
content = response.body;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('_getEmailContent caught error: $e');
|
print('_getEmailContent caught error: $e');
|
||||||
}
|
}
|
||||||
print(content);
|
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,16 +249,14 @@ class _EmailPageState extends State<EmailPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class EmailListScreen extends StatelessWidget {
|
class EmailListScreen extends StatelessWidget {
|
||||||
//this is the bulding of the drawer with all emails
|
|
||||||
// try to only get the subject and id, date, sender to make it faster
|
|
||||||
final List emails;
|
final List emails;
|
||||||
final Future<String> Function(List<String>) getEmailContent;
|
final Future<String> Function(String) getEmailContent;
|
||||||
|
|
||||||
EmailListScreen({
|
EmailListScreen({
|
||||||
required this.emails,
|
required this.emails,
|
||||||
required this.getEmailContent,
|
required this.getEmailContent,
|
||||||
});
|
});
|
||||||
// instead of getting the entire email, just the from, text, subject, and id
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -298,7 +267,7 @@ class EmailListScreen extends StatelessWidget {
|
|||||||
itemCount: emails.length,
|
itemCount: emails.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(emails[index].from_name,
|
title: Text(emails[index].from,
|
||||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
style: TextStyle(fontWeight: FontWeight.bold)),
|
||||||
subtitle: Column(
|
subtitle: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -307,43 +276,31 @@ class EmailListScreen extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
trailing: Text(emails[index].date.toString()),
|
trailing: Text(emails[index].date.toString()),
|
||||||
//here we assign each part of json to a var, this could be changed so it only happens,
|
|
||||||
// when clicking on email for modularity
|
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
String emailContent =
|
String emailContent = await getEmailContent(emails[index].id);
|
||||||
await getEmailContent(emails[index].messages);
|
String from = emails[index].from.toString();
|
||||||
String messages = emails[index].messages.toString();
|
String name = emails[index].name.toString();
|
||||||
String fromName = emails[index].from_name.toString();
|
|
||||||
String fromAddress = emails[index].from_address.toString();
|
|
||||||
String to = emails[index].to.toString();
|
String to = emails[index].to.toString();
|
||||||
// String cc = emails[index].cc.toString();
|
String cc = emails[index].cc.toString();
|
||||||
// String hash = emails[index].hash.toString();
|
String hash = emails[index].hash.toString();
|
||||||
String subject = emails[index].subject.toString();
|
String subject = emails[index].subject.toString();
|
||||||
String date = emails[index].date.toString();
|
String date = emails[index].date.toString();
|
||||||
// String uid = emails[index].uid.toString();
|
String uid = emails[index].uid.toString();
|
||||||
// String list = emails[index].list.toString();
|
String list = emails[index].list.toString();
|
||||||
String id = emails[index].id.toString();
|
String id = emails[index].id.toString();
|
||||||
// String in_reply_to = emails[index].in_reply_to.toString();
|
String in_reply_to = emails[index].in_reply_to.toString();
|
||||||
|
// String jsonbuilt =
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => EmailView(
|
builder: (context) => EmailView(
|
||||||
emailContent: emailContent,
|
emailContent: emailContent,
|
||||||
from: fromAddress,
|
// jsonEmail: jsonContent,
|
||||||
name: fromName,
|
from: from, name: name, to: to, cc: cc, hash: hash,
|
||||||
to: to,
|
subject: subject, date: date,
|
||||||
// cc: cc,
|
uid: uid, list: list, id: id,
|
||||||
// hash: hash,
|
in_reply_to: in_reply_to,
|
||||||
subject: subject,
|
)),
|
||||||
date: date,
|
|
||||||
// uid: uid,
|
|
||||||
// list: list,
|
|
||||||
id: id,
|
|
||||||
// in_reply_to: in_reply_to,
|
|
||||||
)
|
|
||||||
//nada hpta
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -360,37 +317,32 @@ class EmailView extends StatefulWidget {
|
|||||||
// final String jsonEmail;
|
// final String jsonEmail;
|
||||||
final String from;
|
final String from;
|
||||||
final String name;
|
final String name;
|
||||||
|
|
||||||
final String to;
|
final String to;
|
||||||
|
final String cc;
|
||||||
// final String to;
|
final String hash;
|
||||||
// final String cc;
|
|
||||||
// final String hash;
|
|
||||||
final String subject;
|
final String subject;
|
||||||
final String date;
|
final String date;
|
||||||
// final String uid;
|
final String uid;
|
||||||
// final String list;
|
final String list;
|
||||||
final String id;
|
final String id;
|
||||||
// final String in_reply_to;
|
final String in_reply_to;
|
||||||
|
|
||||||
const EmailView({
|
const EmailView(
|
||||||
Key? key,
|
{Key? key,
|
||||||
required this.emailContent,
|
required this.emailContent,
|
||||||
// required this.jsonEmail,
|
// required this.jsonEmail,
|
||||||
required this.from,
|
required this.from,
|
||||||
required this.name,
|
required this.name,
|
||||||
required this.to,
|
required this.to,
|
||||||
|
required this.cc,
|
||||||
// required this.to,
|
required this.hash,
|
||||||
// required this.cc,
|
|
||||||
// required this.hash,
|
|
||||||
required this.subject,
|
required this.subject,
|
||||||
required this.date,
|
required this.date,
|
||||||
// required this.uid,
|
required this.uid,
|
||||||
// required this.list,
|
required this.list,
|
||||||
required this.id,
|
required this.id,
|
||||||
// required this.in_reply_to
|
required this.in_reply_to})
|
||||||
}) : super(key: key);
|
: super(key: key);
|
||||||
@override
|
@override
|
||||||
_EmailViewState createState() => _EmailViewState();
|
_EmailViewState createState() => _EmailViewState();
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ class _DynamicClassesAugment extends State<EmailToolbar> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () => AugmentClasses.FilterButton(context),
|
onPressed: AugmentClasses.handleImages,
|
||||||
child: Text('Filter'),
|
child: Text('Filter'),
|
||||||
),
|
),
|
||||||
SizedBox(width: 8),
|
SizedBox(width: 8),
|
||||||
@ -275,8 +275,8 @@ class AugmentClasses {
|
|||||||
builder: (context) => AlertDialog(
|
builder: (context) => AlertDialog(
|
||||||
title: Text('Jump Item:'),
|
title: Text('Jump Item:'),
|
||||||
content: Container(
|
content: Container(
|
||||||
width: 300,
|
width: 200,
|
||||||
height: 170,
|
height: 120,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
@ -296,56 +296,20 @@ class AugmentClasses {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Spacer(
|
|
||||||
flex: 5,
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
ElevatedButton(
|
|
||||||
onPressed: () => AugmentClasses.ViewSpecsButton(context),
|
|
||||||
child: Text("Viewspecs:"),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
width: 150,
|
|
||||||
child: TextField(
|
|
||||||
maxLines: 1,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: '',
|
|
||||||
border: OutlineInputBorder(),
|
|
||||||
suffixIcon: Icon(Icons.search)),
|
|
||||||
onSubmitted: (value) {
|
|
||||||
print("onSubmitted: $value");
|
|
||||||
if (value.isNotEmpty) {
|
|
||||||
handleJump(value);
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
ElevatedButton(
|
|
||||||
onPressed: () {
|
|
||||||
//TODO: Grab both textfields and call both of the functions handles
|
|
||||||
},
|
|
||||||
child: Text('OK')),
|
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
// print('close pressed');
|
// print('close pressed');
|
||||||
},
|
},
|
||||||
child: Text('Cancel'),
|
child: Text('close'),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () => ViewSpecsButton(context),
|
||||||
//TODO: in the ui demo didn't see it
|
child: Text('viewspecs'))
|
||||||
},
|
|
||||||
child: Text('Help'))
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
).then((_) {
|
).then((_) {
|
||||||
@ -470,7 +434,6 @@ class AugmentClasses {
|
|||||||
ElevatedButton(onPressed: () {}, child: Text('OK')),
|
ElevatedButton(onPressed: () {}, child: Text('OK')),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
AugmentClasses.disableIframePointerEvents();
|
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
child: Text('Cancel')),
|
child: Text('Cancel')),
|
||||||
@ -484,44 +447,10 @@ class AugmentClasses {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
)).then((_) {
|
)).then((_) {
|
||||||
AugmentClasses.enableIframePointerEvents(); // may be useless?
|
AugmentClasses.enableIframePointerEvents();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleFilter() {}
|
|
||||||
static Future<void> FilterButton(context) async {
|
|
||||||
//this is literally ctrl+F :skull:
|
|
||||||
//idea is to search in file, extract the <p> tags that contain these
|
|
||||||
//words and highlight, then when zoom, you just jump to that paragraph
|
|
||||||
|
|
||||||
AugmentClasses.disableIframePointerEvents();
|
|
||||||
await showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => Container(
|
|
||||||
height: 150,
|
|
||||||
width: 300,
|
|
||||||
child: AlertDialog(
|
|
||||||
title: Text('Filter'),
|
|
||||||
content: Container(
|
|
||||||
width: 400, // Set the width to simulate the Windows style
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Text('Set filter:'),
|
|
||||||
SizedBox(
|
|
||||||
width: 175,
|
|
||||||
child: TextField(
|
|
||||||
maxLines: 1,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
border: OutlineInputBorder(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)))));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void disableIframePointerEvents() {
|
static void disableIframePointerEvents() {
|
||||||
final iframes = html.document.getElementsByTagName('iframe');
|
final iframes = html.document.getElementsByTagName('iframe');
|
||||||
for (var iframe in iframes) {
|
for (var iframe in iframes) {
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:http/http.dart' as http;
|
|
||||||
import 'dart:convert';
|
|
||||||
import 'dart:ui_web' as ui;
|
|
||||||
import 'dart:html' as html;
|
|
||||||
import 'augment.dart';
|
|
||||||
import 'dart:js' as js;
|
|
||||||
import 'api_service.dart';
|
|
||||||
import 'dart:convert'; // For JSON decoding
|
|
||||||
import 'package:intl/intl.dart';
|
|
||||||
|
|
||||||
|
|
||||||
class GetThreadResponse {
|
|
||||||
final int id;
|
|
||||||
final List<String> messages;
|
|
||||||
final String subject;
|
|
||||||
final DateTime date;
|
|
||||||
final String from_name;
|
|
||||||
final String from_address;
|
|
||||||
final List<MailAddress> to;
|
|
||||||
|
|
||||||
GetThreadResponse({
|
|
||||||
required this.id,
|
|
||||||
required this.messages,
|
|
||||||
required this.subject,
|
|
||||||
required this.date,
|
|
||||||
required this.from_name,
|
|
||||||
required this.from_address,
|
|
||||||
required this.to,
|
|
||||||
});
|
|
||||||
factory GetThreadResponse.fromJson(Map<String, dynamic> json) {
|
|
||||||
var messagesList = json['messages'] as List<dynamic>;
|
|
||||||
var toList = json['to'] as List<dynamic>;
|
|
||||||
// var ccList = json['cc'] as List;
|
|
||||||
|
|
||||||
return GetThreadResponse (
|
|
||||||
id: json['id'],
|
|
||||||
// messages: messagesList.map((message) => message.toString()).toList(),
|
|
||||||
messages: List<String>.from(json['messages']),
|
|
||||||
subject: json['subject'],
|
|
||||||
date: DateTime.parse(json['date']),
|
|
||||||
from_name: json['from_name'],
|
|
||||||
from_address: json['from_address'],
|
|
||||||
to: toList.map((i)=> MailAddress.fromJson(i)).toList(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user