mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
fix: flags not showing up, html in descriptions
This commit is contained in:
parent
d8cf2ae131
commit
5a563ef428
@ -9,6 +9,15 @@ import 'package:spotube/hooks/use_breakpoint_value.dart';
|
||||
import 'package:spotube/hooks/use_brightness_value.dart';
|
||||
import 'package:spotube/utils/platform.dart';
|
||||
|
||||
final htmlTagRegexp = RegExp(r"<[^>]*>", caseSensitive: true);
|
||||
|
||||
String? useDescription(String? description) {
|
||||
return useMemoized(() {
|
||||
if (description == null) return null;
|
||||
return description.replaceAll(htmlTagRegexp, '');
|
||||
}, [description]);
|
||||
}
|
||||
|
||||
class PlaybuttonCard extends HookWidget {
|
||||
final void Function()? onTap;
|
||||
final void Function()? onPlaybuttonPressed;
|
||||
@ -44,15 +53,13 @@ class PlaybuttonCard extends HookWidget {
|
||||
sm: 130,
|
||||
md: 150,
|
||||
others: 170,
|
||||
) ??
|
||||
170;
|
||||
);
|
||||
|
||||
final end = useBreakpointValue<double>(
|
||||
xs: 15,
|
||||
sm: 15,
|
||||
others: 20,
|
||||
) ??
|
||||
20;
|
||||
);
|
||||
|
||||
final textsHeight = useState(
|
||||
(textsKey.currentContext?.findRenderObject() as RenderBox?)
|
||||
@ -61,6 +68,8 @@ class PlaybuttonCard extends HookWidget {
|
||||
110.00,
|
||||
);
|
||||
|
||||
final cleanDescription = useDescription(description);
|
||||
|
||||
useEffect(() {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
textsHeight.value =
|
||||
@ -123,11 +132,11 @@ class PlaybuttonCard extends HookWidget {
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
if (description != null)
|
||||
if (cleanDescription != null)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12.0),
|
||||
child: AutoSizeText(
|
||||
description!,
|
||||
cleanDescription,
|
||||
maxLines: 2,
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
color:
|
||||
|
@ -9,6 +9,7 @@ import 'package:spotube/collections/assets.gen.dart';
|
||||
import 'package:spotube/collections/spotube_icons.dart';
|
||||
import 'package:spotube/components/album/album_card.dart';
|
||||
import 'package:spotube/components/shared/image/universal_image.dart';
|
||||
import 'package:spotube/components/shared/playbutton_card.dart';
|
||||
import 'package:spotube/extensions/constrains.dart';
|
||||
import 'package:spotube/extensions/context.dart';
|
||||
|
||||
@ -42,6 +43,8 @@ class TrackCollectionHeading<T> extends HookConsumerWidget {
|
||||
Widget build(BuildContext context, ref) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
final cleanDescription = useDescription(description);
|
||||
|
||||
return LayoutBuilder(
|
||||
builder: (context, constrains) {
|
||||
return DecoratedBox(
|
||||
@ -111,13 +114,13 @@ class TrackCollectionHeading<T> extends HookConsumerWidget {
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
),
|
||||
if (description != null)
|
||||
if (cleanDescription != null)
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: constrains.mdAndDown ? 400 : 300,
|
||||
),
|
||||
child: Text(
|
||||
description!,
|
||||
cleanDescription,
|
||||
style: const TextStyle(color: Colors.white),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.fade,
|
||||
|
@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_desktop_tools/flutter_desktop_tools.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:piped_client/piped_client.dart';
|
||||
import 'package:spotube/collections/env.dart';
|
||||
@ -323,7 +324,8 @@ class SettingsPage extends HookConsumerWidget {
|
||||
title:
|
||||
Text(context.l10n.piped_instance),
|
||||
subtitle: Text(
|
||||
context.l10n.piped_description),
|
||||
context.l10n.piped_description,
|
||||
),
|
||||
value: preferences.pipedInstance,
|
||||
showValueWhenUnfolded: false,
|
||||
options: data
|
||||
@ -331,9 +333,26 @@ class SettingsPage extends HookConsumerWidget {
|
||||
.map(
|
||||
(e) => DropdownMenuItem(
|
||||
value: e.apiUrl,
|
||||
child: Text(
|
||||
"${e.name}\n"
|
||||
"${e.locations.map(countryCodeToEmoji).join(" ")}",
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
children: [
|
||||
TextSpan(
|
||||
text:
|
||||
"${e.name.trim()}\n",
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.labelLarge,
|
||||
),
|
||||
TextSpan(
|
||||
text: e.locations
|
||||
.map(
|
||||
countryCodeToEmoji)
|
||||
.join(""),
|
||||
style: GoogleFonts
|
||||
.notoColorEmoji(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -77,13 +77,13 @@ class UserPreferences extends PersistedChangeNotifier {
|
||||
this.checkUpdate = true,
|
||||
this.audioQuality = AudioQuality.high,
|
||||
this.downloadLocation = "",
|
||||
this.closeBehavior = CloseBehavior.minimizeToTray,
|
||||
this.closeBehavior = CloseBehavior.close,
|
||||
this.showSystemTrayIcon = true,
|
||||
this.locale = const Locale("system", "system"),
|
||||
this.pipedInstance = "https://pipedapi.kavin.rocks",
|
||||
this.searchMode = SearchMode.youtube,
|
||||
this.searchMode = SearchMode.youtubeMusic,
|
||||
this.skipNonMusic = true,
|
||||
this.youtubeApiType = YoutubeApiType.youtube,
|
||||
this.youtubeApiType = YoutubeApiType.piped,
|
||||
}) : super() {
|
||||
if (downloadLocation.isEmpty) {
|
||||
_getDefaultDownloadDirectory().then(
|
||||
|
@ -881,6 +881,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.0.6"
|
||||
google_fonts:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: google_fonts
|
||||
sha256: "6b6f10f0ce3c42f6552d1c70d2c28d764cf22bb487f50f66cca31dcd5194f4d6"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.0.4"
|
||||
gotrue:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -98,6 +98,7 @@ dependencies:
|
||||
disable_battery_optimization: ^1.1.0+1
|
||||
youtube_explode_dart: ^1.12.4
|
||||
flutter_displaymode: ^0.6.0
|
||||
google_fonts: ^4.0.4
|
||||
|
||||
dev_dependencies:
|
||||
build_runner: ^2.3.2
|
||||
|
Loading…
Reference in New Issue
Block a user