@@ -4,6 +4,7 @@ import 'dart:io';
4
4
import 'package:corecoder_develop/modules/module_jsplugins.dart' ;
5
5
import 'package:corecoder_develop/util/modules_manager.dart' ;
6
6
import 'package:corecoder_develop/util/plugins_manager.dart' ;
7
+ import 'package:flutter/cupertino.dart' ;
7
8
import 'package:flutter/material.dart' ;
8
9
import 'package:http/http.dart' as http;
9
10
import 'package:http/http.dart' ;
@@ -12,8 +13,9 @@ import 'package:archive/archive.dart';
12
13
13
14
class PluginsBrowser extends StatefulWidget {
14
15
static const routeName = "/Settings/PluginsManager/" ;
16
+ final ModulesManager modulesManager;
15
17
16
- const PluginsBrowser ({Key ? key}) : super (key: key);
18
+ const PluginsBrowser ({Key ? key, required this .modulesManager }) : super (key: key);
17
19
18
20
@override
19
21
State <StatefulWidget > createState () => PluginsBrowserState ();
@@ -56,13 +58,26 @@ class PluginsBrowserState extends State<PluginsBrowser> {
56
58
var path = module.moduleFolder;
57
59
await Directory (path).delete (recursive: true );
58
60
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
+ });
60
67
} else {
68
+ setState (() {
69
+ item.isInstalled = false ;
70
+ item.isProcessing = false ;
71
+ });
61
72
return false ;
62
73
}
63
74
setState (() {
75
+ item.isInstalled = false ;
64
76
item.isProcessing = false ;
65
77
});
78
+ // Refresh the modules manager
79
+ PluginsManager .reloadPlugins (widget.modulesManager, context);
80
+ widget.modulesManager.onInitialized (context);
66
81
return true ;
67
82
}
68
83
@@ -119,6 +134,10 @@ class PluginsBrowserState extends State<PluginsBrowser> {
119
134
Directory (path + filename).create (recursive: true );
120
135
}
121
136
debugPrint (filename);
137
+ setState (() {
138
+ item.isInstalled = true ;
139
+ item.isProcessing = false ;
140
+ });
122
141
}
123
142
} else {
124
143
debugPrint ("[Plugins Manager] This repository has no zip url" );
@@ -137,16 +156,21 @@ class PluginsBrowserState extends State<PluginsBrowser> {
137
156
debugPrint ("[PluginsManager] The plugins is already installed" );
138
157
setState (() {
139
158
item.isInstalled = true ;
159
+ item.isProcessing = false ;
140
160
});
141
161
return false ;
142
162
}
143
163
144
164
setState (() {
145
165
item.isProcessing = false ;
146
166
});
167
+ // Refresh the modules manager
168
+ PluginsManager .reloadPlugins (widget.modulesManager, context);
169
+ widget.modulesManager.onInitialized (context);
170
+
147
171
148
172
/* Do Something with repo */
149
- if (item.isInstalled) {
173
+ if (! item.isInstalled) {
150
174
return false ;
151
175
}
152
176
@@ -208,8 +232,10 @@ class PluginsBrowserState extends State<PluginsBrowser> {
208
232
subtitle: Text (item.desc),
209
233
trailing: (item.isProcessing)
210
234
? 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: [
213
239
Text (item.processingMessage),
214
240
const CircularProgressIndicator (
215
241
value: null ,
0 commit comments