Skip to content

Commit

Permalink
Implement Firebase storage
Browse files Browse the repository at this point in the history
  • Loading branch information
BaptisteLecat committed Sep 22, 2024
1 parent f14c61b commit d9ca74e
Show file tree
Hide file tree
Showing 15 changed files with 496 additions and 314 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ app.*.map.json
lib/firebase_options.dart

ios/AuthKey*.p8
ios/gc*.json
ios/gc*.json
ios/fastlane/build
23 changes: 23 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -981,6 +981,9 @@ PODS:
- Firebase/Performance (10.25.0):
- Firebase/CoreOnly
- FirebasePerformance (~> 10.25.0)
- Firebase/Storage (10.25.0):
- Firebase/CoreOnly
- FirebaseStorage (~> 10.25.0)
- firebase_analytics (10.10.7):
- Firebase/Analytics (= 10.25.0)
- firebase_core
Expand All @@ -1000,6 +1003,10 @@ PODS:
- Firebase/Performance (= 10.25.0)
- firebase_core
- Flutter
- firebase_storage (11.7.7):
- Firebase/Storage (= 10.25.0)
- firebase_core
- Flutter
- FirebaseABTesting (10.29.0):
- FirebaseCore (~> 10.0)
- FirebaseAnalytics (10.25.0):
Expand Down Expand Up @@ -1028,6 +1035,7 @@ PODS:
- GoogleUtilities/Environment (~> 7.8)
- GTMSessionFetcher/Core (< 4.0, >= 2.1)
- RecaptchaInterop (~> 100.0)
- FirebaseAuthInterop (10.29.0)
- FirebaseCore (10.25.0):
- FirebaseCoreInternal (~> 10.0)
- GoogleUtilities/Environment (~> 7.12)
Expand Down Expand Up @@ -1100,6 +1108,13 @@ PODS:
- nanopb (< 2.30911.0, >= 2.30908.0)
- PromisesSwift (~> 2.1)
- FirebaseSharedSwift (10.29.0)
- FirebaseStorage (10.25.0):
- FirebaseAppCheckInterop (~> 10.0)
- FirebaseAuthInterop (~> 10.25)
- FirebaseCore (~> 10.0)
- FirebaseCoreExtension (~> 10.0)
- GoogleUtilities/Environment (~> 7.12)
- GTMSessionFetcher/Core (< 4.0, >= 2.1)
- Flutter (1.0.0)
- geolocator_apple (1.2.0):
- Flutter
Expand Down Expand Up @@ -1281,6 +1296,7 @@ DEPENDENCIES:
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_crashlytics (from `.symlinks/plugins/firebase_crashlytics/ios`)
- firebase_performance (from `.symlinks/plugins/firebase_performance/ios`)
- firebase_storage (from `.symlinks/plugins/firebase_storage/ios`)
- Flutter (from `Flutter`)
- geolocator_apple (from `.symlinks/plugins/geolocator_apple/ios`)
- google_sign_in_ios (from `.symlinks/plugins/google_sign_in_ios/darwin`)
Expand All @@ -1299,6 +1315,7 @@ SPEC REPOS:
- FirebaseAnalytics
- FirebaseAppCheckInterop
- FirebaseAuth
- FirebaseAuthInterop
- FirebaseCore
- FirebaseCoreExtension
- FirebaseCoreInternal
Expand All @@ -1311,6 +1328,7 @@ SPEC REPOS:
- FirebaseRemoteConfigInterop
- FirebaseSessions
- FirebaseSharedSwift
- FirebaseStorage
- GoogleAppMeasurement
- GoogleDataTransport
- GoogleSignIn
Expand Down Expand Up @@ -1338,6 +1356,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/firebase_crashlytics/ios"
firebase_performance:
:path: ".symlinks/plugins/firebase_performance/ios"
firebase_storage:
:path: ".symlinks/plugins/firebase_storage/ios"
Flutter:
:path: Flutter
geolocator_apple:
Expand All @@ -1364,10 +1384,12 @@ SPEC CHECKSUMS:
firebase_core: a626d00494efa398e7c54f25f1454a64c8abf197
firebase_crashlytics: 17e856fabec68d993662abaf2f6fe2413f0abece
firebase_performance: c38de2d2f8bcec54fdbc3595716d34c38f3ffe7a
firebase_storage: 5c0f552d6b27d621429d7fd16ebab4be94a3c954
FirebaseABTesting: d87f56707159bae64e269757a6e963d490f2eebe
FirebaseAnalytics: ec00fe8b93b41dc6fe4a28784b8e51da0647a248
FirebaseAppCheckInterop: 6a1757cfd4067d8e00fccd14fcc1b8fd78cfac07
FirebaseAuth: c0f93dcc570c9da2bffb576969d793e95c344fbb
FirebaseAuthInterop: 17db81e9b198afb0f95ce48c133825727eed55d3
FirebaseCore: 7ec4d0484817f12c3373955bc87762d96842d483
FirebaseCoreExtension: 705ca5b14bf71d2564a0ddc677df1fc86ffa600f
FirebaseCoreInternal: df84dd300b561c27d5571684f389bf60b0a5c934
Expand All @@ -1380,6 +1402,7 @@ SPEC CHECKSUMS:
FirebaseRemoteConfigInterop: 6efda51fb5e2f15b16585197e26eaa09574e8a4d
FirebaseSessions: dbd14adac65ce996228652c1fc3a3f576bdf3ecc
FirebaseSharedSwift: 20530f495084b8d840f78a100d8c5ee613375f6e
FirebaseStorage: 44f4e25073f6fa0d4d8c09f5bec299ee9e4eb985
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
geolocator_apple: 6cbaf322953988e009e5ecb481f07efece75c450
google_sign_in_ios: 07375bfbf2620bc93a602c0e27160d6afc6ead38
Expand Down
220 changes: 118 additions & 102 deletions lib/src/features/feed/presentation/feed_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:weatherjourney/src/features/feed/domain/root_generation/root_gen
import 'package:weatherjourney/src/features/user/data/firestore/user_firestore_repository.dart';
import 'package:weatherjourney/src/features/user/domain/user/user.dart';
import 'package:weatherjourney/src/routing/app_router.dart';
import 'package:weatherjourney/src/utils/storage_fetcher.dart';

