feat(auth): 登录页改为 ymb 品牌并支持后台配置背景图
This commit is contained in:
1 parent
22cc669bbe
commit
e7399fa3fd
24 files changed
+378
-188
No files matched your search
@@ -0,0 +1,31 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import '../remote/config_api.dart';
|
||||
|
||||
/// 后台下发的启动配置。
|
||||
///
|
||||
/// 失败一律静默:拿不到就用 App 内置默认,不阻塞启动、不弹错。
|
||||
class AppConfigController extends ChangeNotifier {
|
||||
AppConfigController(this._api);
|
||||
|
||||
final ConfigApi _api;
|
||||
|
||||
String _loginBackgroundUrl = '';
|
||||
|
||||
/// 登录页整屏背景图;空串表示用本地默认图。
|
||||
String get loginBackgroundUrl => _loginBackgroundUrl;
|
||||
|
||||
Future<void> load() async {
|
||||
try {
|
||||
final config = await _api.appConfig();
|
||||
final url = (config['loginBackgroundUrl'] as String? ?? '').trim();
|
||||
if (url == _loginBackgroundUrl) return;
|
||||
_loginBackgroundUrl = url;
|
||||
notifyListeners();
|
||||
} catch (error) {
|
||||
debugPrint('[config] load failed: $error');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user