@@ -36,7 +36,7 @@ void main(List<String> args) async {
36
36
await Config .initializePreference ();
37
37
await Future .wait ([
38
38
flutter_acrylic.Window .initialize (),
39
- _TModInstallerPageState . fetchData (),
39
+ fetchData (),
40
40
WindowManager .instance.ensureInitialized ()
41
41
]);
42
42
@@ -74,18 +74,24 @@ class TModInstallerApp extends StatelessWidget {
74
74
builder: (context, _) {
75
75
final appTheme = context.watch <AppTheme >();
76
76
//Quick and dirty way to set the color!
77
- var theme = Config .preferences? .getInt ("color" );
78
- if (theme != null ) {
79
- if (theme == - 1 ) {
77
+ var color = Config .preferences? .getInt ("color" );
78
+ if (color != null ) {
79
+ if (color == - 1 ) {
80
80
appTheme.rawColor = systemAccentColor;
81
81
} else {
82
- appTheme.rawColor = Colors .accentColors[theme ];
82
+ appTheme.rawColor = Colors .accentColors[color ];
83
83
}
84
84
}
85
85
86
+ var theme = Config .preferences? .getInt ("theme" );
87
+ if (theme != null ) {
88
+ appTheme.rawMode = ThemeMode .values[theme];
89
+ }
90
+
86
91
return FluentApp (
87
92
title: 'Tricked mod Installer' ,
88
93
debugShowCheckedModeBanner: false ,
94
+ themeMode: appTheme.mode,
89
95
color: appTheme.color,
90
96
darkTheme: ThemeData (
91
97
brightness: Brightness .dark,
@@ -139,87 +145,20 @@ class _TModInstallerPageState extends State<TModInstallerPage> {
139
145
super .dispose ();
140
146
}
141
147
142
- static Future <void > fetchData () async {
143
- //TODO save mods somewhere for offline
144
- try {
145
- var repos = Config .preferences? .getStringList ("repos" );
146
- if (repos != null ) {
147
- for (var repo in repos) {
148
- var trimmed = repo.trim ();
149
- //Prevent leading commas from erroring shit
150
- if (trimmed == "" ) continue ;
151
- final res = await http.get (Uri .parse (trimmed.startsWith ("http" )
152
- ? trimmed
153
- : "https://tmod.deno.dev/$trimmed .json" ));
154
- var data = json.decode (res.body);
155
-
156
- mods = [
157
- ...mods,
158
- ...data["mods" ].map ((x) {
159
- x["repo" ] = data["id" ];
160
- x["meta" ].removeWhere ((k, v) => v == null );
161
- if (x["icon" ] == null )
162
- x["icon" ] =
163
- "https://raw.githubusercontent.com/Tricked-dev/tmodinstaller/master/linux/debian/usr/share/icons/hicolor/256x256/apps/tmodinstaller.png" ;
164
-
165
- return Mod .fromJson (x);
166
- })
167
- ];
168
- }
169
- } else {
170
- final response =
171
- await http.get (Uri .parse ('https://tmod.deno.dev/std.json' ));
172
- var data = json.decode (response.body);
173
-
174
- mods = [
175
- ...mods,
176
- ...data["mods" ].map ((x) {
177
- x["repo" ] = data["id" ];
178
- x["meta" ].removeWhere ((k, v) => v == null );
179
- if (x["icon" ] == null )
180
- x["icon" ] =
181
- "https://raw.githubusercontent.com/Tricked-dev/tmodinstaller/master/linux/debian/usr/share/icons/hicolor/256x256/apps/tmodinstaller.png" ;
182
- return Mod .fromJson (x);
183
- })
184
- ];
185
- }
186
- } catch (_) {
187
- print (_);
188
- mods = [
189
- Mod (
190
- categories: [],
191
- repo: "INVALID" ,
192
- display: "INVALID REPO DETECTED" ,
193
- description:
194
- "PLEASE ENSURE THAT ALL REPOS ARE VALID AND WORKING BEFORE ADDING THEM" ,
195
- id: "INVALID" ,
196
- downloads: [
197
- DownloadMod (
198
- filename: "INVALID" ,
199
- mcversions: ["0.0.0" ],
200
- version: "0.0.0" ,
201
- hash: "sha1;null" ,
202
- url: "" )
203
- ],
204
- nicknames: [],
205
- conflicts: [],
206
- forgeid: "INVALID" ,
207
- meta: {},
208
- icon:
209
- "https://cdn-images-1.medium.com/max/1200/1*5-aoK8IBmXve5whBQM90GA.png" )
210
- ];
211
- }
212
- }
213
-
214
148
@override
215
149
Widget build (BuildContext context) {
216
150
final appTheme = context.watch <AppTheme >();
151
+
217
152
final List <String > lastversions = [
218
- "1.8.9 " ,
219
- "1.12.2 " ,
153
+ "1.18.2 " ,
154
+ "1.18.1 " ,
220
155
"1.17.1" ,
221
- "1.14.4" ,
222
- "1.16.5"
156
+ "1.16.5" ,
157
+ // "1.15.2",
158
+ // "1.14.4",
159
+ // "1.13.2",
160
+ "1.12.2" ,
161
+ "1.8.9" ,
223
162
];
224
163
List <String > versions = Set .of (Set .of (mods
225
164
.map ((x) => x.downloads.map ((x) => x.mcversions))
0 commit comments