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