| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import 'package:chicken_farm/stores/auth_store.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_riverpod/flutter_riverpod.dart';
- import 'package:chicken_farm/pages/home/_profile/user_info_card.dart';
- import 'package:chicken_farm/pages/home/_profile/upload_data_button.dart';
- import 'package:chicken_farm/pages/home/_profile/clear_cache_button.dart';
- import 'package:chicken_farm/pages/home/_profile/config_button.dart';
- import 'package:chicken_farm/pages/home/_profile/rfid_config_button.dart';
- // import 'package:chicken_farm/pages/home/_profile/scanner_light_button.dart';
- import 'package:chicken_farm/pages/home/_profile/logout_button.dart';
- class ProfilePage extends ConsumerWidget {
- const ProfilePage({super.key});
- @override
- Widget build(BuildContext context, WidgetRef ref) {
- final authState = ref.watch(authStoreProvider);
- return Scaffold(
- body: Padding(
- padding: const EdgeInsets.all(16.0),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- const SizedBox(height: 20),
- if (authState.state == AuthState.authenticated &&
- authState.user != null) ...[
- Expanded(
- child: SingleChildScrollView(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- UserInfoCard(user: authState.user!),
- const SizedBox(height: 20),
- const UploadDataButton(),
- const SizedBox(height: 20),
- const ClearCacheButton(),
- const SizedBox(height: 20),
- const ConfigButton(),
- const SizedBox(height: 20),
- const RfidConfigButton(),
- const SizedBox(height: 20),
- // const ScannerLightButton(),
- // const SizedBox(height: 20),
- const LogoutButton(),
- ],
- ),
- ),
- ),
- ] else ...[
- const Center(child: Text('加载中...')),
- ],
- ],
- ),
- ),
- );
- }
- }
|