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:
@@ -9,7 +9,13 @@
|
||||
"Bash(rm -rf lib/src)",
|
||||
"Bash(cp -r basura_app/lib/* lib/)",
|
||||
"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 *)"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,20 +45,20 @@ final recyclingSearchProvider =
|
||||
sealed class RecyclingSearchState {
|
||||
const RecyclingSearchState();
|
||||
|
||||
const factory RecyclingSearchState.idle() = _Idle;
|
||||
const factory RecyclingSearchState.loading() = _Loading;
|
||||
const factory RecyclingSearchState.done(List<SearchResult> results) = _Done;
|
||||
const factory RecyclingSearchState.idle() = Idle;
|
||||
const factory RecyclingSearchState.loading() = Loading;
|
||||
const factory RecyclingSearchState.done(List<SearchResult> results) = Done;
|
||||
}
|
||||
|
||||
class _Idle extends RecyclingSearchState {
|
||||
const _Idle();
|
||||
class Idle extends RecyclingSearchState {
|
||||
const Idle();
|
||||
}
|
||||
|
||||
class _Loading extends RecyclingSearchState {
|
||||
const _Loading();
|
||||
class Loading extends RecyclingSearchState {
|
||||
const Loading();
|
||||
}
|
||||
|
||||
class _Done extends RecyclingSearchState {
|
||||
class Done extends RecyclingSearchState {
|
||||
final List<SearchResult> results;
|
||||
const _Done(this.results);
|
||||
const Done(this.results);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ class AppTheme {
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
cardTheme: CardTheme(
|
||||
cardTheme: CardThemeData(
|
||||
color: surfaceColor,
|
||||
elevation: 2,
|
||||
shape: RoundedRectangleBorder(
|
||||
|
||||
24
pubspec.lock
24
pubspec.lock
@@ -70,6 +70,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
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:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -139,6 +147,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.9.1"
|
||||
riverpod:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: riverpod
|
||||
sha256: "59062512288d3056b2321804332a13ffdd1bf16df70dcc8e506e411280a72959"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.6.1"
|
||||
sky_engine:
|
||||
dependency: transitive
|
||||
description: flutter
|
||||
@@ -160,6 +176,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
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:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -34,6 +34,7 @@ dependencies:
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
cupertino_icons: ^1.0.8
|
||||
flutter_riverpod: ^2.4.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user