Skip to content

Commit cd326ef

Browse files
committed
Finalizing the homepage
1 parent 0e6f268 commit cd326ef

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

lib/homepage.dart

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:io';
22

3+
import 'package:corecoder_develop/plugins_browser.dart';
34
import 'package:corecoder_develop/settings.dart';
45
import 'package:corecoder_develop/util/cc_project_structure.dart';
56
import 'package:corecoder_develop/util/desktop_tabbar.dart';
@@ -8,6 +9,7 @@ import 'package:flutter/material.dart';
89
import 'package:flutter/widgets.dart';
910

1011
import 'editor.dart';
12+
import 'main.dart';
1113
import 'util/modules_manager.dart';
1214

1315
import 'package:shared_preferences/shared_preferences.dart';
@@ -106,7 +108,7 @@ class _HomePageState extends State<HomePage> {
106108
late ModulesManager mm;
107109
final Future<SharedPreferences> _pref = SharedPreferences.getInstance();
108110

109-
List<Widget> get projectWidgetsMobile {
111+
List<Widget> get projectsWidgetList {
110112
var result = <Widget>[];
111113
for (HistoryItem p in RecentProjectsManager.instance.projects) {
112114
// if (p.name == "") {
@@ -457,7 +459,7 @@ class _HomePageState extends State<HomePage> {
457459
child: Container(
458460
padding: isLandscape? EdgeInsets.zero : const EdgeInsets.all(16.0),
459461
constraints: BoxConstraints(
460-
minHeight: MediaQuery.of(context).size.height - 50,
462+
minHeight: MediaQuery.of(context).size.height - 34,
461463
minWidth: double.infinity),
462464
child:
463465
isLandscape?
@@ -468,13 +470,13 @@ class _HomePageState extends State<HomePage> {
468470
DesktopTabBar(
469471
tabs: <DesktopTabData>[
470472
DesktopTabData(icon: const Icon(Icons.featured_play_list), title: const Text("Projects")),
471-
DesktopTabData(icon: const Icon(Icons.featured_play_list), title: const Text("Plugins")),
472-
DesktopTabData(icon: const Icon(Icons.featured_play_list), title: const Text("Examples")),
473+
DesktopTabData(icon: const Icon(Icons.input), title: const Text("Plugins")),
474+
DesktopTabData(icon: const Icon(Icons.settings), title: const Text("Settings")),
473475
],
474476
content:<Widget>[
475-
Column(children:projectWidgetsMobile),
476-
Column(),
477-
Column(),
477+
Column(children:projectsWidgetList),
478+
const PluginsBrowser(),
479+
SettingsPage(mm),
478480
])
479481
:
480482

@@ -503,12 +505,12 @@ class _HomePageState extends State<HomePage> {
503505
),
504506
]),
505507
Column(
506-
children: projectWidgetsMobile,
508+
children: projectsWidgetList,
507509
)
508510
]),
509511
));
510512
return Scaffold(
511-
appBar: AppBar(
513+
appBar: CoreCoderApp.isLandscape(context)? null: AppBar(
512514
title: const Text("CoreCoder Develop"),
513515
centerTitle: true,
514516
actions: [

lib/main.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ const borderColor = Color(0xFF3BBA73);
3030
class CoreCoderApp extends StatefulWidget {
3131
const CoreCoderApp({Key? key}) : super(key: key);
3232
static const String version = "v0.0.1";
33-
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+
}
3438
@override
3539
State<StatefulWidget> createState() {
3640
return CoreCoderAppState();

lib/plugins_browser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ class PluginsBrowserState extends State<PluginsBrowser> {
141141
obj[key]["identifier"], isInstalled
142142
));
143143
}
144+
setState(() {}); // refresh
144145
}
145-
setState(() {}); // refresh
146146
}
147147

148148
@override

0 commit comments

Comments
 (0)