From c1c26bf0e08236f3e52f3fc74ac6fb8d0c75dbed Mon Sep 17 00:00:00 2001 From: Jiaqi Feng Date: Tue, 31 Jan 2023 18:19:34 -0800 Subject: [PATCH] fix `preference` model. (#127) --- lib/models/preference.dart | 44 +++++++++++++++++++++----------------- pubspec.yaml | 2 +- 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/lib/models/preference.dart b/lib/models/preference.dart index 66dd9c0..b8aaf23 100644 --- a/lib/models/preference.dart +++ b/lib/models/preference.dart @@ -1,3 +1,4 @@ +import 'dart:collection'; import 'dart:io'; import 'package:equatable/equatable.dart'; @@ -13,26 +14,29 @@ abstract class Preference extends Equatable with SettingsDisplayable { Preference copyWith({required T? val}); - static List> allPreferences = >[ - // Order of these first three preferences does not matter. - FetchModePreference(), - CommentsOrderPreference(), - FontSizePreference(), - TabOrderPreference(), - // Order of items below matters and - // reflects the order on settings screen. - const DisplayModePreference(), - const MetadataModePreference(), - const StoryUrlModePreference(), - const NotificationModePreference(), - const SwipeGesturePreference(), - const CollapseModePreference(), - NavigationModePreference(), - const ReaderModePreference(), - const MarkReadStoriesModePreference(), - const EyeCandyModePreference(), - const TrueDarkModePreference(), - ]; + static final List> allPreferences = + UnmodifiableListView>( + >[ + // Order of these first four preferences does not matter. + FetchModePreference(), + CommentsOrderPreference(), + FontSizePreference(), + TabOrderPreference(), + // Order of items below matters and + // reflects the order on settings screen. + const DisplayModePreference(), + const MetadataModePreference(), + const StoryUrlModePreference(), + const NotificationModePreference(), + const SwipeGesturePreference(), + const CollapseModePreference(), + NavigationModePreference(), + const ReaderModePreference(), + const MarkReadStoriesModePreference(), + const EyeCandyModePreference(), + const TrueDarkModePreference(), + ], + ); @override List get props => [key]; diff --git a/pubspec.yaml b/pubspec.yaml index 39d9cca..918ee6b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: hacki description: A Hacker News reader. -version: 1.0.5+83 +version: 1.0.6+84 publish_to: none environment: