mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
@@ -215,10 +215,10 @@ class _HomePageState extends State<HomePage>
|
|||||||
|
|
||||||
void _goAuth() {
|
void _goAuth() {
|
||||||
if (Stores.setting.useBioAuth.fetch()) {
|
if (Stores.setting.useBioAuth.fetch()) {
|
||||||
if (BioAuthPage.route.alreadyIn) return;
|
if (LocalAuthPage.route.alreadyIn) return;
|
||||||
BioAuthPage.route.go(
|
LocalAuthPage.route.go(
|
||||||
context,
|
context,
|
||||||
args: BioAuthPageArgs(onAuthSuccess: () => _shouldAuth = false),
|
args: LocalAuthPageArgs(onAuthSuccess: () => _shouldAuth = false),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,9 @@ extension _App on _AppSettingsPageState {
|
|||||||
_buildThemeMode(),
|
_buildThemeMode(),
|
||||||
_buildAppColor(),
|
_buildAppColor(),
|
||||||
_buildCheckUpdate(),
|
_buildCheckUpdate(),
|
||||||
if (specific != null) specific,
|
PlatformPublicSettings.buildBioAuth(),
|
||||||
_buildAppMore(),
|
_buildAppMore(),
|
||||||
|
if (specific != null) specific,
|
||||||
];
|
];
|
||||||
|
|
||||||
return Column(children: children.map((e) => e.cardx).toList());
|
return Column(children: children.map((e) => e.cardx).toList());
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import 'package:server_box/view/page/backup.dart';
|
|||||||
import 'package:server_box/view/page/private_key/list.dart';
|
import 'package:server_box/view/page/private_key/list.dart';
|
||||||
import 'package:server_box/view/page/setting/platform/android.dart';
|
import 'package:server_box/view/page/setting/platform/android.dart';
|
||||||
import 'package:server_box/view/page/setting/platform/ios.dart';
|
import 'package:server_box/view/page/setting/platform/ios.dart';
|
||||||
|
import 'package:server_box/view/page/setting/platform/platform_pub.dart';
|
||||||
import 'package:server_box/view/page/setting/seq/srv_detail_seq.dart';
|
import 'package:server_box/view/page/setting/seq/srv_detail_seq.dart';
|
||||||
import 'package:server_box/view/page/setting/seq/srv_func_seq.dart';
|
import 'package:server_box/view/page/setting/seq/srv_func_seq.dart';
|
||||||
import 'package:server_box/view/page/setting/seq/srv_seq.dart';
|
import 'package:server_box/view/page/setting/seq/srv_seq.dart';
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import 'package:fl_lib/fl_lib.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:server_box/core/extension/context/locale.dart';
|
import 'package:server_box/core/extension/context/locale.dart';
|
||||||
import 'package:server_box/data/res/store.dart';
|
import 'package:server_box/data/res/store.dart';
|
||||||
import 'package:server_box/view/page/setting/platform/platform_pub.dart';
|
|
||||||
|
|
||||||
class AndroidSettingsPage extends StatefulWidget {
|
class AndroidSettingsPage extends StatefulWidget {
|
||||||
const AndroidSettingsPage({super.key});
|
const AndroidSettingsPage({super.key});
|
||||||
@@ -29,7 +28,6 @@ class _AndroidSettingsPageState extends State<AndroidSettingsPage> {
|
|||||||
// _buildFgService(),
|
// _buildFgService(),
|
||||||
_buildBgRun(),
|
_buildBgRun(),
|
||||||
_buildAndroidWidgetSharedPreference(),
|
_buildAndroidWidgetSharedPreference(),
|
||||||
if (BioAuth.isPlatformSupported) PlatformPublicSettings.buildBioAuth(),
|
|
||||||
].map((e) => CardX(child: e)).toList(),
|
].map((e) => CardX(child: e)).toList(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:server_box/core/extension/context/locale.dart';
|
import 'package:server_box/core/extension/context/locale.dart';
|
||||||
import 'package:server_box/core/utils/misc.dart';
|
import 'package:server_box/core/utils/misc.dart';
|
||||||
import 'package:server_box/data/res/store.dart';
|
import 'package:server_box/data/res/store.dart';
|
||||||
import 'package:server_box/view/page/setting/platform/platform_pub.dart';
|
|
||||||
import 'package:watch_connectivity/watch_connectivity.dart';
|
import 'package:watch_connectivity/watch_connectivity.dart';
|
||||||
|
|
||||||
class IosSettingsPage extends StatefulWidget {
|
class IosSettingsPage extends StatefulWidget {
|
||||||
@@ -12,10 +11,7 @@ class IosSettingsPage extends StatefulWidget {
|
|||||||
@override
|
@override
|
||||||
State<IosSettingsPage> createState() => _IosSettingsPageState();
|
State<IosSettingsPage> createState() => _IosSettingsPageState();
|
||||||
|
|
||||||
static const route = AppRouteNoArg(
|
static const route = AppRouteNoArg(page: IosSettingsPage.new, path: '/settings/ios');
|
||||||
page: IosSettingsPage.new,
|
|
||||||
path: '/settings/ios',
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _IosSettingsPageState extends State<IosSettingsPage> {
|
class _IosSettingsPageState extends State<IosSettingsPage> {
|
||||||
@@ -39,8 +35,6 @@ class _IosSettingsPageState extends State<IosSettingsPage> {
|
|||||||
_buildPushToken(),
|
_buildPushToken(),
|
||||||
_buildAutoUpdateHomeWidget(),
|
_buildAutoUpdateHomeWidget(),
|
||||||
_buildWatchApp(),
|
_buildWatchApp(),
|
||||||
if (BioAuth.isPlatformSupported)
|
|
||||||
PlatformPublicSettings.buildBioAuth(),
|
|
||||||
].map((e) => CardX(child: e)).toList(),
|
].map((e) => CardX(child: e)).toList(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -69,12 +63,7 @@ class _IosSettingsPageState extends State<IosSettingsPage> {
|
|||||||
error: (error, trace) => Text('${libL10n.error}: $error'),
|
error: (error, trace) => Text('${libL10n.error}: $error'),
|
||||||
success: (text) {
|
success: (text) {
|
||||||
_pushToken.value = text;
|
_pushToken.value = text;
|
||||||
return Text(
|
return Text(text ?? 'null', style: UIs.textGrey, overflow: TextOverflow.ellipsis, maxLines: 1);
|
||||||
text ?? 'null',
|
|
||||||
style: UIs.textGrey,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
maxLines: 1,
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -120,15 +109,14 @@ class _IosSettingsPageState extends State<IosSettingsPage> {
|
|||||||
|
|
||||||
void _onTapWatchApp(Map<String, dynamic> map) async {
|
void _onTapWatchApp(Map<String, dynamic> map) async {
|
||||||
final urls = Map<String, String>.from(map['urls'] as Map? ?? {});
|
final urls = Map<String, String>.from(map['urls'] as Map? ?? {});
|
||||||
final result = await KvEditor.route.go(
|
final result = await KvEditor.route.go(context, KvEditorArgs(data: urls));
|
||||||
context,
|
|
||||||
KvEditorArgs(data: urls),
|
|
||||||
);
|
|
||||||
if (result == null) return;
|
if (result == null) return;
|
||||||
|
|
||||||
final (_, err) = await context.showLoadingDialog(fn: () async {
|
final (_, err) = await context.showLoadingDialog(
|
||||||
|
fn: () async {
|
||||||
await wc.updateApplicationContext({'urls': result});
|
await wc.updateApplicationContext({'urls': result});
|
||||||
});
|
},
|
||||||
|
);
|
||||||
if (err == null) {
|
if (err == null) {
|
||||||
context.showSnackBar(libL10n.success);
|
context.showSnackBar(libL10n.success);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,8 +5,9 @@ import 'package:server_box/data/res/store.dart';
|
|||||||
abstract final class PlatformPublicSettings {
|
abstract final class PlatformPublicSettings {
|
||||||
static Widget buildBioAuth() {
|
static Widget buildBioAuth() {
|
||||||
return FutureWidget<bool>(
|
return FutureWidget<bool>(
|
||||||
future: BioAuth.isAvail,
|
future: LocalAuth.isAvail,
|
||||||
loading: ListTile(
|
loading: ListTile(
|
||||||
|
leading: const Icon(Icons.fingerprint),
|
||||||
title: Text(libL10n.bioAuth),
|
title: Text(libL10n.bioAuth),
|
||||||
subtitle: const Text('...', style: UIs.textGrey),
|
subtitle: const Text('...', style: UIs.textGrey),
|
||||||
),
|
),
|
||||||
@@ -15,15 +16,12 @@ abstract final class PlatformPublicSettings {
|
|||||||
subtitle: Text('${libL10n.fail}: $e', style: UIs.textGrey),
|
subtitle: Text('${libL10n.fail}: $e', style: UIs.textGrey),
|
||||||
),
|
),
|
||||||
success: (can) {
|
success: (can) {
|
||||||
|
can ??= false;
|
||||||
return ListTile(
|
return ListTile(
|
||||||
|
leading: const Icon(Icons.fingerprint),
|
||||||
title: Text(libL10n.bioAuth),
|
title: Text(libL10n.bioAuth),
|
||||||
subtitle: can == true
|
subtitle: can ? null : Text(libL10n.notExistFmt(libL10n.bioAuth), style: UIs.textGrey),
|
||||||
? null
|
trailing: can
|
||||||
: Text(
|
|
||||||
libL10n.notExistFmt(libL10n.bioAuth),
|
|
||||||
style: UIs.textGrey,
|
|
||||||
),
|
|
||||||
trailing: can == true
|
|
||||||
? StoreSwitch(
|
? StoreSwitch(
|
||||||
prop: Stores.setting.useBioAuth,
|
prop: Stores.setting.useBioAuth,
|
||||||
callback: (val) async {
|
callback: (val) async {
|
||||||
@@ -32,7 +30,7 @@ abstract final class PlatformPublicSettings {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Only auth when turn off (val == false)
|
// Only auth when turn off (val == false)
|
||||||
final result = await BioAuth.goWithResult();
|
final result = await LocalAuth.goWithResult();
|
||||||
// If failed, turn on again
|
// If failed, turn on again
|
||||||
if (result != AuthResult.success) {
|
if (result != AuthResult.success) {
|
||||||
Stores.setting.useBioAuth.put(true);
|
Stores.setting.useBioAuth.put(true);
|
||||||
|
|||||||
@@ -497,8 +497,8 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: "v1.0.316"
|
ref: "v1.0.317"
|
||||||
resolved-ref: "93da3ff5e042f9f0d29ace7b1ffeff5716fe2c81"
|
resolved-ref: "5fa0db6b5ebf3818a487696ff737c1d0fecce5c5"
|
||||||
url: "https://github.com/lppcg/fl_lib"
|
url: "https://github.com/lppcg/fl_lib"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
|||||||
62
pubspec.yaml
62
pubspec.yaml
@@ -62,7 +62,7 @@ dependencies:
|
|||||||
fl_lib:
|
fl_lib:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/lppcg/fl_lib
|
url: https://github.com/lppcg/fl_lib
|
||||||
ref: v1.0.316
|
ref: v1.0.317
|
||||||
|
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
# webdav_client_plus:
|
# webdav_client_plus:
|
||||||
@@ -106,15 +106,6 @@ flutter:
|
|||||||
- assets/app_icon.png
|
- assets/app_icon.png
|
||||||
# - images/a_dot_burr.jpeg
|
# - images/a_dot_burr.jpeg
|
||||||
# - images/a_dot_ham.jpeg
|
# - images/a_dot_ham.jpeg
|
||||||
# An image asset can refer to one or more resolution-specific "variants", see
|
|
||||||
# https://flutter.dev/assets-and-images/#resolution-aware.
|
|
||||||
# For details regarding adding assets from package dependencies, see
|
|
||||||
# https://flutter.dev/assets-and-images/#from-packages
|
|
||||||
# To add custom fonts to your application, add a fonts section here,
|
|
||||||
# in this "flutter" section. Each entry in this list should have a
|
|
||||||
# "family" key with the font family name, and a "fonts" key with a
|
|
||||||
# list giving the asset and other descriptors for the font. For
|
|
||||||
# example:
|
|
||||||
# fonts:
|
# fonts:
|
||||||
# - family: Schyler
|
# - family: Schyler
|
||||||
# fonts:
|
# fonts:
|
||||||
@@ -126,71 +117,20 @@ flutter:
|
|||||||
# - asset: fonts/TrajanPro.ttf
|
# - asset: fonts/TrajanPro.ttf
|
||||||
# - asset: fonts/TrajanPro_Bold.ttf
|
# - asset: fonts/TrajanPro_Bold.ttf
|
||||||
# weight: 700
|
# weight: 700
|
||||||
#
|
|
||||||
# For details regarding fonts from package dependencies,
|
|
||||||
# see https://flutter.dev/custom-fonts/#from-packages
|
|
||||||
flutter_native_splash:
|
flutter_native_splash:
|
||||||
# This package generates native code to customize Flutter's default white native splash screen
|
|
||||||
# with background color and splash image.
|
|
||||||
# Customize the parameters below, and run the following command in the terminal:
|
|
||||||
# flutter pub run flutter_native_splash:create
|
|
||||||
# To restore Flutter's default white splash screen, run the following command in the terminal:
|
|
||||||
# flutter pub run flutter_native_splash:remove
|
|
||||||
# color or background_image is the only required parameter. Use color to set the background
|
|
||||||
# of your splash screen to a solid color. Use background_image to set the background of your
|
|
||||||
# splash screen to a png image. This is useful for gradients. The image will be stretch to the
|
|
||||||
# size of the app. Only one parameter can be used, color and background_image cannot both be set.
|
|
||||||
color: "#ffffff"
|
color: "#ffffff"
|
||||||
#background_image: "assets/background.png"
|
|
||||||
# Optional parameters are listed below. To enable a parameter, uncomment the line by removing
|
|
||||||
# the leading # character.
|
|
||||||
# The image parameter allows you to specify an image used in the splash screen. It must be a
|
|
||||||
# png file and should be sized for 4x pixel density.
|
|
||||||
image: assets/app_icon.png
|
image: assets/app_icon.png
|
||||||
|
|
||||||
# The color_dark, background_image_dark, and image_dark are parameters that set the background
|
|
||||||
# and image when the device is in dark mode. If they are not specified, the app will use the
|
|
||||||
# parameters from above. If the image_dark parameter is specified, color_dark or
|
|
||||||
# background_image_dark must be specified. color_dark and background_image_dark cannot both be
|
|
||||||
# set.
|
|
||||||
color_dark: "#121212"
|
color_dark: "#121212"
|
||||||
#background_image_dark: "assets/dark-background.png"
|
#background_image_dark: "assets/dark-background.png"
|
||||||
#image_dark: assets/splash-invert.png
|
#image_dark: assets/splash-invert.png
|
||||||
# The android, ios and web parameters can be used to disable generating a splash screen on a given
|
|
||||||
# platform.
|
|
||||||
#android: false
|
#android: false
|
||||||
#ios: false
|
#ios: false
|
||||||
#web: false
|
#web: false
|
||||||
# The position of the splash image can be set with android_gravity, ios_content_mode, and
|
|
||||||
# web_image_mode parameters. All default to center.
|
|
||||||
#
|
|
||||||
# android_gravity can be one of the following Android Gravity (see
|
|
||||||
# https://developer.android.com/reference/android/view/Gravity): bottom, center,
|
|
||||||
# center_horizontal, center_vertical, clip_horizontal, clip_vertical, end, fill, fill_horizontal,
|
|
||||||
# fill_vertical, left, right, start, or top.
|
|
||||||
#android_gravity: center
|
#android_gravity: center
|
||||||
#
|
|
||||||
# ios_content_mode can be one of the following iOS UIView.ContentMode (see
|
|
||||||
# https://developer.apple.com/documentation/uikit/uiview/contentmode): scaleToFill,
|
|
||||||
# scaleAspectFit, scaleAspectFill, center, top, bottom, left, right, topLeft, topRight,
|
|
||||||
# bottomLeft, or bottomRight.
|
|
||||||
#ios_content_mode: center
|
#ios_content_mode: center
|
||||||
#
|
|
||||||
# web_image_mode can be one of the following modes: center, contain, stretch, and cover.
|
|
||||||
#web_image_mode: center
|
|
||||||
# To hide the notification bar, use the fullscreen parameter. Has no affect in web since web
|
|
||||||
# has no notification bar. Defaults to false.
|
|
||||||
# NOTE: Unlike Android, iOS will not automatically show the notification bar when the app loads.
|
|
||||||
# To show the notification bar, add the following code to your Flutter app:
|
|
||||||
# WidgetsFlutterBinding.ensureInitialized();
|
|
||||||
# SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom, SystemUiOverlay.top]);
|
|
||||||
#fullscreen: true
|
#fullscreen: true
|
||||||
# If you have changed the name(s) of your info.plist file(s), you can specify the filename(s)
|
|
||||||
# with the info_plist_files parameter. Remove only the # characters in the three lines below,
|
|
||||||
# do not remove any spaces:
|
|
||||||
info_plist_files:
|
info_plist_files:
|
||||||
- "ios/Runner/Info-Debug.plist"
|
- "ios/Runner/Info-Debug.plist"
|
||||||
- "ios/Runner/Info-Profile.plist"
|
- "ios/Runner/Info-Profile.plist"
|
||||||
- "ios/Runner/Info-Release.plist"
|
- "ios/Runner/Info-Release.plist"
|
||||||
# To enable support for Android 12, set the following parameter to true. Defaults to false.
|
|
||||||
android12: true
|
android12: true
|
||||||
|
|||||||
Reference in New Issue
Block a user