feat: 请求数据和配置
This commit is contained in:
1 parent
557f900187
commit
9b0fe51fa4
21 files changed
+1026
-60
No files matched your search
@@ -15,6 +15,7 @@ class ConstImage {
|
||||
static const String btCollectSel = "assets/main/bt_collect_seled.png";
|
||||
static const String btMineSel = "assets/main/bt_mine_seled.png";
|
||||
static const String spaceImg = "assets/main/space_img.png";
|
||||
static const String launcher = "assets/main/launcher.png";
|
||||
|
||||
/// imgs
|
||||
static const String searchBg = "assets/imgs/search_bg.png";
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
|
||||
import 'package:get/get.dart';
|
||||
import 'package:novyronst/pages/play/pages/laucher_page.dart';
|
||||
|
||||
class HelpRouters {
|
||||
static const String launcher = '/launcher';
|
||||
}
|
||||
|
||||
class HelpPages {
|
||||
static const initial = HelpRouters.launcher;
|
||||
|
||||
static final List<GetPage> routes = [
|
||||
routePage(name: HelpRouters.launcher, page: ()=> LauncherPage())
|
||||
];
|
||||
}
|
||||
|
||||
GetPage routePage({
|
||||
required String name,
|
||||
required GetPageBuilder page,
|
||||
Bindings? binding,
|
||||
Transition transition = Transition.rightToLeft,
|
||||
Duration transitionDuration = const Duration(milliseconds: 300),
|
||||
CustomTransition? customTransition,
|
||||
bool popGesture = true, // Allow iOS swipe-back gesture by default
|
||||
}) {
|
||||
return GetPage(
|
||||
name: name,
|
||||
page: page,
|
||||
binding: binding,
|
||||
transition: transition,
|
||||
transitionDuration: transitionDuration,
|
||||
customTransition: customTransition,
|
||||
popGesture: popGesture, // Pass through to GetPage
|
||||
);
|
||||
}
|
||||
@@ -65,7 +65,6 @@ class HelpToken {
|
||||
}
|
||||
}
|
||||
|
||||
// ============ 便捷属性 ============
|
||||
|
||||
/// 判断 Token 是否为空
|
||||
bool get isEmpty => get().isEmpty;
|
||||
@@ -82,7 +81,6 @@ class HelpToken {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ============ 用户信息扩展(原项目没有,但建议加上) ============
|
||||
|
||||
/// 保存用户信息
|
||||
void saveUserInfo(Map<String, dynamic> userInfo) {
|
||||
@@ -107,12 +105,9 @@ class HelpToken {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ============ 私有存储方法 ============
|
||||
|
||||
String? _getFromStorage(String key) {
|
||||
try {
|
||||
// 使用 SharedPreferences 同步获取(但 SharedPreferences 是异步的)
|
||||
// 为了保持与原项目一致的同步接口,这里使用异步转同步
|
||||
// 但更好的方式是在初始化时预加载
|
||||
return _getFromStorageSync(key);
|
||||
} catch (e) {
|
||||
@@ -121,13 +116,9 @@ class HelpToken {
|
||||
}
|
||||
}
|
||||
|
||||
// 同步读取(注意:SharedPreferences 本身是异步的,这里用同步方式需要谨慎)
|
||||
String? _getFromStorageSync(String key) {
|
||||
// 由于 SharedPreferences 是异步的,我们使用一个全局缓存
|
||||
// 实际项目中建议在 main 中调用 init() 预加载
|
||||
try {
|
||||
// 这里为了简化,直接返回 null,实际应该用异步方式
|
||||
// 建议使用下面的异步版本
|
||||
return null;
|
||||
} catch (_) {
|
||||
return null;
|
||||
|
||||
Reference in new issue
Block a user