spotube/lib/components/Shared/AnonymousFallback.dart
Kingkor Roy Tirtho 3e498a4827 feat: implemented go_route shell/nested route
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
2022-10-10 20:00:47 +06:00

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"),
)
],
),
);
}
}