main.dart 944 B

123456789101112131415161718192021222324252627282930313233343536
  1. import 'dart:io';
  2. import 'package:canteen/pages/home_page.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:canteen/model/themes.dart';
  5. import 'package:flutter/services.dart';
  6. void main() {
  7. WidgetsFlutterBinding.ensureInitialized();
  8. // 竖屏
  9. SystemChrome.setPreferredOrientations([
  10. DeviceOrientation.portraitUp,
  11. DeviceOrientation.portraitDown,
  12. ]);
  13. //设置Android头部的导航栏透明
  14. if (Platform.isAndroid) {
  15. SystemChrome.setSystemUIOverlayStyle(
  16. const SystemUiOverlayStyle(statusBarColor: Colors.transparent));
  17. }
  18. runApp(const MyApp());
  19. }
  20. class MyApp extends StatelessWidget {
  21. const MyApp({Key? key}) : super(key: key);
  22. // This widget is the root of your application.
  23. @override
  24. Widget build(BuildContext context) {
  25. return MaterialApp(
  26. title: '食堂App',
  27. debugShowCheckedModeBanner: false,
  28. theme: Themes.defaultTheme,
  29. home: HomePage(),
  30. );
  31. }
  32. }