mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 16:05:18 +00:00

BRIEF DESCRIPTION: - Nested Routes like React-Router/Spotify Web/desktop - Except Login routes everything is nested and wrapped by a Shell - PlayerOverlay is no more a overlay A really simple Sidebar now
33 lines
929 B
Dart
33 lines
929 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:spotube/provider/Auth.dart';
|
|
import 'package:spotube/utils/service_utils.dart';
|
|
|
|
class AnonymousFallback extends ConsumerWidget {
|
|
final Widget? child;
|
|
const AnonymousFallback({
|
|
Key? key,
|
|
this.child,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context, ref) {
|
|
final isLoggedIn = ref.watch(authProvider.select((s) => s.isLoggedIn));
|
|
|
|
if (isLoggedIn && child != null) return child!;
|
|
return Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const Text("You're not logged in"),
|
|
const SizedBox(height: 10),
|
|
ElevatedButton(
|
|
child: const Text("Login with Spotify"),
|
|
onPressed: () => ServiceUtils.navigate(context, "/settings"),
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|