Fix minor bugs
This commit is contained in:
@@ -132,7 +132,6 @@ class ConnectionRepositoryImpl
|
|||||||
false,
|
false,
|
||||||
)
|
)
|
||||||
.map((r) {
|
.map((r) {
|
||||||
loggy.debug("setup complete");
|
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
return r;
|
return r;
|
||||||
})
|
})
|
||||||
@@ -169,9 +168,7 @@ class ConnectionRepositoryImpl
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
await $(setup());
|
await $(setup());
|
||||||
loggy.debug("after setup");
|
|
||||||
await $(applyConfigOption(options));
|
await $(applyConfigOption(options));
|
||||||
loggy.debug("after apply");
|
|
||||||
return await $(
|
return await $(
|
||||||
singbox
|
singbox
|
||||||
.start(
|
.start(
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ enum ProxiesSort {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Riverpod(keepAlive: true)
|
@Riverpod(keepAlive: true)
|
||||||
class ProxiesSortNotifier extends _$ProxiesSortNotifier {
|
class ProxiesSortNotifier extends _$ProxiesSortNotifier with AppLogger {
|
||||||
late final _pref = Pref(
|
late final _pref = Pref(
|
||||||
ref.watch(sharedPreferencesProvider).requireValue,
|
ref.watch(sharedPreferencesProvider).requireValue,
|
||||||
"proxies_sort_mode",
|
"proxies_sort_mode",
|
||||||
@@ -39,7 +39,11 @@ class ProxiesSortNotifier extends _$ProxiesSortNotifier {
|
|||||||
);
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ProxiesSort build() => _pref.getValue();
|
ProxiesSort build() {
|
||||||
|
final sortBy = _pref.getValue();
|
||||||
|
loggy.info("sort proxies by: [${sortBy.name}]");
|
||||||
|
return sortBy;
|
||||||
|
}
|
||||||
|
|
||||||
Future<void> update(ProxiesSort value) {
|
Future<void> update(ProxiesSort value) {
|
||||||
state = value;
|
state = value;
|
||||||
|
|||||||
@@ -23,15 +23,35 @@ class ProxiesOverviewPage extends HookConsumerWidget with PresLogger {
|
|||||||
CustomToast.error(t.presentShortError(error)).show(context),
|
CustomToast.error(t.presentShortError(error)).show(context),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
final appBar = NestedAppBar(
|
||||||
|
title: Text(t.proxies.pageTitle),
|
||||||
|
actions: [
|
||||||
|
PopupMenuButton<ProxiesSort>(
|
||||||
|
initialValue: sortBy,
|
||||||
|
onSelected: ref.read(proxiesSortNotifierProvider.notifier).update,
|
||||||
|
icon: const Icon(Icons.sort),
|
||||||
|
tooltip: t.proxies.sortTooltip,
|
||||||
|
itemBuilder: (context) {
|
||||||
|
return [
|
||||||
|
...ProxiesSort.values.map(
|
||||||
|
(e) => PopupMenuItem(
|
||||||
|
value: e,
|
||||||
|
child: Text(e.present(t)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
switch (asyncProxies) {
|
switch (asyncProxies) {
|
||||||
case AsyncData(value: final groups):
|
case AsyncData(value: final groups):
|
||||||
if (groups.isEmpty) {
|
if (groups.isEmpty) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
NestedAppBar(
|
appBar,
|
||||||
title: Text(t.proxies.pageTitle),
|
|
||||||
),
|
|
||||||
SliverFillRemaining(
|
SliverFillRemaining(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@@ -50,28 +70,7 @@ class ProxiesOverviewPage extends HookConsumerWidget with PresLogger {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
NestedAppBar(
|
appBar,
|
||||||
title: Text(t.proxies.pageTitle),
|
|
||||||
actions: [
|
|
||||||
PopupMenuButton<ProxiesSort>(
|
|
||||||
initialValue: sortBy,
|
|
||||||
onSelected:
|
|
||||||
ref.read(proxiesSortNotifierProvider.notifier).update,
|
|
||||||
icon: const Icon(Icons.sort),
|
|
||||||
tooltip: t.proxies.sortTooltip,
|
|
||||||
itemBuilder: (context) {
|
|
||||||
return [
|
|
||||||
...ProxiesSort.values.map(
|
|
||||||
(e) => PopupMenuItem(
|
|
||||||
value: e,
|
|
||||||
child: Text(e.present(t)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
];
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
SliverLayoutBuilder(
|
SliverLayoutBuilder(
|
||||||
builder: (context, constraints) {
|
builder: (context, constraints) {
|
||||||
final width = constraints.crossAxisExtent;
|
final width = constraints.crossAxisExtent;
|
||||||
@@ -140,9 +139,7 @@ class ProxiesOverviewPage extends HookConsumerWidget with PresLogger {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
NestedAppBar(
|
appBar,
|
||||||
title: Text(t.proxies.pageTitle),
|
|
||||||
),
|
|
||||||
SliverErrorBodyPlaceholder(
|
SliverErrorBodyPlaceholder(
|
||||||
t.presentShortError(error),
|
t.presentShortError(error),
|
||||||
icon: null,
|
icon: null,
|
||||||
@@ -155,9 +152,7 @@ class ProxiesOverviewPage extends HookConsumerWidget with PresLogger {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: CustomScrollView(
|
body: CustomScrollView(
|
||||||
slivers: [
|
slivers: [
|
||||||
NestedAppBar(
|
appBar,
|
||||||
title: Text(t.proxies.pageTitle),
|
|
||||||
),
|
|
||||||
const SliverLoadingBodyPlaceholder(),
|
const SliverLoadingBodyPlaceholder(),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://inlang.com/schema/project-settings",
|
|
||||||
"sourceLanguageTag": "en",
|
|
||||||
"languageTags": [
|
|
||||||
"en",
|
|
||||||
"fa",
|
|
||||||
"ru",
|
|
||||||
"tr",
|
|
||||||
"zh-CN"
|
|
||||||
],
|
|
||||||
"modules": [
|
|
||||||
"https://cdn.jsdelivr.net/npm/@inlang/plugin-i18next@4/dist/index.js",
|
|
||||||
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-empty-pattern@1/dist/index.js",
|
|
||||||
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-identical-pattern@1/dist/index.js",
|
|
||||||
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-without-source@1/dist/index.js",
|
|
||||||
"https://cdn.jsdelivr.net/npm/@inlang/message-lint-rule-missing-translation@1/dist/index.js"
|
|
||||||
],
|
|
||||||
"plugin.inlang.i18next": {
|
|
||||||
"pathPattern": "./assets/translations/strings_{languageTag}.i18n.json",
|
|
||||||
"variableReferencePattern": [
|
|
||||||
"@:"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user