2022-04-18 22:23:30 +00:00
|
|
|
import 'package:enough_mail/enough_mail.dart';
|
2022-04-15 04:03:42 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2022-04-17 23:35:03 +00:00
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:wind/thread_model.dart';
|
2022-04-15 04:03:42 +00:00
|
|
|
|
|
|
|
class MessageItemView extends StatelessWidget {
|
2022-04-18 22:23:30 +00:00
|
|
|
const MessageItemView(
|
|
|
|
{Key? key,
|
|
|
|
required this.item,
|
|
|
|
required this.isOpPost,
|
|
|
|
required this.isLast})
|
2022-04-15 04:03:42 +00:00
|
|
|
: super(key: key);
|
|
|
|
|
|
|
|
final MessageItem item;
|
|
|
|
final bool isOpPost;
|
2022-04-18 22:23:30 +00:00
|
|
|
final bool isLast;
|
2022-04-15 04:03:42 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Container(
|
2022-05-01 21:49:03 +00:00
|
|
|
padding: this.isOpPost
|
2022-04-18 22:23:30 +00:00
|
|
|
? EdgeInsets.only(bottom: 10, left: 10, right: 10, top: 16)
|
|
|
|
: isLast
|
|
|
|
? EdgeInsets.only(left: 10, right: 10, bottom: 16)
|
|
|
|
: EdgeInsets.only(left: 10, right: 10),
|
2022-04-15 04:03:42 +00:00
|
|
|
child: Card(
|
|
|
|
elevation: 5,
|
2022-04-17 23:26:57 +00:00
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
isOpPost
|
|
|
|
? Container(
|
|
|
|
child: Text(
|
|
|
|
item.subject!,
|
2022-04-15 04:03:42 +00:00
|
|
|
style: TextStyle(
|
2022-04-17 23:26:57 +00:00
|
|
|
fontWeight: FontWeight.bold, fontSize: 21),
|
2022-04-15 04:03:42 +00:00
|
|
|
),
|
2022-04-17 23:26:57 +00:00
|
|
|
margin: EdgeInsets.only(top: 16, left: 16, right: 16),
|
|
|
|
)
|
|
|
|
: Container(),
|
|
|
|
Container(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
item.author,
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.normal,
|
|
|
|
color: Colors.blue,
|
|
|
|
fontSize: 15),
|
|
|
|
),
|
|
|
|
SizedBox(width: 5),
|
|
|
|
Text(
|
|
|
|
item.date,
|
|
|
|
style: TextStyle(fontSize: 15),
|
|
|
|
),
|
|
|
|
SizedBox(width: 5),
|
|
|
|
InkWell(
|
|
|
|
child: Text(
|
2022-04-15 04:03:42 +00:00
|
|
|
"#${item.number}",
|
|
|
|
style: TextStyle(fontSize: 15, color: Colors.grey),
|
2022-04-17 23:26:57 +00:00
|
|
|
),
|
2022-04-17 23:35:03 +00:00
|
|
|
onTap: () {
|
|
|
|
var model =
|
|
|
|
Provider.of<ThreadModel>(context, listen: false);
|
|
|
|
model.commentTextController.text +=
|
|
|
|
">>${item.number}\n";
|
|
|
|
},
|
2022-04-17 23:26:57 +00:00
|
|
|
)
|
|
|
|
],
|
2022-04-15 04:03:42 +00:00
|
|
|
),
|
2022-04-17 23:26:57 +00:00
|
|
|
margin: isOpPost
|
|
|
|
? EdgeInsets.only(top: 5, bottom: 2, left: 16, right: 16)
|
|
|
|
: EdgeInsets.only(top: 16, left: 16),
|
|
|
|
),
|
|
|
|
Container(
|
|
|
|
child:
|
|
|
|
SelectableText(item.body, style: TextStyle(fontSize: 17)),
|
|
|
|
margin: EdgeInsets.all(16),
|
|
|
|
)
|
|
|
|
],
|
2022-04-15 04:03:42 +00:00
|
|
|
)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class MessageItem {
|
|
|
|
final String id;
|
|
|
|
final int number;
|
|
|
|
final String? subject;
|
|
|
|
final String author;
|
|
|
|
final String date;
|
|
|
|
final String body;
|
|
|
|
|
2022-04-18 22:23:30 +00:00
|
|
|
MimeMessage? originalMessage;
|
|
|
|
|
2022-04-15 04:03:42 +00:00
|
|
|
MessageItem(
|
|
|
|
this.id, this.number, this.subject, this.author, this.date, this.body);
|
|
|
|
}
|