diff --git a/lib/homepage.dart b/lib/homepage.dart index fe64fa2..38599ce 100644 --- a/lib/homepage.dart +++ b/lib/homepage.dart @@ -457,70 +457,106 @@ class _HomePageState extends State { query.size.width > query.size.height); final page = Center( child: Container( - padding: isLandscape? EdgeInsets.zero : const EdgeInsets.all(16.0), constraints: BoxConstraints( minHeight: MediaQuery.of(context).size.height - 34, minWidth: double.infinity), - child: - isLandscape? + child: isLandscape + ? /// ================== /// The windows layout /// ================== - DesktopTabBar( - tabs: [ - DesktopTabData(icon: const Icon(Icons.featured_play_list), title: const Text("Projects")), - DesktopTabData(icon: const Icon(Icons.input), title: const Text("Plugins")), - DesktopTabData(icon: const Icon(Icons.settings), title: const Text("Settings")), - ], - content:[ - Column(children:projectsWidgetList), - const PluginsBrowser(), - SettingsPage(mm), - ]) + DesktopTabBar(tabs: [ + DesktopTabData( + icon: const Icon(Icons.featured_play_list), + title: const Text("Projects")), + DesktopTabData( + icon: const Icon(Icons.input), title: const Text("Plugins")), + DesktopTabData( + icon: const Icon(Icons.settings), + title: const Text("Settings")), + ], content: [ + Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Row(children: [ + const Text( + "Recent Projects", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 24.0, + ), + ), + const Spacer(flex: 1), + OutlinedButton( + onPressed: () { + refreshRecentProjects(); + }, + child: const Text("Refresh"), + ), + OutlinedButton( + onPressed: () {}, + child: const Text("Add"), + ), + ]), + Column( + children: projectsWidgetList, + ) + ])), + const PluginsBrowser(), + SettingsPage(mm), + ]) : /// ================== /// The android layout /// ================== - Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - Row(children: [ - const Text( - "Recent Projects", - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 24.0, + Padding( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Row(children: [ + const Text( + "Recent Projects", + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 24.0, + ), ), - ), - const Spacer(flex: 1), - OutlinedButton( - onPressed: () { - refreshRecentProjects(); - }, - child: const Text("Refresh"), - ), - OutlinedButton( - onPressed: () {}, - child: const Text("Add"), - ), - ]), - Column( - children: projectsWidgetList, - ) - ]), + const Spacer(flex: 1), + OutlinedButton( + onPressed: () { + refreshRecentProjects(); + }, + child: const Text("Refresh"), + ), + OutlinedButton( + onPressed: () {}, + child: const Text("Add"), + ), + ]), + Column( + children: projectsWidgetList, + ) + ])), )); return Scaffold( - appBar: CoreCoderApp.isLandscape(context)? null: AppBar( - title: const Text("CoreCoder Develop"), - centerTitle: true, - actions: [ - IconButton( - onPressed: () => {showSettings()}, - icon: const Icon(Icons.settings), - tooltip: "Settings"), - const SizedBox(width: 16.0), - ], - ), + appBar: CoreCoderApp.isLandscape(context) + ? null + : AppBar( + title: const Text("CoreCoder Develop"), + centerTitle: true, + actions: [ + IconButton( + onPressed: () => {showSettings()}, + icon: const Icon(Icons.settings), + tooltip: "Settings"), + const SizedBox(width: 16.0), + ], + ), body: SingleChildScrollView(child: page), floatingActionButton: FloatingActionButton( onPressed: () => showCreateProjectDialog(), diff --git a/lib/main.dart b/lib/main.dart index cad3514..fef537c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -14,7 +14,7 @@ import 'package:bitsdojo_window/bitsdojo_window.dart'; void main() async { runApp(const CoreCoderApp()); - if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) { + if (CoreCoderApp.isDesktop) { doWhenWindowReady(() { const initialSize = Size(800, 600); appWindow.minSize = const Size(256, 256); @@ -88,6 +88,7 @@ class CoreCoderAppState extends State { child: Column( children: [ // The title bar + if(CoreCoderApp.isDesktop) WindowTitleBarBox( child: Row(children: [ Expanded( @@ -127,24 +128,25 @@ class CoreCoderAppState extends State { } } -final buttonColors = WindowButtonColors( - iconNormal: borderColor, - mouseOver: Color(0xFFF6A00C), - mouseDown: Color(0xFF805306), - iconMouseOver: Color(0xFF805306), - iconMouseDown: Color(0xFFFFD500)); - -final closeButtonColors = WindowButtonColors( - mouseOver: const Color(0xFFD32F2F), - mouseDown: const Color(0xFFB71C1C), - iconNormal: borderColor, - iconMouseOver: Colors.white); - class WindowButtons extends StatelessWidget { const WindowButtons({Key? key}) : super(key: key); @override Widget build(BuildContext context) { + var theme = Theme.of(context); + var buttonColors = WindowButtonColors( + mouseOver: theme.canvasColor, + mouseDown: theme.backgroundColor, + iconNormal: theme.textTheme.bodyText1?.color, + iconMouseOver: theme.textTheme.bodyText1?.color, + iconMouseDown: theme.textTheme.bodyText1?.color); + + var closeButtonColors = WindowButtonColors( + mouseOver: const Color(0xFFD32F2F), + mouseDown: const Color(0xFFB71C1C), + iconNormal: theme.textTheme.bodyText1?.color, + iconMouseOver: theme.textTheme.bodyText1?.color); + return Row( children: [ MinimizeWindowButton(colors: buttonColors),