From 7e98edfbc9dfc60cb8a4c124c44fbde498d3363d Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sat, 27 Jul 2024 20:27:29 +0800 Subject: [PATCH] :bug: Fix web issue --- lib/main.dart | 5 ++++ lib/screens/account/profile_page.dart | 1 + lib/widgets/attachments/attachment_list.dart | 30 +++++++++++--------- pubspec.lock | 2 +- pubspec.yaml | 3 +- 5 files changed, 26 insertions(+), 15 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index c9220bf..ff378f0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,6 +2,7 @@ import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; import 'package:flutter_acrylic/flutter_acrylic.dart'; import 'package:get/get.dart'; +import 'package:go_router/go_router.dart'; import 'package:media_kit/media_kit.dart'; import 'package:protocol_handler/protocol_handler.dart'; import 'package:sentry_flutter/sentry_flutter.dart'; @@ -21,6 +22,7 @@ import 'package:solian/router.dart'; import 'package:solian/shells/system_shell.dart'; import 'package:solian/theme.dart'; import 'package:solian/translations.dart'; +import 'package:flutter_web_plugins/url_strategy.dart' show usePathUrlStrategy; void main() async { await SentryFlutter.init( @@ -39,6 +41,9 @@ void main() async { _initializePlatformComponents(), ]); + GoRouter.optionURLReflectsImperativeAPIs = true; + + usePathUrlStrategy(); runApp(const SolianApp()); }, ); diff --git a/lib/screens/account/profile_page.dart b/lib/screens/account/profile_page.dart index 8ce208b..4beef5a 100644 --- a/lib/screens/account/profile_page.dart +++ b/lib/screens/account/profile_page.dart @@ -326,6 +326,7 @@ class _AccountProfilePageState extends State { borderRadius: radius, child: AttachmentListEntry( item: item, + isDense: true, parentId: 'album', showMature: _showMature, onReveal: (value) { diff --git a/lib/widgets/attachments/attachment_list.dart b/lib/widgets/attachments/attachment_list.dart index 8c3c940..7f6bbca 100644 --- a/lib/widgets/attachments/attachment_list.dart +++ b/lib/widgets/attachments/attachment_list.dart @@ -214,6 +214,7 @@ class AttachmentListEntry extends StatelessWidget { final bool showBorder; final bool showBadge; final bool showMature; + final bool isDense; final Function(bool) onReveal; const AttachmentListEntry({ @@ -226,6 +227,7 @@ class AttachmentListEntry extends StatelessWidget { this.showBorder = false, this.showBadge = false, this.showMature = false, + this.isDense = false, }); @override @@ -295,20 +297,22 @@ class AttachmentListEntry extends StatelessWidget { color: Colors.white, size: 32, ), - const SizedBox(height: 8), - Text( - 'matureContent'.tr, - style: const TextStyle( - color: Colors.white, - fontWeight: FontWeight.bold, - fontSize: 16, + if (!isDense) const SizedBox(height: 8), + if (!isDense) + Text( + 'matureContent'.tr, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 16, + ), + ), + if (!isDense) + Text( + 'matureContentCaption'.tr, + style: const TextStyle(color: Colors.white), + textAlign: TextAlign.center, ), - ), - Text( - 'matureContentCaption'.tr, - style: const TextStyle(color: Colors.white), - textAlign: TextAlign.center, - ), ], ), ), diff --git a/pubspec.lock b/pubspec.lock index 9157a6f..03d84bd 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -628,7 +628,7 @@ packages: source: sdk version: "0.0.0" flutter_web_plugins: - dependency: transitive + dependency: "direct main" description: flutter source: sdk version: "0.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index de5cfa6..db77b04 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,7 +10,8 @@ environment: dependencies: flutter: sdk: flutter - + flutter_web_plugins: + sdk: flutter cupertino_icons: ^1.0.6 go_router: ^14.1.1 get: ^4.6.6