feat: UI fix

This commit is contained in:
xkeyC 2025-11-26 13:23:35 +08:00
parent 9959ae8c8f
commit 7d6f7879c4
2 changed files with 16 additions and 34 deletions

View File

@ -370,12 +370,11 @@ class PartyRoomListPage extends HookConsumerWidget {
], ],
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
//
Row( Row(
children: [ children: [
makeTagContainer(partyRoom, room), makeTagContainer(partyRoom, room),
if (room.socialLinks.isNotEmpty) ...[ if (room.socialLinks.isNotEmpty) ...[
const SizedBox(width: 6), const SizedBox(width: 12),
Container( Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4), padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration( decoration: BoxDecoration(
@ -386,11 +385,6 @@ class PartyRoomListPage extends HookConsumerWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Icon(FluentIcons.link, size: 10, color: Colors.green.withValues(alpha: 0.8)), Icon(FluentIcons.link, size: 10, color: Colors.green.withValues(alpha: 0.8)),
const SizedBox(width: 4),
Text(
'${room.socialLinks.length}',
style: TextStyle(fontSize: 11, color: Colors.green.withValues(alpha: 0.9)),
),
], ],
), ),
), ),

View File

@ -18,47 +18,35 @@ class CachedSvgImage extends HookWidget {
final cachedFile = useState<File?>(null); final cachedFile = useState<File?>(null);
final errorInfo = useState<String?>(null); final errorInfo = useState<String?>(null);
useEffect( useEffect(() {
() { () async {
() async { try {
try { final file = await FileCacheUtils.getFile(url);
cachedFile.value = await FileCacheUtils.getFile(url); if (context.mounted) cachedFile.value = file;
} catch (e) { } catch (e) {
debugPrint("Error loading SVG: $e"); debugPrint("Error loading SVG: $e");
errorInfo.value = "Error loading SVG: $e"; if (context.mounted) errorInfo.value = "Error loading SVG: $e";
} }
}(); }();
return null; return null;
}, }, [url]);
[url],
);
if (errorInfo.value != null) { if (errorInfo.value != null) {
return SizedBox( return SizedBox(
width: width, width: width,
height: height, height: height,
child: Center( child: Center(
child: Text( child: Text(errorInfo.value!, style: TextStyle(color: Colors.red)),
errorInfo.value!,
style: TextStyle(color: Colors.red),
),
), ),
); );
} }
return cachedFile.value != null return cachedFile.value != null
? SvgPicture.file( ? SvgPicture.file(cachedFile.value!, width: width, height: height, fit: fit ?? BoxFit.contain)
cachedFile.value!,
width: width,
height: height,
fit: fit ?? BoxFit.contain,
)
: SizedBox( : SizedBox(
width: width, width: width,
height: height, height: height,
child: Center( child: Center(child: ProgressRing()),
child: ProgressRing(),
),
); );
} }
} }