main.dart 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import 'dart:io';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter/services.dart';
  4. import 'package:flutter_clock/index_page.dart';
  5. import 'package:flutter_clock/utils/app_utils.dart';
  6. /// Description: enter point of the app
  7. /// Time : 04/06/2025 Sunday
  8. /// Author : liuyuqi.gov@msn.cn
  9. void main() async {
  10. WidgetsFlutterBinding.ensureInitialized();
  11. AppUtils.setOverrideForDesktop();
  12. // Configure system settings for better background execution
  13. if (Platform.isAndroid) {
  14. SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
  15. statusBarColor: Colors.transparent,
  16. statusBarIconBrightness: Brightness.dark,
  17. ));
  18. // Prevent app from being killed in background
  19. SystemChannels.platform.invokeMethod('SystemChrome.setEnabledSystemUIMode', [
  20. SystemUiMode.edgeToEdge.index,
  21. ]);
  22. }
  23. runApp(MyApp());
  24. }
  25. class MyApp extends StatelessWidget {
  26. @override
  27. Widget build(BuildContext context) {
  28. return MaterialApp(
  29. title: 'Flutter Clock',
  30. debugShowCheckedModeBanner: false,
  31. theme: ThemeData(
  32. primarySwatch: Colors.blue,
  33. visualDensity: VisualDensity.adaptivePlatformDensity,
  34. fontFamily: 'Roboto',
  35. ),
  36. home: IndexPage(),
  37. );
  38. }
  39. }