git-touch-android-ios-app/lib/widgets/comment_item.dart

46 lines
1.3 KiB
Dart
Raw Normal View History

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';
class CommentItem extends StatelessWidget {
final Map<String, dynamic> item;
CommentItem(this.item);
@override
Widget build(BuildContext context) {
return Column(children: <Widget>[
Row(children: <Widget>[
2019-02-03 08:50:17 +01:00
Avatar(
login: item['author']['login'],
url: item['author']['avatarUrl'],
size: 16,
2019-02-03 08:50:17 +01:00
),
Padding(padding: EdgeInsets.only(left: 6)),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
UserName(item['author']['login']),
Padding(padding: EdgeInsets.only(bottom: 2)),
Text(
TimeAgo.formatFromString(item['createdAt']),
style: TextStyle(color: Colors.black54, fontSize: 13),
),
],
),
),
]),
Padding(
padding: const EdgeInsets.only(left: 36, top: 8),
2019-02-02 17:28:51 +01:00
child: MarkdownBody(
data: item['body'],
// styleSheet: MarkdownStyleSheet(code: TextStyle(fontSize: 14)),
),
),
]);
}
}