forked from baron/baron-sso
43 lines
1.3 KiB
Dart
43 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:descope/descope.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
class DashboardScreen extends StatelessWidget {
|
|
const DashboardScreen({super.key});
|
|
|
|
Future<void> _logout(BuildContext context) async {
|
|
Descope.sessionManager.clearSession();
|
|
if (context.mounted) context.go('/');
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final user = Descope.sessionManager.session?.user;
|
|
final userName = user?.name ?? user?.email ?? user?.phone ?? 'User';
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text('Baron Launcher', style: GoogleFonts.outfit(fontWeight: FontWeight.bold)),
|
|
actions: [
|
|
IconButton(
|
|
icon: const Icon(Icons.logout),
|
|
onPressed: () => _logout(context),
|
|
tooltip: 'Sign Out',
|
|
),
|
|
],
|
|
),
|
|
body: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
const Text('Dashboard Loaded Successfully', style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold)),
|
|
const SizedBox(height: 20),
|
|
Text('Welcome, $userName'),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|