2019-01-28 14:32:01 +01:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
2019-01-31 07:37:25 +01:00
|
|
|
import '../utils/utils.dart';
|
2019-02-07 07:35:19 +01:00
|
|
|
import 'avatar.dart';
|
|
|
|
import 'user_name.dart';
|
2019-01-28 14:32:01 +01:00
|
|
|
|
|
|
|
class CommentItem extends StatelessWidget {
|
2019-02-19 08:25:15 +01:00
|
|
|
final Map<String, dynamic> payload;
|
2019-01-28 14:32:01 +01:00
|
|
|
|
2019-02-19 08:25:15 +01:00
|
|
|
CommentItem(this.payload);
|
2019-01-28 14:32:01 +01:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Column(children: <Widget>[
|
|
|
|
Row(children: <Widget>[
|
2019-02-03 08:50:17 +01:00
|
|
|
Avatar(
|
2019-02-19 08:25:15 +01:00
|
|
|
url: payload['author']['avatarUrl'],
|
2019-02-09 08:33:06 +01:00
|
|
|
size: 16,
|
2019-03-09 10:03:33 +01:00
|
|
|
login: payload['author']['login'],
|
2019-02-03 08:50:17 +01:00
|
|
|
),
|
2019-02-09 08:33:06 +01:00
|
|
|
Padding(padding: EdgeInsets.only(left: 6)),
|
2019-01-28 14:32:01 +01:00
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
2019-02-19 08:25:15 +01:00
|
|
|
UserName(payload['author']['login']),
|
2019-02-09 08:33:06 +01:00
|
|
|
Padding(padding: EdgeInsets.only(bottom: 2)),
|
|
|
|
Text(
|
2019-02-19 08:25:15 +01:00
|
|
|
TimeAgo.formatFromString(payload['createdAt']),
|
2019-02-09 08:33:06 +01:00
|
|
|
style: TextStyle(color: Colors.black54, fontSize: 13),
|
|
|
|
),
|
2019-01-28 14:32:01 +01:00
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
Padding(
|
2019-02-09 08:33:06 +01:00
|
|
|
padding: const EdgeInsets.only(left: 36, top: 8),
|
2019-02-02 17:28:51 +01:00
|
|
|
child: MarkdownBody(
|
2019-02-19 08:25:15 +01:00
|
|
|
data: payload['body'],
|
2019-02-02 17:28:51 +01:00
|
|
|
// styleSheet: MarkdownStyleSheet(code: TextStyle(fontSize: 14)),
|
|
|
|
),
|
2019-01-28 14:32:01 +01:00
|
|
|
),
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|