mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00
35 lines
969 B
Dart
35 lines
969 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:spotube/extensions/context.dart';
|
|
|
|
import 'package:spotube/provider/authentication_provider.dart';
|
|
import 'package:spotube/utils/service_utils.dart';
|
|
|
|
class AnonymousFallback extends ConsumerWidget {
|
|
final Widget? child;
|
|
const AnonymousFallback({
|
|
super.key,
|
|
this.child,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context, ref) {
|
|
final isLoggedIn = ref.watch(authenticationProvider) != null;
|
|
|
|
if (isLoggedIn && child != null) return child!;
|
|
return Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text(context.l10n.not_logged_in),
|
|
const SizedBox(height: 10),
|
|
FilledButton(
|
|
child: Text(context.l10n.login_with_spotify),
|
|
onPressed: () => ServiceUtils.push(context, "/settings"),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|