Loading lib/pages/collections/postcard_tile.dart +9 −11 Original line number Original line Diff line number Diff line Loading @@ -43,7 +43,7 @@ class PostcardTile extends StatelessWidget { SizedBox( SizedBox( height: 8, height: 8, ), ), _senderDetail(mediaService) _senderDetail(context, mediaService) ], ], ), ), ), ), Loading @@ -59,22 +59,20 @@ class PostcardTile extends StatelessWidget { ); ); } } Widget _senderDetail(MediaService mediaService) { Widget _senderDetail( BuildContext context, MediaService mediaService, ) { return Row( return Row( children: [ children: [ Text(postcard.sender.userName.length > 13 Text(postcard.sender.userName.length > 13 ? '${postcard.sender.userName.substring(0, 13)}..' ? '${postcard.sender.userName.substring(0, 13)}..' : postcard.sender.userName), : postcard.sender.userName), Spacer(), Spacer(), FutureBuilderHandler( Text( future: mediaService.getFlagBitcode(postcard.originLocation), mediaService.getFlagBitcode(postcard.originLocation), builder: (BuildContext context, data) { style: return Text( TextStyle(fontSize: MediaQuery.of(context).textScaleFactor * 20), data, style: TextStyle( fontSize: MediaQuery.of(context).textScaleFactor * 20), ); }, ), ), ], ], ); ); Loading lib/service/media_service.dart +3 −6 Original line number Original line Diff line number Diff line import 'dart:io'; import 'dart:io'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:country_picker/country_picker.dart'; import 'package:firebase_storage/firebase_storage.dart'; import 'package:firebase_storage/firebase_storage.dart'; import 'package:path/path.dart' as p; import 'package:path/path.dart' as p; import 'package:stamped/data/entities/country_entity.dart'; import 'package:stamped/data/entities/country_entity.dart'; Loading @@ -27,12 +28,8 @@ class MediaService { }, }, ); ); Future<String> getFlagBitcode(String country) async { String getFlagBitcode(String country) { final countrySnapshot = await _countryCollection.doc(country).get(); return Country.tryParse(country)?.flagEmoji ?? ''; if (!countrySnapshot.exists) { throw Exception('Country $country not found'); } return countrySnapshot.data()!.flag; } } Future<Reference?> uploadImage( Future<Reference?> uploadImage( Loading Loading
lib/pages/collections/postcard_tile.dart +9 −11 Original line number Original line Diff line number Diff line Loading @@ -43,7 +43,7 @@ class PostcardTile extends StatelessWidget { SizedBox( SizedBox( height: 8, height: 8, ), ), _senderDetail(mediaService) _senderDetail(context, mediaService) ], ], ), ), ), ), Loading @@ -59,22 +59,20 @@ class PostcardTile extends StatelessWidget { ); ); } } Widget _senderDetail(MediaService mediaService) { Widget _senderDetail( BuildContext context, MediaService mediaService, ) { return Row( return Row( children: [ children: [ Text(postcard.sender.userName.length > 13 Text(postcard.sender.userName.length > 13 ? '${postcard.sender.userName.substring(0, 13)}..' ? '${postcard.sender.userName.substring(0, 13)}..' : postcard.sender.userName), : postcard.sender.userName), Spacer(), Spacer(), FutureBuilderHandler( Text( future: mediaService.getFlagBitcode(postcard.originLocation), mediaService.getFlagBitcode(postcard.originLocation), builder: (BuildContext context, data) { style: return Text( TextStyle(fontSize: MediaQuery.of(context).textScaleFactor * 20), data, style: TextStyle( fontSize: MediaQuery.of(context).textScaleFactor * 20), ); }, ), ), ], ], ); ); Loading
lib/service/media_service.dart +3 −6 Original line number Original line Diff line number Diff line import 'dart:io'; import 'dart:io'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:country_picker/country_picker.dart'; import 'package:firebase_storage/firebase_storage.dart'; import 'package:firebase_storage/firebase_storage.dart'; import 'package:path/path.dart' as p; import 'package:path/path.dart' as p; import 'package:stamped/data/entities/country_entity.dart'; import 'package:stamped/data/entities/country_entity.dart'; Loading @@ -27,12 +28,8 @@ class MediaService { }, }, ); ); Future<String> getFlagBitcode(String country) async { String getFlagBitcode(String country) { final countrySnapshot = await _countryCollection.doc(country).get(); return Country.tryParse(country)?.flagEmoji ?? ''; if (!countrySnapshot.exists) { throw Exception('Country $country not found'); } return countrySnapshot.data()!.flag; } } Future<Reference?> uploadImage( Future<Reference?> uploadImage( Loading