import 'package:flutter/material.dart'; import 'screens/login_screen.dart'; import 'screens/activity_list_screen.dart'; import 'package:shared_preferences/shared_preferences.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); final prefs = await SharedPreferences.getInstance(); final token = prefs.getString('auth_token'); final isLoggedIn = token != null && token.isNotEmpty; runApp(BanxiangApp(isLoggedIn: isLoggedIn)); } class BanxiangApp extends StatelessWidget { final bool isLoggedIn; const BanxiangApp({required this.isLoggedIn}); @override Widget build(BuildContext context) { return MaterialApp( title: '伴享', debugShowCheckedModeBanner: false, theme: ThemeData( primaryColor: Color(0xFFFF6B35), scaffoldBackgroundColor: const Color(0xFFFFF8F0), appBarTheme: AppBarTheme( backgroundColor: Colors.white, foregroundColor: Color(0xFF333333), elevation: 0, ), bottomNavigationBarTheme: BottomNavigationBarThemeData( selectedItemColor: Color(0xFFFF6B35), unselectedItemColor: Color(0xFF999999), backgroundColor: Colors.white, type: BottomNavigationBarType.fixed, ), colorScheme: ColorScheme.fromSeed( seedColor: Color(0xFFFF6B35), primary: Color(0xFFFF6B35), secondary: Color(0xFFFFB84D), ), ), home: isLoggedIn ? ActivityListScreen() : LoginScreen(), ); } }