chore: upgrade to riverpod 3.x and freezed 3.x
- Upgrade flutter_riverpod to 3.1.0, riverpod_annotation to 4.0.0 - Upgrade freezed to 3.2.3, freezed_annotation to 3.1.0 - Migrate freezed classes to use sealed keyword (freezed 3.x) - Update provider naming (*NotifierProvider → *Provider) - Add legacy.dart import for StateNotifierProvider compatibility - Fix valueOrNull → value for AsyncValue - Remove unused imports and fields - Add sync from Authentik button to users/groups pages - Suppress invalid_annotation_target warning in analysis_options 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.5
parent
0de79fba26
commit
6989241ae7
@@ -9,6 +9,12 @@
|
||||
# packages, and plugins designed to encourage good coding practices.
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
analyzer:
|
||||
errors:
|
||||
# Freezed uses @JsonKey on constructor parameters which triggers this warning
|
||||
# but is the correct pattern for freezed classes
|
||||
invalid_annotation_target: ignore
|
||||
|
||||
linter:
|
||||
# The lint rules applied to this project can be customized in the
|
||||
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ class TatlockApp extends ConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final router = ref.watch(appRouterProvider);
|
||||
final themeAsync = ref.watch(themeNotifierProvider);
|
||||
final themeAsync = ref.watch(themeProvider);
|
||||
|
||||
// Get theme mode, defaulting to system while loading
|
||||
final themeMode = switch (themeAsync) {
|
||||
|
||||
@@ -7,7 +7,7 @@ part 'api_client.g.dart';
|
||||
|
||||
/// Provides the Dio instance for Core API.
|
||||
@riverpod
|
||||
Dio coreApiClient(CoreApiClientRef ref) {
|
||||
Dio coreApiClient(Ref ref) {
|
||||
final dio = Dio(
|
||||
BaseOptions(
|
||||
baseUrl: AppConfig.coreApiUrl,
|
||||
@@ -31,7 +31,7 @@ Dio coreApiClient(CoreApiClientRef ref) {
|
||||
|
||||
/// Provides the Dio instance for Tatlock API.
|
||||
@riverpod
|
||||
Dio tatlockApiClient(TatlockApiClientRef ref) {
|
||||
Dio tatlockApiClient(Ref ref) {
|
||||
final dio = Dio(
|
||||
BaseOptions(
|
||||
baseUrl: AppConfig.tatlockApiUrl,
|
||||
|
||||
@@ -22,7 +22,7 @@ class AuthInterceptor extends Interceptor {
|
||||
return;
|
||||
}
|
||||
|
||||
final authState = _ref.read(authNotifierProvider);
|
||||
final authState = _ref.read(authProvider);
|
||||
|
||||
authState.whenData((auth) {
|
||||
if (auth.isAuthenticated && auth.accessToken != null) {
|
||||
@@ -43,7 +43,7 @@ class AuthInterceptor extends Interceptor {
|
||||
|
||||
if (err.response?.statusCode == 401) {
|
||||
// Token expired - trigger re-authentication
|
||||
_ref.read(authNotifierProvider.notifier).signOut();
|
||||
_ref.read(authProvider.notifier).signOut();
|
||||
}
|
||||
handler.next(err);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ part 'auth_state.freezed.dart';
|
||||
|
||||
/// Authentication state.
|
||||
@freezed
|
||||
class AuthState with _$AuthState {
|
||||
sealed class AuthState with _$AuthState {
|
||||
const factory AuthState({
|
||||
@Default(false) bool isAuthenticated,
|
||||
String? accessToken,
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:tatlock_ui/core/api/api_client.dart';
|
||||
import 'package:tatlock_ui/features/control_room/containers/data/models/container_model.dart';
|
||||
|
||||
@@ -6,7 +6,7 @@ part 'container_model.g.dart';
|
||||
|
||||
/// Container data model for API serialization.
|
||||
@freezed
|
||||
class ContainerModel with _$ContainerModel {
|
||||
sealed class ContainerModel with _$ContainerModel {
|
||||
const factory ContainerModel({
|
||||
@JsonKey(name: 'Id') required String id,
|
||||
@JsonKey(name: 'Names') required List<String> names,
|
||||
@@ -68,7 +68,7 @@ class ContainerModel with _$ContainerModel {
|
||||
|
||||
/// Port mapping model.
|
||||
@freezed
|
||||
class PortModel with _$PortModel {
|
||||
sealed class PortModel with _$PortModel {
|
||||
const factory PortModel({
|
||||
@JsonKey(name: 'IP') String? ip,
|
||||
@JsonKey(name: 'PrivatePort') required int privatePort,
|
||||
@@ -93,7 +93,7 @@ class PortModel with _$PortModel {
|
||||
|
||||
/// Mount model.
|
||||
@freezed
|
||||
class MountModel with _$MountModel {
|
||||
sealed class MountModel with _$MountModel {
|
||||
const factory MountModel({
|
||||
@JsonKey(name: 'Type') required String type,
|
||||
@JsonKey(name: 'Source') required String source,
|
||||
@@ -119,7 +119,7 @@ class MountModel with _$MountModel {
|
||||
|
||||
/// Network settings model.
|
||||
@freezed
|
||||
class NetworkSettingsModel with _$NetworkSettingsModel {
|
||||
sealed class NetworkSettingsModel with _$NetworkSettingsModel {
|
||||
const factory NetworkSettingsModel({
|
||||
@JsonKey(name: 'Networks') @Default({}) Map<String, dynamic> networks,
|
||||
}) = _NetworkSettingsModel;
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ class ContainerRepositoryImpl implements ContainerRepository {
|
||||
|
||||
/// Provides the container repository.
|
||||
@riverpod
|
||||
ContainerRepository containerRepository(ContainerRepositoryRef ref) {
|
||||
ContainerRepository containerRepository(Ref ref) {
|
||||
final datasource = ref.watch(containersDatasourceProvider);
|
||||
return ContainerRepositoryImpl(datasource);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ part 'container.freezed.dart';
|
||||
|
||||
/// Docker container entity.
|
||||
@freezed
|
||||
class Container with _$Container {
|
||||
sealed class Container with _$Container {
|
||||
const factory Container({
|
||||
/// Container ID (short form).
|
||||
required String id,
|
||||
@@ -122,7 +122,7 @@ enum ContainerState {
|
||||
|
||||
/// Port mapping configuration.
|
||||
@freezed
|
||||
class PortMapping with _$PortMapping {
|
||||
sealed class PortMapping with _$PortMapping {
|
||||
const factory PortMapping({
|
||||
/// Host IP (usually 0.0.0.0).
|
||||
String? hostIp,
|
||||
@@ -149,7 +149,7 @@ class PortMapping with _$PortMapping {
|
||||
|
||||
/// Volume mount configuration.
|
||||
@freezed
|
||||
class VolumeMount with _$VolumeMount {
|
||||
sealed class VolumeMount with _$VolumeMount {
|
||||
const factory VolumeMount({
|
||||
/// Mount type (bind, volume, tmpfs).
|
||||
required String type,
|
||||
|
||||
+4
-4
@@ -7,14 +7,14 @@ part 'containers_provider.g.dart';
|
||||
|
||||
/// Provides all containers.
|
||||
@riverpod
|
||||
Future<List<Container>> allContainers(AllContainersRef ref) async {
|
||||
Future<List<Container>> allContainers(Ref ref) async {
|
||||
final repository = ref.watch(containerRepositoryProvider);
|
||||
return repository.getContainers();
|
||||
}
|
||||
|
||||
/// Provides containers filtered by the selected stack.
|
||||
@riverpod
|
||||
Future<List<Container>> containers(ContainersRef ref) async {
|
||||
Future<List<Container>> containers(Ref ref) async {
|
||||
final repository = ref.watch(containerRepositoryProvider);
|
||||
final selectedStack = ref.watch(selectedStackProvider);
|
||||
|
||||
@@ -27,7 +27,7 @@ Future<List<Container>> containers(ContainersRef ref) async {
|
||||
|
||||
/// Provides a single container by ID.
|
||||
@riverpod
|
||||
Future<Container> container(ContainerRef ref, String id) async {
|
||||
Future<Container> container(Ref ref, String id) async {
|
||||
final repository = ref.watch(containerRepositoryProvider);
|
||||
return repository.getContainer(id);
|
||||
}
|
||||
@@ -82,7 +82,7 @@ class ContainerActions extends _$ContainerActions {
|
||||
/// Container logs provider.
|
||||
@riverpod
|
||||
Future<String> containerLogs(
|
||||
ContainerLogsRef ref,
|
||||
Ref ref,
|
||||
String id, {
|
||||
int? tail = 100,
|
||||
}) async {
|
||||
|
||||
@@ -22,7 +22,6 @@ class ContainerLogsViewer extends ConsumerStatefulWidget {
|
||||
class _ContainerLogsViewerState extends ConsumerState<ContainerLogsViewer> {
|
||||
final _scrollController = ScrollController();
|
||||
int _tailLines = 100;
|
||||
bool _autoScroll = true;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:tatlock_ui/core/api/api_client.dart';
|
||||
import 'package:tatlock_ui/features/control_room/npm/data/models/proxy_host_model.dart';
|
||||
|
||||
@@ -43,7 +43,7 @@ class IntOrBoolConverter implements JsonConverter<int, dynamic> {
|
||||
///
|
||||
/// Maps to the NPM API response format via Core API.
|
||||
@freezed
|
||||
class ProxyHostModel with _$ProxyHostModel {
|
||||
sealed class ProxyHostModel with _$ProxyHostModel {
|
||||
const factory ProxyHostModel({
|
||||
required int id,
|
||||
@JsonKey(name: 'domain_names') required List<String> domainNames,
|
||||
@@ -96,7 +96,7 @@ class ProxyHostModel with _$ProxyHostModel {
|
||||
|
||||
/// Proxy location model.
|
||||
@freezed
|
||||
class ProxyLocationModel with _$ProxyLocationModel {
|
||||
sealed class ProxyLocationModel with _$ProxyLocationModel {
|
||||
const factory ProxyLocationModel({
|
||||
required String path,
|
||||
@JsonKey(name: 'forward_scheme') required String forwardScheme,
|
||||
@@ -123,7 +123,7 @@ class ProxyLocationModel with _$ProxyLocationModel {
|
||||
///
|
||||
/// This is a simpler model used for listing domains.
|
||||
@freezed
|
||||
class DomainInfoModel with _$DomainInfoModel {
|
||||
sealed class DomainInfoModel with _$DomainInfoModel {
|
||||
const factory DomainInfoModel({
|
||||
required String domain,
|
||||
required String service,
|
||||
|
||||
@@ -4,7 +4,7 @@ part 'proxy_host.freezed.dart';
|
||||
|
||||
/// NPM proxy host entity representing a domain configuration.
|
||||
@freezed
|
||||
class ProxyHost with _$ProxyHost {
|
||||
sealed class ProxyHost with _$ProxyHost {
|
||||
const factory ProxyHost({
|
||||
/// Proxy host ID.
|
||||
required int id,
|
||||
@@ -76,7 +76,7 @@ class ProxyHost with _$ProxyHost {
|
||||
|
||||
/// Proxy location for advanced routing.
|
||||
@freezed
|
||||
class ProxyLocation with _$ProxyLocation {
|
||||
sealed class ProxyLocation with _$ProxyLocation {
|
||||
const factory ProxyLocation({
|
||||
/// Location path.
|
||||
required String path,
|
||||
|
||||
@@ -101,7 +101,7 @@ class _ProxyHostPageState extends ConsumerState<ProxyHostPage>
|
||||
child: EntityAsyncContent<ProxyHost>(
|
||||
isLoading: proxyHostAsync.isLoading,
|
||||
error: proxyHostAsync.error,
|
||||
data: proxyHostAsync.valueOrNull,
|
||||
data: proxyHostAsync.value,
|
||||
onRetry: () => ref.invalidate(proxyHostProvider(widget.proxyHostId!)),
|
||||
builder: (proxyHost) {
|
||||
if (isEditing) {
|
||||
@@ -275,7 +275,7 @@ class _ProxyHostView extends StatelessWidget {
|
||||
shrinkWrap: true,
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
itemCount: proxyHost.locations.length,
|
||||
separatorBuilder: (_, __) => const Divider(height: 1),
|
||||
separatorBuilder: (_, index) => const Divider(height: 1),
|
||||
itemBuilder: (context, index) {
|
||||
final loc = proxyHost.locations[index];
|
||||
return ListTile(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:tatlock_ui/features/control_room/npm/data/datasources/proxy_hosts_datasource.dart';
|
||||
import 'package:tatlock_ui/features/control_room/npm/data/models/proxy_host_model.dart';
|
||||
|
||||
@@ -125,7 +125,7 @@ class StacksDatasource {
|
||||
|
||||
/// Provides the stacks datasource.
|
||||
@riverpod
|
||||
StacksDatasource stacksDatasource(StacksDatasourceRef ref) {
|
||||
StacksDatasource stacksDatasource(Ref ref) {
|
||||
final dio = ref.watch(coreApiClientProvider);
|
||||
final containersDatasource = ref.watch(containersDatasourceProvider);
|
||||
return StacksDatasource(dio, containersDatasource);
|
||||
|
||||
@@ -6,7 +6,7 @@ part 'stack_model.g.dart';
|
||||
|
||||
/// Stack data model for API serialization.
|
||||
@freezed
|
||||
class StackModel with _$StackModel {
|
||||
sealed class StackModel with _$StackModel {
|
||||
const factory StackModel({
|
||||
required String id,
|
||||
required String name,
|
||||
|
||||
@@ -75,7 +75,7 @@ class StackRepositoryImpl implements StackRepository {
|
||||
|
||||
/// Provides the stack repository.
|
||||
@riverpod
|
||||
StackRepository stackRepository(StackRepositoryRef ref) {
|
||||
StackRepository stackRepository(Ref ref) {
|
||||
final datasource = ref.watch(stacksDatasourceProvider);
|
||||
return StackRepositoryImpl(datasource);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ part 'stack.freezed.dart';
|
||||
|
||||
/// Container orchestration stack (Docker Compose stack).
|
||||
@freezed
|
||||
class Stack with _$Stack {
|
||||
sealed class Stack with _$Stack {
|
||||
const factory Stack({
|
||||
/// Unique stack identifier.
|
||||
required String id,
|
||||
|
||||
@@ -6,14 +6,14 @@ part 'stacks_provider.g.dart';
|
||||
|
||||
/// Provides the list of all stacks.
|
||||
@riverpod
|
||||
Future<List<Stack>> stacks(StacksRef ref) async {
|
||||
Future<List<Stack>> stacks(Ref ref) async {
|
||||
final repository = ref.watch(stackRepositoryProvider);
|
||||
return repository.getStacks();
|
||||
}
|
||||
|
||||
/// Provides a single stack by ID.
|
||||
@riverpod
|
||||
Future<Stack> stack(StackRef ref, String id) async {
|
||||
Future<Stack> stack(Ref ref, String id) async {
|
||||
final repository = ref.watch(stackRepositoryProvider);
|
||||
return repository.getStack(id);
|
||||
}
|
||||
@@ -35,14 +35,14 @@ class SelectedStack extends _$SelectedStack {
|
||||
|
||||
/// Provides the YAML content for a stack.
|
||||
@riverpod
|
||||
Future<String> stackYaml(StackYamlRef ref, String stackId) async {
|
||||
Future<String> stackYaml(Ref ref, String stackId) async {
|
||||
final repository = ref.watch(stackRepositoryProvider);
|
||||
return repository.getStackYaml(stackId);
|
||||
}
|
||||
|
||||
/// Provides the environment variables for a stack.
|
||||
@riverpod
|
||||
Future<Map<String, String>> stackEnvVars(StackEnvVarsRef ref, String stackId) async {
|
||||
Future<Map<String, String>> stackEnvVars(Ref ref, String stackId) async {
|
||||
final repository = ref.watch(stackRepositoryProvider);
|
||||
return repository.getStackEnvVars(stackId);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ class GroupsListPage extends ConsumerStatefulWidget {
|
||||
class _GroupsListPageState extends ConsumerState<GroupsListPage> {
|
||||
late final StateNotifierProvider<DataGridController<GroupData>,
|
||||
DataGridState<GroupData>> _gridProvider;
|
||||
bool _isSyncing = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -59,6 +60,38 @@ class _GroupsListPageState extends ConsumerState<GroupsListPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _syncFromAuthentik() async {
|
||||
if (_isSyncing) return;
|
||||
setState(() => _isSyncing = true);
|
||||
|
||||
try {
|
||||
final dio = ref.read(coreApiClientProvider);
|
||||
await dio.post<void>('/auth/groups/sync-from-authentik');
|
||||
|
||||
if (!mounted) return;
|
||||
ref.read(_gridProvider.notifier).refresh();
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: const Text('Groups synced from Authentik'),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
duration: const Duration(seconds: 2),
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Sync failed: $e'),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
duration: const Duration(seconds: 4),
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
if (mounted) setState(() => _isSyncing = false);
|
||||
}
|
||||
}
|
||||
|
||||
DataGridConfig<GroupData> _buildConfig() {
|
||||
return DataGridConfig<GroupData>(
|
||||
columns: [
|
||||
@@ -106,6 +139,18 @@ class _GroupsListPageState extends ConsumerState<GroupsListPage> {
|
||||
tooltip: 'Refresh',
|
||||
onPressed: () => ref.read(_gridProvider.notifier).refresh(),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
FilledButton.icon(
|
||||
onPressed: _isSyncing ? null : _syncFromAuthentik,
|
||||
icon: _isSyncing
|
||||
? const SizedBox(
|
||||
width: 16,
|
||||
height: 16,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: const Icon(Icons.sync),
|
||||
label: const Text('Sync from Authentik'),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -70,6 +70,7 @@ class UsersListPage extends ConsumerStatefulWidget {
|
||||
class _UsersListPageState extends ConsumerState<UsersListPage> {
|
||||
late final StateNotifierProvider<DataGridController<UserData>,
|
||||
DataGridState<UserData>> _gridProvider;
|
||||
bool _isSyncing = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -88,6 +89,38 @@ class _UsersListPageState extends ConsumerState<UsersListPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _syncFromAuthentik() async {
|
||||
if (_isSyncing) return;
|
||||
setState(() => _isSyncing = true);
|
||||
|
||||
try {
|
||||
final dio = ref.read(coreApiClientProvider);
|
||||
await dio.post<void>('/auth/users/sync-from-authentik');
|
||||
|
||||
if (!mounted) return;
|
||||
ref.read(_gridProvider.notifier).refresh();
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: const Text('Users synced from Authentik'),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
duration: const Duration(seconds: 2),
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text('Sync failed: $e'),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
duration: const Duration(seconds: 4),
|
||||
),
|
||||
);
|
||||
} finally {
|
||||
if (mounted) setState(() => _isSyncing = false);
|
||||
}
|
||||
}
|
||||
|
||||
DataGridConfig<UserData> _buildConfig() {
|
||||
return DataGridConfig<UserData>(
|
||||
columns: [
|
||||
@@ -131,6 +164,18 @@ class _UsersListPageState extends ConsumerState<UsersListPage> {
|
||||
tooltip: 'Refresh',
|
||||
onPressed: () => ref.read(_gridProvider.notifier).refresh(),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
FilledButton.icon(
|
||||
onPressed: _isSyncing ? null : _syncFromAuthentik,
|
||||
icon: _isSyncing
|
||||
? const SizedBox(
|
||||
width: 16,
|
||||
height: 16,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: const Icon(Icons.sync),
|
||||
label: const Text('Sync from Authentik'),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ abstract class AppRoutes {
|
||||
|
||||
/// Provides the GoRouter instance.
|
||||
@riverpod
|
||||
GoRouter appRouter(AppRouterRef ref) {
|
||||
GoRouter appRouter(Ref ref) {
|
||||
return GoRouter(
|
||||
initialLocation: AppRoutes.frontHall,
|
||||
debugLogDiagnostics: true,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_riverpod/legacy.dart';
|
||||
|
||||
import 'data_grid_config.dart';
|
||||
import 'data_grid_provider.dart';
|
||||
import 'data_grid_source.dart';
|
||||
import 'data_grid_state.dart';
|
||||
import 'widgets/data_grid_bulk_actions.dart';
|
||||
import 'widgets/data_grid_empty_state.dart';
|
||||
|
||||
@@ -75,6 +75,9 @@
|
||||
/// ```
|
||||
library;
|
||||
|
||||
export 'package:flutter_riverpod/legacy.dart'
|
||||
show StateNotifierProvider, StateNotifier;
|
||||
|
||||
export 'data_grid.dart';
|
||||
export 'data_grid_action.dart';
|
||||
export 'data_grid_column.dart';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_riverpod/legacy.dart';
|
||||
|
||||
import 'data_grid_config.dart';
|
||||
import 'data_grid_source.dart';
|
||||
|
||||
@@ -4,7 +4,7 @@ part 'data_grid_state.freezed.dart';
|
||||
|
||||
/// State for a DataGrid instance.
|
||||
@freezed
|
||||
class DataGridState<T> with _$DataGridState<T> {
|
||||
sealed class DataGridState<T> with _$DataGridState<T> {
|
||||
const factory DataGridState({
|
||||
/// Current items being displayed.
|
||||
@Default([]) List<T> items,
|
||||
|
||||
@@ -12,7 +12,7 @@ class ProfileDropdown extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final authState = ref.watch(authNotifierProvider);
|
||||
final authState = ref.watch(authProvider);
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
|
||||
return authState.when(
|
||||
@@ -94,7 +94,7 @@ class ProfileDropdown extends ConsumerWidget {
|
||||
case 'settings':
|
||||
context.go(AppRoutes.settings);
|
||||
case 'logout':
|
||||
ref.read(authNotifierProvider.notifier).signOut();
|
||||
ref.read(authProvider.notifier).signOut();
|
||||
}
|
||||
},
|
||||
),
|
||||
@@ -106,7 +106,7 @@ class ProfileDropdown extends ConsumerWidget {
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
),
|
||||
),
|
||||
error: (_, __) => CircleAvatar(
|
||||
error: (err, stack) => CircleAvatar(
|
||||
radius: 18,
|
||||
backgroundColor: colorScheme.errorContainer,
|
||||
child: Icon(
|
||||
|
||||
@@ -81,7 +81,7 @@ class TopHeaderBar extends StatelessWidget {
|
||||
'assets/icons/logo.png',
|
||||
height: _logoSize,
|
||||
width: _logoSize,
|
||||
errorBuilder: (_, __, ___) => Icon(
|
||||
errorBuilder: (context, error, stack) => Icon(
|
||||
Icons.layers,
|
||||
size: 32,
|
||||
color: colorScheme.primary,
|
||||
|
||||
+11
-11
@@ -32,20 +32,20 @@ dependencies:
|
||||
sdk: flutter
|
||||
|
||||
# State Management
|
||||
flutter_riverpod: ^2.6.1
|
||||
riverpod_annotation: ^2.6.1
|
||||
hooks_riverpod: ^2.6.1
|
||||
flutter_hooks: ^0.20.5
|
||||
flutter_riverpod: ^3.0.0
|
||||
riverpod_annotation: ^4.0.0
|
||||
hooks_riverpod: ^3.0.0
|
||||
flutter_hooks: ^0.21.0
|
||||
|
||||
# Code Generation Support
|
||||
freezed_annotation: ^2.4.4
|
||||
freezed_annotation: ^3.1.0
|
||||
json_annotation: ^4.9.0
|
||||
|
||||
# Networking
|
||||
dio: ^5.7.0
|
||||
|
||||
# Routing
|
||||
go_router: ^14.6.2
|
||||
go_router: ^17.0.1
|
||||
|
||||
# Storage
|
||||
shared_preferences: ^2.3.3
|
||||
@@ -54,7 +54,7 @@ dependencies:
|
||||
flex_color_scheme: ^8.1.0
|
||||
flutter_adaptive_scaffold: ^0.3.1
|
||||
flutter_markdown: ^0.7.4
|
||||
fl_chart: ^0.69.2
|
||||
fl_chart: ^1.1.1
|
||||
|
||||
# Icons
|
||||
cupertino_icons: ^1.0.8
|
||||
@@ -70,19 +70,19 @@ dev_dependencies:
|
||||
sdk: flutter
|
||||
|
||||
# Linting
|
||||
flutter_lints: ^5.0.0
|
||||
flutter_lints: ^6.0.0
|
||||
|
||||
# Code Generation
|
||||
build_runner: ^2.4.13
|
||||
freezed: ^2.5.7
|
||||
freezed: ^3.2.3
|
||||
json_serializable: ^6.8.0
|
||||
riverpod_generator: ^2.6.3
|
||||
riverpod_generator: ^4.0.0
|
||||
|
||||
# Testing
|
||||
mocktail: ^1.0.4
|
||||
|
||||
# Build tools
|
||||
build: ^2.4.0
|
||||
build: ^4.0.3
|
||||
yaml: ^3.1.0
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
|
||||
Reference in New Issue
Block a user