Rename `Comments` to `CommentSection`

This commit is contained in:
krawieck 2020-08-31 21:37:24 +02:00
parent a6486f6e51
commit d902c3d2aa
2 changed files with 31 additions and 33 deletions

View File

@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:lemmy_api_client/lemmy_api_client.dart';
import '../comment_tree.dart';
import 'comment.dart';
/// Manages comments section, sorts them
class CommentSection extends HookWidget {
final List<CommentView> rawComments;
final List<CommentTree> comments;
final int postCreatorId;
CommentSection(this.rawComments, {@required this.postCreatorId})
: comments = CommentTree.fromList(rawComments),
assert(postCreatorId != null);
@override
Widget build(BuildContext context) => Column(children: [
// sorting menu goes here
if (comments.isEmpty)
Padding(
padding: EdgeInsets.symmetric(vertical: 50),
child: Text(
'no comments yet',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
for (var com in comments) Comment(com, postCreatorId: postCreatorId),
]);
}

View File

@ -1,33 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:lemmy_api_client/lemmy_api_client.dart';
import '../comment_tree.dart';
import 'comment.dart';
/// Manages comments section, sorts them
class Comments extends HookWidget {
final List<CommentView> rawComments;
final List<CommentTree> comments;
final int postCreatorId;
Comments(this.rawComments, {@required this.postCreatorId})
: comments = CommentTree.fromList(rawComments),
assert(postCreatorId != null);
@override
Widget build(BuildContext context) {
return Column(children: [
// sorting menu goes here
if (comments.isEmpty)
Padding(
padding: EdgeInsets.symmetric(vertical: 50),
child: Text(
'no comments yet',
style: TextStyle(fontStyle: FontStyle.italic),
),
),
for (var com in comments) Comment(com, postCreatorId: postCreatorId),
]);
}
}