fix: resolve compilation errors
- Add flutter_riverpod dependency to pubspec.yaml - Rename sealed class subtypes (Idle, Loading, Done) as public - Update RecyclingGuideScreen to use type checks instead of pattern matching - Fix CardThemeData type in app_theme.dart - Keep withOpacity (warnings only, not errors)
This commit is contained in:
@@ -137,10 +137,13 @@ class _SearchResults extends ConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final estado = ref.watch(recyclingSearchProvider);
|
||||
|
||||
return switch (estado) {
|
||||
_Idle() => const SizedBox.shrink(),
|
||||
_Loading() => const Center(child: CircularProgressIndicator()),
|
||||
_Done(results: final r) when r.isEmpty => Center(
|
||||
if (estado is Idle) {
|
||||
return const SizedBox.shrink();
|
||||
} else if (estado is Loading) {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
} else if (estado is Done) {
|
||||
if (estado.results.isEmpty) {
|
||||
return Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
@@ -152,13 +155,14 @@ class _SearchResults extends ConsumerWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
_Done(results: final r) => ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
itemCount: r.length,
|
||||
itemBuilder: (_, i) => SearchResultTile(resultado: r[i]),
|
||||
),
|
||||
_ => const SizedBox.shrink(),
|
||||
};
|
||||
);
|
||||
}
|
||||
return ListView.builder(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
itemCount: estado.results.length,
|
||||
itemBuilder: (_, i) => SearchResultTile(resultado: estado.results[i]),
|
||||
);
|
||||
}
|
||||
return const SizedBox.shrink();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user