Move const structures to their own object to prevent spillage
This commit is contained in:
parent
3ae7812ed7
commit
1e43d1a482
|
@ -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 = [
|
class Comment extends StatelessWidget {
|
||||||
|
final int indent;
|
||||||
|
final int postCreatorId;
|
||||||
|
final CommentTree commentTree;
|
||||||
|
|
||||||
|
static const colors = [
|
||||||
Colors.pink,
|
Colors.pink,
|
||||||
Colors.green,
|
Colors.green,
|
||||||
Colors.amber,
|
Colors.amber,
|
||||||
Colors.cyan,
|
Colors.cyan,
|
||||||
Colors.indigo,
|
Colors.indigo,
|
||||||
];
|
];
|
||||||
|
|
||||||
class Comment extends StatelessWidget {
|
|
||||||
final int indent;
|
|
||||||
final int postCreatorId;
|
|
||||||
final CommentTree commentTree;
|
|
||||||
Comment(
|
Comment(
|
||||||
this.commentTree, {
|
this.commentTree, {
|
||||||
this.indent = 0,
|
this.indent = 0,
|
||||||
|
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in New Issue