refactor: add prefix to distinguish int value
This commit is contained in:
parent
717b7cd336
commit
6fe2a6541c
|
@ -631,12 +631,13 @@ class AuthModel with ChangeNotifier {
|
||||||
_accounts = (json.decode(str ?? '[]') as List)
|
_accounts = (json.decode(str ?? '[]') as List)
|
||||||
.map((item) => Account.fromJson(item))
|
.map((item) => Account.fromJson(item))
|
||||||
.toList();
|
.toList();
|
||||||
activeAccountIndex = prefs.getInt(StorageKeys.defaultAccount);
|
activeAccountIndex = prefs.getInt(StorageKeys.iDefaultAccount);
|
||||||
|
|
||||||
if (activeAccount != null)
|
if (activeAccount != null) {
|
||||||
_activeTab = prefs.getInt(
|
_activeTab = prefs.getInt(
|
||||||
StorageKeys.getDefaultStartTabKey(activeAccount.platform)) ??
|
StorageKeys.getDefaultStartTabKey(activeAccount.platform)) ??
|
||||||
0;
|
0;
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
Fimber.e('prefs getAccount failed', ex: err);
|
Fimber.e('prefs getAccount failed', ex: err);
|
||||||
_accounts = [];
|
_accounts = [];
|
||||||
|
@ -653,7 +654,7 @@ class AuthModel with ChangeNotifier {
|
||||||
|
|
||||||
Future<void> setDefaultAccount(int v) async {
|
Future<void> setDefaultAccount(int v) async {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
await prefs.setInt(StorageKeys.defaultAccount, v);
|
await prefs.setInt(StorageKeys.iDefaultAccount, v);
|
||||||
Fimber.d('write default account: $v');
|
Fimber.d('write default account: $v');
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
|
@ -175,7 +175,7 @@ class ThemeModel with ChangeNotifier {
|
||||||
Future<void> setMarkdown(int v) async {
|
Future<void> setMarkdown(int v) async {
|
||||||
_markdown = v;
|
_markdown = v;
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
await prefs.setInt(StorageKeys.markdown, v);
|
await prefs.setInt(StorageKeys.iMarkdown, v);
|
||||||
Fimber.d('write markdown engine: $v');
|
Fimber.d('write markdown engine: $v');
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
@ -245,7 +245,7 @@ class ThemeModel with ChangeNotifier {
|
||||||
if (AppBrightnessType.values.contains(b)) {
|
if (AppBrightnessType.values.contains(b)) {
|
||||||
_brightnessValue = b;
|
_brightnessValue = b;
|
||||||
}
|
}
|
||||||
final m = prefs.getInt(StorageKeys.markdown);
|
final m = prefs.getInt(StorageKeys.iMarkdown);
|
||||||
if (AppMarkdownType.values.contains(m)) {
|
if (AppMarkdownType.values.contains(m)) {
|
||||||
_markdown = m;
|
_markdown = m;
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,9 +26,9 @@ class StorageKeys {
|
||||||
static const codeThemeDark = 'code-theme-dark';
|
static const codeThemeDark = 'code-theme-dark';
|
||||||
static const iCodeFontSize = 'code-font-size';
|
static const iCodeFontSize = 'code-font-size';
|
||||||
static const codeFontFamily = 'code-font-family';
|
static const codeFontFamily = 'code-font-family';
|
||||||
static const markdown = 'markdown';
|
static const iMarkdown = 'markdown';
|
||||||
|
static const iDefaultAccount = 'default-account';
|
||||||
static const locale = 'locale';
|
static const locale = 'locale';
|
||||||
static const defaultAccount = 'default-account';
|
|
||||||
|
|
||||||
static getDefaultStartTabKey(String platform) =>
|
static getDefaultStartTabKey(String platform) =>
|
||||||
'default-start-tab-$platform';
|
'default-start-tab-$platform';
|
||||||
|
|
|
@ -323,7 +323,7 @@ packages:
|
||||||
name: flutter_vector_icons
|
name: flutter_vector_icons
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.1"
|
version: "0.3.0"
|
||||||
flutter_web_plugins:
|
flutter_web_plugins:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description: flutter
|
description: flutter
|
||||||
|
|
|
@ -26,7 +26,7 @@ dependencies:
|
||||||
flutter_highlight: ^0.6.0
|
flutter_highlight: ^0.6.0
|
||||||
flutter_markdown: ^0.4.4
|
flutter_markdown: ^0.4.4
|
||||||
flutter_svg: ^0.19.0
|
flutter_svg: ^0.19.0
|
||||||
flutter_vector_icons: ^0.2.1
|
flutter_vector_icons: ^0.3.0
|
||||||
github: ^7.0.4
|
github: ^7.0.4
|
||||||
github_trending: ^1.0.0
|
github_trending: ^1.0.0
|
||||||
gql_http_link: ^0.3.2
|
gql_http_link: ^0.3.2
|
||||||
|
|
Loading…
Reference in New Issue