37 lines
1.2 KiB
Dart
37 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import '../providers/auth_provider.dart';
|
|
import 'welcome_screen.dart';
|
|
|
|
class DashboardScreen extends StatelessWidget {
|
|
const DashboardScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final auth = Provider.of<AuthProvider>(context);
|
|
final name = auth.user?['customer_name'] ?? 'User';
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text("Dashboard"),
|
|
actions: [
|
|
IconButton(
|
|
icon: const Icon(Icons.logout),
|
|
onPressed: () async {
|
|
await auth.logout();
|
|
Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (_) => const WelcomeScreen()), (r) => false);
|
|
},
|
|
)
|
|
],
|
|
),
|
|
body: Padding(
|
|
padding: const EdgeInsets.all(18),
|
|
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
|
Text("Welcome, ${name}", style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600)),
|
|
const SizedBox(height: 12),
|
|
const Text("Your dashboard will appear here. Build shipment list, tracking, create shipment screens next."),
|
|
]),
|
|
),
|
|
);
|
|
}
|
|
}
|