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:
Alan Alonso
2026-05-22 19:30:41 -06:00
parent bda677df89
commit 057e063c0b
6 changed files with 58 additions and 23 deletions

View File

@@ -9,7 +9,13 @@
"Bash(rm -rf lib/src)", "Bash(rm -rf lib/src)",
"Bash(cp -r basura_app/lib/* lib/)", "Bash(cp -r basura_app/lib/* lib/)",
"Bash(git checkout *)", "Bash(git checkout *)",
"Bash(git add *)" "Bash(git add *)",
"Bash(git commit *)",
"Bash(git push *)",
"mcp__ide__getDiagnostics",
"Read(//mnt/c/Users/Wallt/StudioProjects/**)",
"Bash(flutter pub *)",
"Bash(flutter analyze *)"
] ]
} }
} }

View File

@@ -45,20 +45,20 @@ final recyclingSearchProvider =
sealed class RecyclingSearchState { sealed class RecyclingSearchState {
const RecyclingSearchState(); const RecyclingSearchState();
const factory RecyclingSearchState.idle() = _Idle; const factory RecyclingSearchState.idle() = Idle;
const factory RecyclingSearchState.loading() = _Loading; const factory RecyclingSearchState.loading() = Loading;
const factory RecyclingSearchState.done(List<SearchResult> results) = _Done; const factory RecyclingSearchState.done(List<SearchResult> results) = Done;
} }
class _Idle extends RecyclingSearchState { class Idle extends RecyclingSearchState {
const _Idle(); const Idle();
} }
class _Loading extends RecyclingSearchState { class Loading extends RecyclingSearchState {
const _Loading(); const Loading();
} }
class _Done extends RecyclingSearchState { class Done extends RecyclingSearchState {
final List<SearchResult> results; final List<SearchResult> results;
const _Done(this.results); const Done(this.results);
} }

View File

@@ -137,10 +137,13 @@ class _SearchResults extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
final estado = ref.watch(recyclingSearchProvider); final estado = ref.watch(recyclingSearchProvider);
return switch (estado) { if (estado is Idle) {
_Idle() => const SizedBox.shrink(), return const SizedBox.shrink();
_Loading() => const Center(child: CircularProgressIndicator()), } else if (estado is Loading) {
_Done(results: final r) when r.isEmpty => Center( return const Center(child: CircularProgressIndicator());
} else if (estado is Done) {
if (estado.results.isEmpty) {
return Center(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
@@ -152,13 +155,14 @@ class _SearchResults extends ConsumerWidget {
), ),
], ],
), ),
), );
_Done(results: final r) => ListView.builder( }
return ListView.builder(
padding: const EdgeInsets.symmetric(vertical: 8), padding: const EdgeInsets.symmetric(vertical: 8),
itemCount: r.length, itemCount: estado.results.length,
itemBuilder: (_, i) => SearchResultTile(resultado: r[i]), itemBuilder: (_, i) => SearchResultTile(resultado: estado.results[i]),
), );
_ => const SizedBox.shrink(), }
}; return const SizedBox.shrink();
} }
} }

View File

@@ -39,7 +39,7 @@ class AppTheme {
color: Colors.white, color: Colors.white,
), ),
), ),
cardTheme: CardTheme( cardTheme: CardThemeData(
color: surfaceColor, color: surfaceColor,
elevation: 2, elevation: 2,
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(

View File

@@ -70,6 +70,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.0.0" version: "6.0.0"
flutter_riverpod:
dependency: "direct main"
description:
name: flutter_riverpod
sha256: "9532ee6db4a943a1ed8383072a2e3eeda041db5657cdf6d2acecf3c21ecbe7e1"
url: "https://pub.dev"
source: hosted
version: "2.6.1"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter
@@ -139,6 +147,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.9.1" version: "1.9.1"
riverpod:
dependency: transitive
description:
name: riverpod
sha256: "59062512288d3056b2321804332a13ffdd1bf16df70dcc8e506e411280a72959"
url: "https://pub.dev"
source: hosted
version: "2.6.1"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@@ -160,6 +176,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.12.1" version: "1.12.1"
state_notifier:
dependency: transitive
description:
name: state_notifier
sha256: b8677376aa54f2d7c58280d5a007f9e8774f1968d1fb1c096adcb4792fba29bb
url: "https://pub.dev"
source: hosted
version: "1.0.0"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:

View File

@@ -34,6 +34,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8 cupertino_icons: ^1.0.8
flutter_riverpod: ^2.4.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: