profile.dart 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import 'package:chicken_farm/stores/auth_store.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_riverpod/flutter_riverpod.dart';
  4. import 'package:chicken_farm/pages/home/_profile/user_info_card.dart';
  5. import 'package:chicken_farm/pages/home/_profile/upload_data_button.dart';
  6. import 'package:chicken_farm/pages/home/_profile/clear_cache_button.dart';
  7. import 'package:chicken_farm/pages/home/_profile/config_button.dart';
  8. import 'package:chicken_farm/pages/home/_profile/rfid_config_button.dart';
  9. // import 'package:chicken_farm/pages/home/_profile/scanner_light_button.dart';
  10. import 'package:chicken_farm/pages/home/_profile/logout_button.dart';
  11. class ProfilePage extends ConsumerWidget {
  12. const ProfilePage({super.key});
  13. @override
  14. Widget build(BuildContext context, WidgetRef ref) {
  15. final authState = ref.watch(authStoreProvider);
  16. return Scaffold(
  17. body: Padding(
  18. padding: const EdgeInsets.all(16.0),
  19. child: Column(
  20. crossAxisAlignment: CrossAxisAlignment.start,
  21. children: [
  22. const SizedBox(height: 20),
  23. if (authState.state == AuthState.authenticated &&
  24. authState.user != null) ...[
  25. Expanded(
  26. child: SingleChildScrollView(
  27. child: Column(
  28. crossAxisAlignment: CrossAxisAlignment.start,
  29. children: [
  30. UserInfoCard(user: authState.user!),
  31. const SizedBox(height: 20),
  32. const UploadDataButton(),
  33. const SizedBox(height: 20),
  34. const ClearCacheButton(),
  35. const SizedBox(height: 20),
  36. const ConfigButton(),
  37. const SizedBox(height: 20),
  38. const RfidConfigButton(),
  39. const SizedBox(height: 20),
  40. // const ScannerLightButton(),
  41. // const SizedBox(height: 20),
  42. const LogoutButton(),
  43. ],
  44. ),
  45. ),
  46. ),
  47. ] else ...[
  48. const Center(child: Text('加载中...')),
  49. ],
  50. ],
  51. ),
  52. ),
  53. );
  54. }
  55. }