spotube/lib/modules/root/sidebar/sidebar_footer.dart
Alessio fece073def This pull request primarily involves the removal of several configuration files and assets, as well as minor updates to documentation. The most significant changes are the deletion of various .vscode configuration files and the removal of unused assets from the project.
Configuration File Removals:

    .vscode/c_cpp_properties.json: Removed the entire configuration for C/C++ properties.
    .vscode/launch.json: Removed the Dart launch configurations for different environments and modes.
    .vscode/settings.json: Removed settings related to CMake, spell checking, file nesting, and Dart Flutter SDK path.
    .vscode/snippets.code-snippets: Removed code snippets for Dart, including PaginatedState and PaginatedNotifier templates.
    .vscode/tasks.json: Removed the tasks configuration file.

Documentation Updates:

    CONTRIBUTION.md: Removed heart emoji from the introductory text.
    README.md: Updated the logo image and made minor text adjustments, including removing emojis and updating section titles. [1] [2] [3] [4] [5]

Asset Removals:

    lib/collections/assets.gen.dart: Removed multiple unused asset references, including images related to Spotube logos and banners. [1] [2] [3]

Minor Code Cleanups:

    cli/commands/build/linux.dart, cli/commands/build/windows.dart, cli/commands/translated.dart, cli/commands/untranslated.dart: Adjusted import statements for consistency. [1] [2] [3] [4]
    integration_test/app_test.dart: Removed an unnecessary blank line.
    lib/collections/routes.dart: Commented out the TrackRoute configuration.
2025-04-13 18:40:37 +02:00

140 lines
4.9 KiB
Dart

import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart' show Badge;
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:shadcn_flutter/shadcn_flutter.dart';
import 'package:spotube/collections/routes.gr.dart';
import 'package:spotube/collections/spotube_icons.dart';
import 'package:spotube/components/image/universal_image.dart';
import 'package:spotube/extensions/constrains.dart';
import 'package:spotube/extensions/context.dart';
import 'package:spotube/extensions/image.dart';
import 'package:spotube/modules/connect/connect_device.dart';
import 'package:spotube/provider/authentication/authentication.dart';
import 'package:spotube/provider/download_manager_provider.dart';
import 'package:spotube/provider/spotify/spotify.dart';
class SidebarFooter extends HookConsumerWidget implements NavigationBarItem {
const SidebarFooter({
super.key,
});
@override
Widget build(BuildContext context, ref) {
final theme = Theme.of(context);
final router = AutoRouter.of(context, watch: true);
final mediaQuery = MediaQuery.of(context);
final downloadCount = ref.watch(downloadManagerProvider).$downloadCount;
final userSnapshot = ref.watch(meProvider);
final data = userSnapshot.asData?.value;
final avatarImg = (data?.images).asUrlString(
index: (data?.images?.length ?? 1) - 1,
placeholder: ImagePlaceholder.artist,
);
final auth = ref.watch(authenticationProvider);
if (mediaQuery.mdAndDown) {
return Column(
mainAxisSize: MainAxisSize.min,
spacing: 10,
children: [
Badge(
isLabelVisible: downloadCount > 0,
label: Text(downloadCount.toString()),
child: IconButton(
variance: router.topRoute.name == UserDownloadsRoute.name
? ButtonVariance.secondary
: ButtonVariance.ghost,
icon: const Icon(SpotubeIcons.download),
onPressed: () => context.navigateTo(const UserDownloadsRoute()),
),
),
const ConnectDeviceButton.sidebar(),
IconButton(
variance: ButtonVariance.ghost,
icon: const Icon(SpotubeIcons.settings),
onPressed: () => context.navigateTo(const SettingsRoute()),
),
],
);
}
return Container(
padding: const EdgeInsets.only(left: 12, bottom: 48),
width: 180,
child: Column(
mainAxisSize: MainAxisSize.min,
spacing: 10,
children: [
SizedBox(
width: double.infinity,
child: Button(
style: router.topRoute.name == UserDownloadsRoute.name
? ButtonVariance.secondary
: ButtonVariance.outline,
onPressed: () {
context.navigateTo(const UserDownloadsRoute());
},
leading: const Icon(SpotubeIcons.download),
trailing: downloadCount > 0
? PrimaryBadge(
child: Text(downloadCount.toString()),
)
: null,
child: Text(context.l10n.downloads),
),
),
const ConnectDeviceButton.sidebar(),
Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
if (auth.asData?.value != null && data == null)
const CircularProgressIndicator()
else if (data != null)
Flexible(
child: GestureDetector(
onTap: () {
context.navigateTo(const ProfileRoute());
},
child: Row(
children: [
Avatar(
initials:
Avatar.getInitials(data.displayName ?? "User"),
provider: UniversalImage.imageProvider(avatarImg),
),
const SizedBox(width: 10),
Flexible(
child: Text(
data.displayName ?? context.l10n.guest,
maxLines: 1,
softWrap: false,
overflow: TextOverflow.fade,
style: theme.typography.normal
.copyWith(fontWeight: FontWeight.bold),
),
),
],
),
),
),
IconButton(
variance: ButtonVariance.ghost,
icon: const Icon(SpotubeIcons.settings),
onPressed: () {
context.navigateTo(const SettingsRoute());
},
),
],
),
],
),
);
}
@override
bool get selectable => false;
}