Move const structures to their own object to prevent spillage

This commit is contained in:
krawieck 2020-09-10 15:24:45 +02:00
parent 3ae7812ed7
commit 1e43d1a482
2 changed files with 17 additions and 16 deletions

View File

@ -13,18 +13,19 @@ import '../util/text_color.dart';
import 'bottom_modal.dart'; import 'bottom_modal.dart';
import 'markdown_text.dart'; import 'markdown_text.dart';
const colors = [
Colors.pink,
Colors.green,
Colors.amber,
Colors.cyan,
Colors.indigo,
];
class Comment extends StatelessWidget { class Comment extends StatelessWidget {
final int indent; final int indent;
final int postCreatorId; final int postCreatorId;
final CommentTree commentTree; final CommentTree commentTree;
static const colors = [
Colors.pink,
Colors.green,
Colors.amber,
Colors.cyan,
Colors.indigo,
];
Comment( Comment(
this.commentTree, { this.commentTree, {
this.indent = 0, this.indent = 0,

View File

@ -7,14 +7,6 @@ import '../comment_tree.dart';
import 'bottom_modal.dart'; import 'bottom_modal.dart';
import 'comment.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 /// Manages comments section, sorts them
class CommentSection extends HookWidget { class CommentSection extends HookWidget {
final List<CommentView> rawComments; final List<CommentView> rawComments;
@ -22,6 +14,14 @@ class CommentSection extends HookWidget {
final int postCreatorId; final int postCreatorId;
final CommentSortType sortType; 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( CommentSection(
List<CommentView> rawComments, { List<CommentView> rawComments, {
@required this.postCreatorId, @required this.postCreatorId,