feat:参照研听的基础工程
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
|
||||
import '../common/router/app_router.dart';
|
||||
import '../common/theme/jinzhi_theme.dart';
|
||||
import '../common/theme/spacing.dart';
|
||||
import '../common/theme/theme_controller.dart';
|
||||
|
||||
class JinzhiApp extends ConsumerWidget {
|
||||
const JinzhiApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final router = ref.watch(routerProvider);
|
||||
final mode = ref.watch(themeModeControllerProvider);
|
||||
// DM Sans 作主字体(拉丁/数字),中文走系统级联(iOS 苹方 / Android 厂商
|
||||
// 中文字体)——主流做法,不显式点名、不内置字体。
|
||||
final dmSansFamily = GoogleFonts.dmSans().fontFamily;
|
||||
final textTheme = ShadTextTheme(family: dmSansFamily);
|
||||
return ShadApp.router(
|
||||
title: '金值',
|
||||
themeMode: mode,
|
||||
theme: ShadThemeData(
|
||||
brightness: Brightness.light,
|
||||
colorScheme: jinzhiLightScheme,
|
||||
textTheme: textTheme,
|
||||
radius: BorderRadius.circular(Spacing.radiusBase),
|
||||
),
|
||||
darkTheme: ShadThemeData(
|
||||
brightness: Brightness.dark,
|
||||
colorScheme: jinzhiDarkScheme,
|
||||
textTheme: textTheme,
|
||||
radius: BorderRadius.circular(Spacing.radiusBase),
|
||||
),
|
||||
routerConfig: router,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
import 'package:flutter/foundation.dart' show kIsWeb;
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import '../common/services/device_header_service.dart';
|
||||
import '../common/storage/storage_service.dart';
|
||||
import 'app.dart';
|
||||
|
||||
Future<Widget> bootstrap() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
await StorageService.instance;
|
||||
if (!kIsWeb) {
|
||||
if (Platform.isAndroid) {
|
||||
// Before consent this only initializes app version and channel. The
|
||||
// service resumes device identity initialization after consent.
|
||||
await DeviceHeaderService.to.ensureInitialized();
|
||||
} else {
|
||||
await DeviceHeaderService.to.ensureInitialized();
|
||||
}
|
||||
}
|
||||
// if (!kIsWeb) {
|
||||
// await ShorebirdService.instance.initCurrentPatch();
|
||||
// ShorebirdService.instance.checkForUpdateInBackground();
|
||||
// }
|
||||
return const JinzhiApp();
|
||||
}
|
||||
Reference in New Issue
Block a user