Skip to content

Commit 6add9f5

Browse files
committed
add @status
1 parent 8d511be commit 6add9f5

File tree

4 files changed

+98
-80
lines changed

4 files changed

+98
-80
lines changed

lib/views/pages/extension/extension_repo_page.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ class _ExtensionRepoPageState extends State<ExtensionRepoPage> {
118118
lang: e['lang'],
119119
nsfw: e['nsfw'] == 'true',
120120
tags: e['tags'] == null ? [] : e['tags'].toLowerCase().split(','),
121+
status: (e['status'] ?? '1') == '1',
121122
type: ExtensionType.values.firstWhere(
122123
(element) => element.toString() == 'ExtensionType.${e['type']}',
123124
)))

lib/views/widgets/extension/extension_card.dart

Lines changed: 93 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class ExtensionCard extends StatefulWidget {
2020
required this.nsfw,
2121
required this.type,
2222
required this.tags,
23+
required this.status,
2324
});
2425
final String? icon;
2526
final String name;
@@ -28,6 +29,7 @@ class ExtensionCard extends StatefulWidget {
2829
final String lang;
2930
final ExtensionType type;
3031
final bool nsfw;
32+
final bool status;
3133
final List<String> tags;
3234
@override
3335
State<ExtensionCard> createState() => _ExtensionCardState();
@@ -159,100 +161,113 @@ class _ExtensionCardState extends State<ExtensionCard> {
159161
Widget _buildDesktop(BuildContext context) {
160162
return fluent.Card(
161163
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)),
178170
),
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+
),
185187
),
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(
187220
children: [
188221
Padding(
189222
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+
),
191227
),
192228
Padding(
193229
padding: const EdgeInsets.only(right: 8),
194230
child: Text(widget.lang),
195231
),
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+
},
204247
),
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
227260
fluent.FilledButton(
228-
child: Text('extension-repo.upgrade'.i18n),
229261
onPressed: () async {
230262
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-
});
243263
},
264+
child: Text('common.install'.i18n),
244265
)
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+
]),
256271
);
257272
}
258273

pubspec.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ packages:
338338
source: hosted
339339
version: "8.2.0"
340340
extended_image_library:
341-
dependency: transitive
341+
dependency: "direct main"
342342
description:
343343
name: extended_image_library
344344
sha256: "9b55fc5ebc65fad984de66b8f177a1bef2a84d79203c9c213f75ff83c2c29edd"
@@ -671,7 +671,7 @@ packages:
671671
source: hosted
672672
version: "4.0.2"
673673
image:
674-
dependency: transitive
674+
dependency: "direct main"
675675
description:
676676
name: image
677677
sha256: "4c68bfd5ae83e700b5204c1e74451e7bf3cf750e6843c6e158289cf56bda018e"

pubspec.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ dependencies:
6363
screen_brightness: ^0.2.2+1
6464
auto_orientation: ^2.3.1
6565
dlna_dart: ^0.0.8
66+
extended_image_library: ^4.0.1
67+
image: ^4.1.7
6668

6769
dev_dependencies:
6870
flutter_test:

0 commit comments

Comments
 (0)