mobile bluesky app made with flutter
lazurite.stormlightlabs.org/
mobile
bluesky
flutter
1import 'package:flutter/material.dart';
2import 'package:flutter_bloc/flutter_bloc.dart';
3import 'package:go_router/go_router.dart';
4import 'package:lazurite/features/auth/bloc/auth_bloc.dart';
5import 'package:lazurite/core/theme/theme_extensions.dart';
6
7class HomeScreen extends StatelessWidget {
8 const HomeScreen({super.key});
9
10 @override
11 Widget build(BuildContext context) {
12 return Scaffold(
13 appBar: AppBar(
14 title: const Text('Lazurite'),
15 actions: [
16 IconButton(icon: const Icon(Icons.person_outline), onPressed: () => context.push('/profile/me')),
17 IconButton(icon: const Icon(Icons.settings_outlined), onPressed: () => context.push('/settings')),
18 IconButton(
19 icon: const Icon(Icons.logout),
20 onPressed: () {
21 context.read<AuthBloc>().add(const LogoutRequested());
22 },
23 ),
24 ],
25 ),
26 body: BlocBuilder<AuthBloc, AuthState>(
27 builder: (context, state) {
28 final tokens = state.tokens;
29 if (!state.isAuthenticated || tokens == null) {
30 return const Center(child: Text('Not authenticated'));
31 }
32
33 return Center(
34 child: Padding(
35 padding: const EdgeInsets.all(24),
36 child: Column(
37 mainAxisAlignment: MainAxisAlignment.center,
38 children: [
39 Text(
40 tokens.displayName ?? 'Welcome',
41 style: context.textTheme.headlineMedium,
42 textAlign: TextAlign.center,
43 ),
44 const SizedBox(height: 12),
45 Text('@${tokens.handle}'),
46 const SizedBox(height: 8),
47 SelectableText(tokens.did, textAlign: TextAlign.center),
48 ],
49 ),
50 ),
51 );
52 },
53 ),
54 );
55 }
56}