class FeedPageScreen extends ConsumerWidget {
const FeedPageScreen({super.key});
Expand Down Expand Up @@ -84,129 +85,144 @@ class FeedPageScreen extends ConsumerWidget {
child: AsyncValueWidget<List<RootGeneration>>(
value:
ref.watch(rootGenerationFetchAllMostLikedFutureProvider),
data: (data) {
data: (rootGenerations) {
return ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: data.length,
itemCount: rootGenerations.length,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
GoRouter.of(context).push(
'${AppRoute.generations.route}/${data[index].id}');
'${AppRoute.generations.route}/${rootGenerations[index].id}');
},
child: Hero(
tag: data[index].id,
child: Container(
height: 250,
margin: const EdgeInsets.symmetric(vertical: 8),
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(
"${data[index].generation.generatedImage?.uri}"),
fit: BoxFit.cover,
),
borderRadius: BorderRadius.circular(36),
),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Container(
height: 42,
padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 4),
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.circular(22),
),
child: Row(
children: [
Icon(
IconsaxPlusBold.location,
size: 16,
),
const SizedBox(width: 6),
Text(
"${data[index].location.getCityText()}",
style: Theme.of(context)
.textTheme
.bodySmall!
.copyWith(
fontWeight:
FontWeight.bold,
),
),
],
),
tag: rootGenerations[index].id,
child: AsyncValueWidget<String>(
value: ref.watch(generationImageFutureProvider(
rootGenerations[index].id)),
data: (imageUrl) {
return Container(
height: 250,
margin:
const EdgeInsets.symmetric(vertical: 8),
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(
imageUrl,
),
],
fit: BoxFit.cover,
),
borderRadius: BorderRadius.circular(36),
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Flexible(
flex: 3,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: [
Text(
data[index].generation.prompt,
maxLines: 3,
style: Theme.of(context)
.textTheme
.bodySmall!
.copyWith(
fontWeight:
FontWeight.bold,
color: Colors.white,
Container(
height: 42,
padding:
const EdgeInsets.symmetric(
horizontal: 10,
vertical: 4),
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.circular(22),
),
child: Row(
children: [
Icon(
IconsaxPlusBold.location,
size: 16,
),
),
const SizedBox(height: 6),
Row(
children: [
Text('Today',
const SizedBox(width: 6),
Text(
"${rootGenerations[index].location.getCityText()}",
style: Theme.of(context)
.textTheme
.labelMedium!
.bodySmall!
.copyWith(
color: Colors
.white)),
const SizedBox(width: 6),
Icon(
IconsaxPlusBold.sun_1,
size: 16,
color: Colors.white,
),
const SizedBox(width: 6),
Text('18°C',
fontWeight:
FontWeight.bold,
),
),
],
),
),
],
),
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Flexible(
flex: 3,
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
rootGenerations[index]
.generation
.prompt,
maxLines: 3,
style: Theme.of(context)
.textTheme
.labelMedium!
.bodySmall!
.copyWith(
color: Colors
.white)),
],
fontWeight:
FontWeight.bold,
color: Colors.white,
),
),
const SizedBox(height: 6),
Row(
children: [
Text('Today',
style: Theme.of(
context)
.textTheme
.labelMedium!
.copyWith(
color: Colors
.white)),
const SizedBox(
width: 6),
Icon(
IconsaxPlusBold.sun_1,
size: 16,
color: Colors.white,
),
const SizedBox(
width: 6),
Text('18°C',
style: Theme.of(
context)
.textTheme
.labelMedium!
.copyWith(
color: Colors
.white)),
],
),
],
),
),
const Spacer(),
],
),
),
const Spacer(),
],
)
],
),
),
),
)
],
),
),
);
}),
),
);
},
Expand Down
Loading

0 comments on commit d9ca74e

Please sign in to comment.