11import 'dart:async' ;
22import 'dart:io' ;
33
4+ import 'package:corecoder_develop/screens/editor/editor_console.dart' ;
45import 'package:corecoder_develop/util/custom_code_box.dart' show InnerField;
56import 'package:corecoder_develop/screens/editor/editor_drawer.dart' ;
67import 'package:corecoder_develop/util/modules_manager.dart' ;
@@ -37,6 +38,8 @@ class _EditorPageState extends State<EditorPage> {
3738 double autoCompleteX = 0 ;
3839 double autoCompleteY = 0 ;
3940 int ? selectedTab;
41+ EditorConsoleController consoleController = EditorConsoleController ();
42+ bool showConsole = true ;
4043
4144 @override
4245 void initState () {
@@ -330,6 +333,7 @@ class _EditorPageState extends State<EditorPage> {
330333 @override
331334 Widget build (BuildContext context) {
332335 project = ModalRoute .of (context)! .settings.arguments as CCSolution ;
336+ var query = MediaQuery .of (context);
333337 if (documentList.isEmpty) {
334338 // Populate the file browser tree once
335339 initializeTreeView ();
@@ -375,7 +379,15 @@ class _EditorPageState extends State<EditorPage> {
375379 color: ThemeManager .getThemeSchemeColor ("foreground" ),
376380 child: Material (
377381 child: ListView (
378- children: getAutoCompleteControls (null ))))))
382+ children: getAutoCompleteControls (null )))))),
383+ if (showConsole)
384+ Positioned (
385+ left: 0 ,
386+ top: query.size.height / 2 ,
387+ height: query.size.height / 2 ,
388+ width: query.size.width,
389+ child: EditorConsole (controller: consoleController),
390+ )
379391 ]);
380392
381393 return Scaffold (
@@ -388,28 +400,40 @@ class _EditorPageState extends State<EditorPage> {
388400 centerTitle: false ,
389401 actions: [
390402 IconButton (
391- onPressed: () => {project.run ()},
403+ onPressed: () {
404+ project.run (consoleController);
405+ },
392406 icon: const Icon (Icons .play_arrow),
393407 tooltip: "Run Project" ,
394408 ),
395409 IconButton (
396- onPressed: () => {},
410+ onPressed: () {
411+ setState (() {
412+ /// Toggle the console
413+ showConsole = ! showConsole;
414+ });
415+ },
397416 icon: const Icon (Icons .assessment_rounded),
398417 tooltip: "Toggle Console" ,
399418 ),
400419 PopupMenuButton (
401420 child: const Icon (Icons .more_horiz),
402421 tooltip: "Menu" ,
403422 padding: const EdgeInsets .all (32.0 ),
404- itemBuilder: (BuildContext context){
405- return < PopupMenuEntry > [
406- PopupMenuItem (child: const Text ("Close Project" ),onTap: ()=> Navigator .pop (context),)
407- ];
408- },),
423+ itemBuilder: (BuildContext context) {
424+ return < PopupMenuEntry > [
425+ PopupMenuItem (
426+ child: const Text ("Close Project" ),
427+ onTap: () => Navigator .pop (context),
428+ )
429+ ];
430+ },
431+ ),
409432 const SizedBox (width: 16.0 ),
410433 ],
411434 ),
412- body: page,
435+ body:
436+ page
413437 );
414438 }
415439}
0 commit comments