@@ -10,23 +10,41 @@ import 'package:provider/provider.dart';
1010import 'package:provider/single_child_widget.dart' ;
1111import 'homepage.dart' ;
1212import 'editor_drawer.dart' ;
13+ import 'package:bitsdojo_window/bitsdojo_window.dart' ;
1314
14- void main () async {
15+ void main () async {
1516 runApp (const CoreCoderApp ());
17+ if (Platform .isWindows || Platform .isLinux || Platform .isMacOS) {
18+ doWhenWindowReady (() {
19+ const initialSize = Size (800 , 600 );
20+ appWindow.minSize = const Size (256 , 256 );
21+ appWindow.size = initialSize;
22+ appWindow.alignment = Alignment .center;
23+ appWindow.show ();
24+ });
25+ }
1626}
1727
28+ const borderColor = Color (0xFF3BBA73 );
1829
1930class CoreCoderApp extends StatefulWidget {
2031 const CoreCoderApp ({Key ? key}) : super (key: key);
21-
32+ static const String version = "v0.0.1" ;
33+ static bool isDesktop = (Platform .isWindows || Platform .isLinux || Platform .isMacOS);
34+ static bool isLandscape (BuildContext context){
35+ var q = MediaQuery .of (context);
36+ return q.orientation == Orientation .landscape || q.size.width > q.size.height;
37+ }
2238 @override
2339 State <StatefulWidget > createState () {
2440 return CoreCoderAppState ();
2541 }
2642}
2743
28- class CoreCoderAppState extends State <CoreCoderApp >{
44+ class CoreCoderAppState extends State <CoreCoderApp > {
2945 String themeName = "core-coder-dark" ;
46+ var borderColor = Colors .black;
47+
3048 @override
3149 void initState () {
3250 super .initState ();
@@ -35,7 +53,7 @@ class CoreCoderAppState extends State<CoreCoderApp>{
3553 themeName = ThemeManager .currentTheme.value;
3654 });
3755 });
38- if (Platform .isWindows) {
56+ if (Platform .isWindows) {
3957 /// On windows, get the runtime arguments
4058 /// this is provided by windows when you "Open with" CoreCoder
4159 /// the result is a string to the absolute path of the file
@@ -50,22 +68,89 @@ class CoreCoderAppState extends State<CoreCoderApp>{
5068 @override
5169 Widget build (BuildContext context) {
5270 return MultiProvider (
53- child: MaterialApp (
54- debugShowCheckedModeBanner: false ,
55- title: 'CoreCoder Develop' ,
56- theme: ThemeManager .getThemeData (themeName: themeName),
57- //home: HomePage(),
58- initialRoute: "/" ,
59- routes: {
60- "/" : (context) => HomePage (),
61- EditorPage .routeName: (context) => const EditorPage (),
62- PluginsBrowser .routeName: (context) => const PluginsBrowser ()
63- },
64- ),
71+ child: WindowBorder (
72+ color: borderColor,
73+ child: MaterialApp (
74+ debugShowCheckedModeBanner: false ,
75+ title: 'CoreCoder Develop' ,
76+ theme: ThemeManager .getThemeData (themeName: themeName),
77+ //home: HomePage(),
78+ initialRoute: "/" ,
79+ routes: {
80+ "/" : (context) => HomePage (),
81+ EditorPage .routeName: (context) => const EditorPage (),
82+ PluginsBrowser .routeName: (context) => const PluginsBrowser ()
83+ },
84+ builder: (BuildContext context, Widget ? widget) {
85+ borderColor = Theme .of (context).primaryColor;
86+ return Container (
87+ color: Theme .of (context).colorScheme.background,
88+ child: Column (
89+ children: [
90+ // The title bar
91+ WindowTitleBarBox (
92+ child: Row (children: [
93+ Expanded (
94+ child: MoveWindow (
95+ child: Row (children: [
96+ const SizedBox (
97+ width: 16.0 ,
98+ ),
99+ Image .asset (
100+ "assets/logo.png" ,
101+ isAntiAlias: true ,
102+ filterQuality: FilterQuality .high,
103+ width: 20 ,
104+ height: 20 ,
105+ ),
106+ const SizedBox (
107+ width: 16.0 ,
108+ ),
109+ Text (
110+ "CoreCoder:Develop ${CoreCoderApp .version }" ,
111+ style: Theme .of (context).textTheme.bodyText1! ,
112+ )
113+ ]),
114+ )),
115+ const WindowButtons ()
116+ ])),
117+ if (widget != null ) Expanded (child: widget)
118+ ],
119+ ));
120+ },
121+ )),
65122 providers: < SingleChildWidget > [
66123 ChangeNotifierProvider <DrawerStateInfo >(
67124 create: (_) => DrawerStateInfo ()),
68125 ],
69126 );
70127 }
71128}
129+
130+ final buttonColors = WindowButtonColors (
131+ iconNormal: borderColor,
132+ mouseOver: Color (0xFFF6A00C ),
133+ mouseDown: Color (0xFF805306 ),
134+ iconMouseOver: Color (0xFF805306 ),
135+ iconMouseDown: Color (0xFFFFD500 ));
136+
137+ final closeButtonColors = WindowButtonColors (
138+ mouseOver: const Color (0xFFD32F2F ),
139+ mouseDown: const Color (0xFFB71C1C ),
140+ iconNormal: borderColor,
141+ iconMouseOver: Colors .white);
142+
143+ class WindowButtons extends StatelessWidget {
144+ const WindowButtons ({Key ? key}) : super (key: key);
145+
146+ @override
147+ Widget build (BuildContext context) {
148+ return Row (
149+ children: [
150+ MinimizeWindowButton (colors: buttonColors),
151+ MaximizeWindowButton (colors: buttonColors),
152+ CloseWindowButton (colors: closeButtonColors),
153+ ],
154+ );
155+ }
156+ }
0 commit comments