@@ -4,6 +4,7 @@ import 'dart:io';
44import 'package:corecoder_develop/modules/module_jsplugins.dart' ;
55import 'package:corecoder_develop/util/modules_manager.dart' ;
66import 'package:corecoder_develop/util/plugins_manager.dart' ;
7+ import 'package:flutter/cupertino.dart' ;
78import 'package:flutter/material.dart' ;
89import 'package:http/http.dart' as http;
910import 'package:http/http.dart' ;
@@ -12,8 +13,9 @@ import 'package:archive/archive.dart';
1213
1314class PluginsBrowser extends StatefulWidget {
1415 static const routeName = "/Settings/PluginsManager/" ;
16+ final ModulesManager modulesManager;
1517
16- const PluginsBrowser ({Key ? key}) : super (key: key);
18+ const PluginsBrowser ({Key ? key, required this .modulesManager }) : super (key: key);
1719
1820 @override
1921 State <StatefulWidget > createState () => PluginsBrowserState ();
@@ -56,13 +58,26 @@ class PluginsBrowserState extends State<PluginsBrowser> {
5658 var path = module.moduleFolder;
5759 await Directory (path).delete (recursive: true );
5860 ModulesManager .externalModules.remove (module);
59- item.isInstalled = false ;
61+ // Refresh the modules manager
62+ widget.modulesManager.onInitialized (context);
63+ setState (() {
64+ item.isProcessing = false ;
65+ item.isInstalled = false ;
66+ });
6067 } else {
68+ setState (() {
69+ item.isInstalled = false ;
70+ item.isProcessing = false ;
71+ });
6172 return false ;
6273 }
6374 setState (() {
75+ item.isInstalled = false ;
6476 item.isProcessing = false ;
6577 });
78+ // Refresh the modules manager
79+ PluginsManager .reloadPlugins (widget.modulesManager, context);
80+ widget.modulesManager.onInitialized (context);
6681 return true ;
6782 }
6883
@@ -119,6 +134,10 @@ class PluginsBrowserState extends State<PluginsBrowser> {
119134 Directory (path + filename).create (recursive: true );
120135 }
121136 debugPrint (filename);
137+ setState (() {
138+ item.isInstalled = true ;
139+ item.isProcessing = false ;
140+ });
122141 }
123142 } else {
124143 debugPrint ("[Plugins Manager] This repository has no zip url" );
@@ -137,16 +156,21 @@ class PluginsBrowserState extends State<PluginsBrowser> {
137156 debugPrint ("[PluginsManager] The plugins is already installed" );
138157 setState (() {
139158 item.isInstalled = true ;
159+ item.isProcessing = false ;
140160 });
141161 return false ;
142162 }
143163
144164 setState (() {
145165 item.isProcessing = false ;
146166 });
167+ // Refresh the modules manager
168+ PluginsManager .reloadPlugins (widget.modulesManager, context);
169+ widget.modulesManager.onInitialized (context);
170+
147171
148172 /* Do Something with repo */
149- if (item.isInstalled) {
173+ if (! item.isInstalled) {
150174 return false ;
151175 }
152176
@@ -208,8 +232,10 @@ class PluginsBrowserState extends State<PluginsBrowser> {
208232 subtitle: Text (item.desc),
209233 trailing: (item.isProcessing)
210234 ? Container (
211- constraints: BoxConstraints (maxWidth: 256 ),
212- child: Row (children: [
235+ constraints: const BoxConstraints (maxWidth: 256 ),
236+ child: Row (
237+ mainAxisAlignment: MainAxisAlignment .end,
238+ children: [
213239 Text (item.processingMessage),
214240 const CircularProgressIndicator (
215241 value: null ,
0 commit comments