ui: update

This commit is contained in:
Simon Ding
2024-10-11 14:52:11 +08:00
parent 98fae05e16
commit f80ee71018

View File

@@ -16,7 +16,8 @@ import 'package:ui/welcome_page.dart';
import 'package:ui/widgets/utils.dart'; import 'package:ui/widgets/utils.dart';
void main() { void main() {
initializeDateFormatting().then((_) => runApp(MyApp())); initializeDateFormatting()
.then((_) => runApp(const ProviderScope(child: MyApp())));
} }
class MyApp extends ConsumerStatefulWidget { class MyApp extends ConsumerStatefulWidget {
@@ -45,15 +46,17 @@ CustomTransitionPage buildPageWithDefaultTransition<T>({
class _MyAppState extends ConsumerState<MyApp> { class _MyAppState extends ConsumerState<MyApp> {
// This widget is the root of your application. // This widget is the root of your application.
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var padding = isSmallScreen(context) ? 5.0 : 20.0;
// GoRouter configuration // GoRouter configuration
final shellRoute = ShellRoute( final shellRoute = ShellRoute(
builder: (BuildContext context, GoRouterState state, Widget child) { builder: (BuildContext context, GoRouterState state, Widget child) {
return SelectionArea( return SelectionArea(
child: MainSkeleton( child: MainSkeleton(
body: Padding( body: Padding(
padding: EdgeInsets.all(isSmallScreen(context) ? 5 : 20), padding: EdgeInsets.only(left: padding, right: padding, top: 5, bottom: 5),
child: child), child: child),
), ),
); );
@@ -125,28 +128,26 @@ class _MyAppState extends ConsumerState<MyApp> {
], ],
); );
return ProviderScope( return MaterialApp.router(
child: MaterialApp.router( title: 'Polaris 影视追踪下载',
title: 'Polaris 影视追踪下载', theme: ThemeData(
theme: ThemeData( fontFamily: "NotoSansSC",
fontFamily: "NotoSansSC", colorScheme: ColorScheme.fromSeed(
colorScheme: ColorScheme.fromSeed( seedColor: Colors.blueAccent,
seedColor: Colors.blueAccent, brightness: Brightness.dark,
brightness: Brightness.dark, surface: Colors.black87),
surface: Colors.black87), useMaterial3: true,
useMaterial3: true, //scaffoldBackgroundColor: Color.fromARGB(255, 26, 24, 24)
//scaffoldBackgroundColor: Color.fromARGB(255, 26, 24, 24) tooltipTheme: TooltipThemeData(
tooltipTheme: TooltipThemeData( textStyle: const TextStyle(
textStyle: const TextStyle( color: Colors.grey,
color: Colors.grey, ),
), decoration: BoxDecoration(
decoration: BoxDecoration( color: Colors.black54,
color: Colors.black54, borderRadius: BorderRadius.circular(20),
borderRadius: BorderRadius.circular(20), ),
), )),
)), routerConfig: router,
routerConfig: router,
),
); );
} }
} }
@@ -190,7 +191,7 @@ class _MainSkeletonState extends State<MainSkeleton> {
// the App.build method, and use it to set our appbar title. // the App.build method, and use it to set our appbar title.
title: TextButton( title: TextButton(
onPressed: () => context.go(WelcomePage.routeTv), onPressed: () => context.go(WelcomePage.routeTv),
child: Text( child: const Text(
"Polaris", "Polaris",
overflow: TextOverflow.clip, overflow: TextOverflow.clip,
style: TextStyle(fontSize: 28), style: TextStyle(fontSize: 28),