Move const structures to their own object to prevent spillage
This commit is contained in:
parent
3ae7812ed7
commit
1e43d1a482
|
@ -13,7 +13,12 @@ import '../util/text_color.dart';
|
|||
import 'bottom_modal.dart';
|
||||
import 'markdown_text.dart';
|
||||
|
||||
const colors = [
|
||||
class Comment extends StatelessWidget {
|
||||
final int indent;
|
||||
final int postCreatorId;
|
||||
final CommentTree commentTree;
|
||||
|
||||
static const colors = [
|
||||
Colors.pink,
|
||||
Colors.green,
|
||||
Colors.amber,
|
||||
|
@ -21,10 +26,6 @@ const colors = [
|
|||
Colors.indigo,
|
||||
];
|
||||
|
||||
class Comment extends StatelessWidget {
|
||||
final int indent;
|
||||
final int postCreatorId;
|
||||
final CommentTree commentTree;
|
||||
Comment(
|
||||
this.commentTree, {
|
||||
this.indent = 0,
|
||||
|
|
|
@ -7,14 +7,6 @@ import '../comment_tree.dart';
|
|||
import 'bottom_modal.dart';
|
||||
import 'comment.dart';
|
||||
|
||||
const sortPairs = {
|
||||
CommentSortType.hot: [Icons.whatshot, 'Hot'],
|
||||
CommentSortType.new_: [Icons.new_releases, 'New'],
|
||||
CommentSortType.old: [Icons.calendar_today, 'Old'],
|
||||
CommentSortType.top: [Icons.trending_up, 'Top'],
|
||||
CommentSortType.chat: [Icons.chat, 'Chat'],
|
||||
};
|
||||
|
||||
/// Manages comments section, sorts them
|
||||
class CommentSection extends HookWidget {
|
||||
final List<CommentView> rawComments;
|
||||
|
@ -22,6 +14,14 @@ class CommentSection extends HookWidget {
|
|||
final int postCreatorId;
|
||||
final CommentSortType sortType;
|
||||
|
||||
static const sortPairs = {
|
||||
CommentSortType.hot: [Icons.whatshot, 'Hot'],
|
||||
CommentSortType.new_: [Icons.new_releases, 'New'],
|
||||
CommentSortType.old: [Icons.calendar_today, 'Old'],
|
||||
CommentSortType.top: [Icons.trending_up, 'Top'],
|
||||
CommentSortType.chat: [Icons.chat, 'Chat'],
|
||||
};
|
||||
|
||||
CommentSection(
|
||||
List<CommentView> rawComments, {
|
||||
@required this.postCreatorId,
|
||||
|
|
Loading…
Reference in New Issue