import 'package:flutter/material.dart'; import 'package:music_player_miao/common_widget/app_data.dart'; import 'package:music_player_miao/view/begin/begin_view.dart'; import 'package:music_player_miao/view/begin/login_v.dart'; import 'package:music_player_miao/view/home_view.dart'; import 'package:music_player_miao/view/splash_view.dart'; import 'package:get/get.dart'; import 'dart:io'; import 'package:flutter/services.dart'; import 'package:music_player_miao/view/user/user_view.dart'; void main(){ WidgetsFlutterBinding.ensureInitialized(); Get.put(AppData()); runApp( const MyApp()); if (Platform.isAndroid) { SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(statusBarColor: Colors.transparent); SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle.dark); } } class MyApp extends StatelessWidget { const MyApp({super.key}); @override Widget build(BuildContext context) { return GetMaterialApp( title: 'Flutter Demo', initialRoute: '/login', // 初始路由 routes: { '/': (context) => HomeView(), // 定义首页路由 '/user': (context) => UserView(), '/login' : (context) => BeginView()// 定义UserView的路由 }, ); } }