|
@@ -4,6 +4,8 @@ import 'package:flutter/material.dart';
|
|
|
import 'package:flutter/services.dart';
|
|
|
import 'package:flutter_clock/index_page.dart';
|
|
|
import 'package:flutter_clock/utils/app_utils.dart';
|
|
|
+import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
+import 'package:window_manager/window_manager.dart';
|
|
|
|
|
|
/// Description: enter point of the app
|
|
|
/// Time : 04/06/2025 Sunday
|
|
@@ -12,6 +14,29 @@ void main() async {
|
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
|
AppUtils.setOverrideForDesktop();
|
|
|
|
|
|
+ // Initialize window manager for desktop platforms
|
|
|
+ // if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {
|
|
|
+ // await windowManager.ensureInitialized();
|
|
|
+
|
|
|
+ // // Calculate window size with 16:9 portrait ratio
|
|
|
+ // // Common phone resolution is 1080x1920 (16:9 portrait)
|
|
|
+ // const double width = 360.0; // Phone width
|
|
|
+ // const double height = 640.0; // Phone height (16:9 ratio)
|
|
|
+
|
|
|
+ // WindowOptions windowOptions = WindowOptions(
|
|
|
+ // size: Size(width, height),
|
|
|
+ // center: true,
|
|
|
+ // backgroundColor: Colors.transparent,
|
|
|
+ // skipTaskbar: false,
|
|
|
+ // titleBarStyle: TitleBarStyle.normal,
|
|
|
+ // );
|
|
|
+
|
|
|
+ // await windowManager.waitUntilReadyToShow(windowOptions, () async {
|
|
|
+ // await windowManager.show();
|
|
|
+ // await windowManager.focus();
|
|
|
+ // });
|
|
|
+ // }
|
|
|
+
|
|
|
// Configure system settings for better background execution
|
|
|
if (Platform.isAndroid) {
|
|
|
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
|
|
@@ -31,15 +56,23 @@ void main() async {
|
|
|
class MyApp extends StatelessWidget {
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
- return MaterialApp(
|
|
|
- title: 'Flutter Clock',
|
|
|
- debugShowCheckedModeBanner: false,
|
|
|
- theme: ThemeData(
|
|
|
- primarySwatch: Colors.blue,
|
|
|
- visualDensity: VisualDensity.adaptivePlatformDensity,
|
|
|
- fontFamily: 'Roboto',
|
|
|
- ),
|
|
|
- home: IndexPage(),
|
|
|
+ // Initialize ScreenUtil for responsive UI
|
|
|
+ return ScreenUtilInit(
|
|
|
+ designSize: const Size(360, 640), // Base design size
|
|
|
+ minTextAdapt: true,
|
|
|
+ splitScreenMode: true,
|
|
|
+ builder: (context, child) {
|
|
|
+ return MaterialApp(
|
|
|
+ title: 'Flutter Clock',
|
|
|
+ debugShowCheckedModeBanner: false,
|
|
|
+ theme: ThemeData(
|
|
|
+ primarySwatch: Colors.blue,
|
|
|
+ visualDensity: VisualDensity.adaptivePlatformDensity,
|
|
|
+ fontFamily: 'Roboto',
|
|
|
+ ),
|
|
|
+ home: IndexPage(),
|
|
|
+ );
|
|
|
+ }
|
|
|
);
|
|
|
}
|
|
|
}
|