@@ -10,11 +10,22 @@ 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);
@@ -25,8 +36,10 @@ class CoreCoderApp extends StatefulWidget {
2536 }
2637}
2738
28- class CoreCoderAppState extends State <CoreCoderApp >{
39+ class CoreCoderAppState extends State <CoreCoderApp > {
2940 String themeName = "core-coder-dark" ;
41+ var borderColor = Colors .black;
42+
3043 @override
3144 void initState () {
3245 super .initState ();
@@ -35,7 +48,7 @@ class CoreCoderAppState extends State<CoreCoderApp>{
3548 themeName = ThemeManager .currentTheme.value;
3649 });
3750 });
38- if (Platform .isWindows) {
51+ if (Platform .isWindows) {
3952 /// On windows, get the runtime arguments
4053 /// this is provided by windows when you "Open with" CoreCoder
4154 /// the result is a string to the absolute path of the file
@@ -50,22 +63,73 @@ class CoreCoderAppState extends State<CoreCoderApp>{
5063 @override
5164 Widget build (BuildContext context) {
5265 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- ),
66+ child: WindowBorder (
67+ color: borderColor,
68+ child: MaterialApp (
69+ debugShowCheckedModeBanner: false ,
70+ title: 'CoreCoder Develop' ,
71+ theme: ThemeManager .getThemeData (themeName: themeName),
72+ //home: HomePage(),
73+ initialRoute: "/" ,
74+ routes: {
75+ "/" : (context) => HomePage (),
76+ EditorPage .routeName: (context) => const EditorPage (),
77+ PluginsBrowser .routeName: (context) => const PluginsBrowser ()
78+ },
79+ builder: (BuildContext context, Widget ? widget) {
80+ borderColor = Theme .of (context).primaryColor;
81+ return Container (
82+ color: Theme .of (context).colorScheme.background,
83+ child: Column (
84+ children: [
85+ // The title bar
86+ WindowTitleBarBox (
87+ child: Row (children: [
88+ Expanded (child: MoveWindow (child: Row (children: [
89+ const SizedBox (width: 16.0 ,),
90+ Image .asset ("assets/logo.png" ,width: 20 ,height: 20 ,),
91+ const SizedBox (width: 16.0 ,),
92+ Text ("CoreCoder v0.0.1" , style: Theme .of (context).textTheme.bodyText1! ,)
93+ ]),)),
94+ const WindowButtons ()
95+ ])),
96+ if (widget != null ) Expanded (child: widget)
97+ ],
98+ ));
99+ },
100+ )),
65101 providers: < SingleChildWidget > [
66102 ChangeNotifierProvider <DrawerStateInfo >(
67103 create: (_) => DrawerStateInfo ()),
68104 ],
69105 );
70106 }
71107}
108+
109+ final buttonColors = WindowButtonColors (
110+ iconNormal: borderColor,
111+ mouseOver: Color (0xFFF6A00C ),
112+ mouseDown: Color (0xFF805306 ),
113+ iconMouseOver: Color (0xFF805306 ),
114+ iconMouseDown: Color (0xFFFFD500 ));
115+
116+ final closeButtonColors = WindowButtonColors (
117+ mouseOver: const Color (0xFFD32F2F ),
118+ mouseDown: const Color (0xFFB71C1C ),
119+ iconNormal: borderColor,
120+ iconMouseOver: Colors .white);
121+
122+ class WindowButtons extends StatelessWidget {
123+ const WindowButtons ({Key ? key}) : super (key: key);
124+
125+ @override
126+ Widget build (BuildContext context) {
127+ return Row (
128+ children: [
129+ MinimizeWindowButton (colors: buttonColors),
130+ MaximizeWindowButton (colors: buttonColors),
131+ CloseWindowButton (colors: closeButtonColors),
132+ ],
133+ );
134+ }
135+ }
0 commit comments