mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00
60 lines
2.1 KiB
Dart
60 lines
2.1 KiB
Dart
import 'package:auto_route/auto_route.dart';
|
|
import 'package:flutter/material.dart' show ListTile;
|
|
|
|
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/modules/settings/section_card_with_heading.dart';
|
|
import 'package:spotube/extensions/context.dart';
|
|
import 'package:spotube/provider/scrobbler/scrobbler.dart';
|
|
|
|
class SettingsAccountSection extends HookConsumerWidget {
|
|
const SettingsAccountSection({super.key});
|
|
|
|
@override
|
|
Widget build(context, ref) {
|
|
final scrobbler = ref.watch(scrobblerProvider);
|
|
|
|
return SectionCardWithHeading(
|
|
heading: context.l10n.account,
|
|
children: [
|
|
ListTile(
|
|
leading: const Icon(SpotubeIcons.extensions),
|
|
title: const Text("Metadata provider plugins"),
|
|
subtitle: const Text(
|
|
"Configure your own playlist/album/artist/feed metadata provider"),
|
|
onTap: () {
|
|
context.pushRoute(const SettingsMetadataProviderRoute());
|
|
},
|
|
trailing: const Icon(SpotubeIcons.angleRight),
|
|
),
|
|
if (scrobbler.asData?.value == null)
|
|
ListTile(
|
|
leading: const Icon(SpotubeIcons.lastFm),
|
|
title: Text(context.l10n.login_with_lastfm),
|
|
subtitle: Text(context.l10n.scrobble_to_lastfm),
|
|
trailing: Button.secondary(
|
|
leading: const Icon(SpotubeIcons.lastFm),
|
|
onPressed: () {
|
|
context.navigateTo(const LastFMLoginRoute());
|
|
},
|
|
child: Text(context.l10n.connect),
|
|
),
|
|
)
|
|
else
|
|
ListTile(
|
|
leading: const Icon(SpotubeIcons.lastFm),
|
|
title: Text(context.l10n.disconnect_lastfm),
|
|
trailing: Button.destructive(
|
|
onPressed: () {
|
|
ref.read(scrobblerProvider.notifier).logout();
|
|
},
|
|
child: Text(context.l10n.disconnect),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|