@@ -20,6 +20,7 @@ class ExtensionCard extends StatefulWidget {
20
20
required this .nsfw,
21
21
required this .type,
22
22
required this .tags,
23
+ required this .status,
23
24
});
24
25
final String ? icon;
25
26
final String name;
@@ -28,6 +29,7 @@ class ExtensionCard extends StatefulWidget {
28
29
final String lang;
29
30
final ExtensionType type;
30
31
final bool nsfw;
32
+ final bool status;
31
33
final List <String > tags;
32
34
@override
33
35
State <ExtensionCard > createState () => _ExtensionCardState ();
@@ -159,100 +161,113 @@ class _ExtensionCardState extends State<ExtensionCard> {
159
161
Widget _buildDesktop (BuildContext context) {
160
162
return fluent.Card (
161
163
padding: const EdgeInsets .all (12 ),
162
- child: Column (
163
- crossAxisAlignment: CrossAxisAlignment .start,
164
- mainAxisAlignment: MainAxisAlignment .spaceBetween,
165
- children: [
166
- Container (
167
- decoration: BoxDecoration (
168
- borderRadius: BorderRadius .circular (8 ),
169
- ),
170
- clipBehavior: Clip .antiAlias,
171
- child: CacheNetWorkImagePic (
172
- icon,
173
- width: 64 ,
174
- height: 64 ,
175
- fit: BoxFit .contain,
176
- fallback: const Icon (fluent.FluentIcons .add_in, size: 32 ),
177
- ),
164
+ child: Stack (children: [
165
+ if (! widget.status)
166
+ Align (
167
+ alignment: Alignment .topRight,
168
+ child: Text ("status-down" .i18n,
169
+ style: const TextStyle (color: Colors .red)),
178
170
),
179
- const SizedBox (height: 8 ),
180
- Text (widget.name, style: const TextStyle (fontSize: 17 )),
181
- DefaultTextStyle (
182
- style: TextStyle (
183
- fontSize: 12 ,
184
- color: fluent.FluentTheme .of (context).inactiveColor,
171
+ Column (
172
+ crossAxisAlignment: CrossAxisAlignment .start,
173
+ mainAxisAlignment: MainAxisAlignment .spaceBetween,
174
+ children: [
175
+ Container (
176
+ decoration: BoxDecoration (
177
+ borderRadius: BorderRadius .circular (8 ),
178
+ ),
179
+ clipBehavior: Clip .antiAlias,
180
+ child: CacheNetWorkImagePic (
181
+ icon,
182
+ width: 64 ,
183
+ height: 64 ,
184
+ fit: BoxFit .contain,
185
+ fallback: const Icon (fluent.FluentIcons .add_in, size: 32 ),
186
+ ),
185
187
),
186
- child: Row (
188
+ const SizedBox (height: 8 ),
189
+ Text (widget.name, style: const TextStyle (fontSize: 17 )),
190
+ DefaultTextStyle (
191
+ style: TextStyle (
192
+ fontSize: 12 ,
193
+ color: fluent.FluentTheme .of (context).inactiveColor,
194
+ ),
195
+ child: Row (
196
+ children: [
197
+ Padding (
198
+ padding: const EdgeInsets .only (right: 8 ),
199
+ child: Text (ExtensionUtils .typeToString (widget.type)),
200
+ ),
201
+ Padding (
202
+ padding: const EdgeInsets .only (right: 8 ),
203
+ child: Text (
204
+ widget.tags.join (', ' ),
205
+ )),
206
+ if (widget.nsfw)
207
+ const Padding (
208
+ padding: EdgeInsets .only (right: 8 ),
209
+ child: Text (
210
+ '18+' ,
211
+ style: TextStyle (
212
+ color: Colors .redAccent,
213
+ ),
214
+ ),
215
+ ),
216
+ ],
217
+ ),
218
+ ),
219
+ Row (
187
220
children: [
188
221
Padding (
189
222
padding: const EdgeInsets .only (right: 8 ),
190
- child: Text (ExtensionUtils .typeToString (widget.type)),
223
+ child: Text (
224
+ widget.version,
225
+ style: const TextStyle (fontSize: 12 ),
226
+ ),
191
227
),
192
228
Padding (
193
229
padding: const EdgeInsets .only (right: 8 ),
194
230
child: Text (widget.lang),
195
231
),
196
- if (widget.nsfw)
197
- const Padding (
198
- padding: EdgeInsets .only (right: 8 ),
199
- child: Text (
200
- '18+' ,
201
- style: TextStyle (
202
- color: Colors .redAccent,
203
- ),
232
+ const Spacer (),
233
+ if (isLoading)
234
+ const SizedBox (
235
+ width: 25 ,
236
+ height: 25 ,
237
+ child: ProgressRing (),
238
+ )
239
+ else if (isInstall) ...[
240
+ if (hasUpgrade)
241
+ fluent.FilledButton (
242
+ child: Text ('extension-repo.upgrade' .i18n),
243
+ onPressed: () async {
244
+ await _install ();
245
+ setState (() {});
246
+ },
204
247
),
205
- ),
206
- ],
207
- ),
208
- ),
209
- Row (
210
- children: [
211
- Padding (
212
- padding: const EdgeInsets .only (right: 8 ),
213
- child: Text (
214
- widget.version,
215
- style: const TextStyle (fontSize: 12 ),
216
- ),
217
- ),
218
- const Spacer (),
219
- if (isLoading)
220
- const SizedBox (
221
- width: 25 ,
222
- height: 25 ,
223
- child: ProgressRing (),
224
- )
225
- else if (isInstall) ...[
226
- if (hasUpgrade)
248
+ const SizedBox (width: 8 ),
249
+ if (isInstall)
250
+ fluent.FilledButton (
251
+ child: Text ('common.uninstall' .i18n),
252
+ onPressed: () async {
253
+ await ExtensionUtils .uninstall (widget.package);
254
+ setState (() {
255
+ isInstall = false ;
256
+ });
257
+ },
258
+ )
259
+ ] else
227
260
fluent.FilledButton (
228
- child: Text ('extension-repo.upgrade' .i18n),
229
261
onPressed: () async {
230
262
await _install ();
231
- setState (() {});
232
- },
233
- ),
234
- const SizedBox (width: 8 ),
235
- if (isInstall)
236
- fluent.FilledButton (
237
- child: Text ('common.uninstall' .i18n),
238
- onPressed: () async {
239
- await ExtensionUtils .uninstall (widget.package);
240
- setState (() {
241
- isInstall = false ;
242
- });
243
263
},
264
+ child: Text ('common.install' .i18n),
244
265
)
245
- ] else
246
- fluent.FilledButton (
247
- onPressed: () async {
248
- await _install ();
249
- },
250
- child: Text ('common.install' .i18n),
251
- )
252
- ],
253
- ),
254
- ],
255
- ),
266
+ ],
267
+ ),
268
+ ],
269
+ )
270
+ ]),
256
271
);
257
272
}
258
273
0 commit comments