From 2be7f5be9a74910d3e91f90d16d28a21bb016108 Mon Sep 17 00:00:00 2001 From: Lars Refsgaard <1552887+LarsRefsgaard@users.noreply.github.com> Date: Tue, 27 Jun 2023 11:47:35 +0200 Subject: [PATCH] Fixed images in about page --- ios/Podfile.lock | 8 +- lib/ui/pages/message_details_page.dart | 11 +- lib/ui/pages/study_page.dart | 137 ++++++++++--------------- lib/ui/widgets/details_banner.dart | 4 +- pubspec.lock | 70 ++++++------- pubspec.yaml | 1 + 6 files changed, 99 insertions(+), 132 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 14fad9a7..fc7ee224 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -41,8 +41,6 @@ PODS: - OrderedSet (~> 5.0) - flutter_local_notifications (0.0.1): - Flutter - - flutter_native_timezone (0.0.1): - - Flutter - flutter_sound (9.2.13): - Flutter - flutter_sound_core (= 9.2.13) @@ -114,7 +112,6 @@ DEPENDENCIES: - flutter_blue_plus (from `.symlinks/plugins/flutter_blue_plus/ios`) - flutter_inappwebview (from `.symlinks/plugins/flutter_inappwebview/ios`) - flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`) - - flutter_native_timezone (from `.symlinks/plugins/flutter_native_timezone/ios`) - flutter_sound (from `.symlinks/plugins/flutter_sound/ios`) - flutter_timezone (from `.symlinks/plugins/flutter_timezone/ios`) - just_audio (from `.symlinks/plugins/just_audio/ios`) @@ -178,8 +175,6 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/flutter_inappwebview/ios" flutter_local_notifications: :path: ".symlinks/plugins/flutter_local_notifications/ios" - flutter_native_timezone: - :path: ".symlinks/plugins/flutter_native_timezone/ios" flutter_sound: :path: ".symlinks/plugins/flutter_sound/ios" flutter_timezone: @@ -226,7 +221,7 @@ SPEC CHECKSUMS: battery_plus: 9bff772a7e5e4d5381ca3ca92a97373a3d8b2738 camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e - device_info_plus: e5c5da33f982a436e103237c0c85f9031142abed + device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea ESense: cbe103ad16c435424f2fd6f8b274f2468af84173 esense_flutter: 8bfadfdefe7b51d6f78366e43b2b64ec9b6144b6 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 @@ -234,7 +229,6 @@ SPEC CHECKSUMS: flutter_blue_plus: 316ac8d1179789616d2c148e8a03c37720e63933 flutter_inappwebview: 50b55a88f5dddadc9e741a7caf72f378116e2156 flutter_local_notifications: 0c0b1ae97e741e1521e4c1629a459d04b9aec743 - flutter_native_timezone: 5f05b2de06c9776b4cc70e1839f03de178394d22 flutter_sound: c60effa2a350fb977885f0db2fbc4c1ad5160900 flutter_sound_core: 26c10e5832e76aaacfae252d8925232281c486ae flutter_timezone: ffb07bdad3c6276af8dada0f11978d8a1f8a20bb diff --git a/lib/ui/pages/message_details_page.dart b/lib/ui/pages/message_details_page.dart index a72dea39..3ca3f156 100644 --- a/lib/ui/pages/message_details_page.dart +++ b/lib/ui/pages/message_details_page.dart @@ -20,7 +20,7 @@ class MessageDetailsPage extends StatelessWidget { subTitle: 'Unknown message', type: MessageType.announcement, timestamp: DateTime.now(), - imagePath: './assets/images/kids.png'); + image: './assets/images/kids.png'); }); return Scaffold( @@ -44,7 +44,7 @@ class MessageDetailsPage extends StatelessWidget { Flexible( child: CustomScrollView( slivers: [ - DetailsBanner(message.title!, message.imagePath), + DetailsBanner(message.title!, message.image), SliverToBoxAdapter( child: Padding( padding: const EdgeInsets.symmetric(horizontal: 30), @@ -55,20 +55,17 @@ class MessageDetailsPage extends StatelessWidget { '${locale.translate(message.type.toString().split('.').last.toLowerCase())} - ${timeago.format(DateTime.now().copyWithAdditional(years: -DateTime.now().year + message.timestamp.year, months: -DateTime.now().month + message.timestamp.month, days: -DateTime.now().day + message.timestamp.day, hours: -DateTime.now().hour + message.timestamp.hour, minutes: -DateTime.now().minute + message.timestamp.minute), locale: Localizations.localeOf(context).languageCode)}', style: aboutCardSubtitleStyle.copyWith( color: Theme.of(context).primaryColor)), - const SizedBox(height: 5), message.subTitle != null ? Text(locale.translate(message.subTitle!), style: aboutCardContentStyle.copyWith( color: Theme.of(context).primaryColor)) : const SizedBox.shrink(), - const SizedBox(height: 5), - message.message != null - ? Text( + if(message.message != null) + Text( locale.translate(message.message!), style: aboutCardContentStyle, textAlign: TextAlign.justify, ) - : const SizedBox.shrink(), ], ), ), diff --git a/lib/ui/pages/study_page.dart b/lib/ui/pages/study_page.dart index c90738c5..b39d7b20 100644 --- a/lib/ui/pages/study_page.dart +++ b/lib/ui/pages/study_page.dart @@ -59,8 +59,6 @@ class StudyPageState extends State { timeago.setLocaleMessages('da', timeago.DaMessages()); timeago.setLocaleMessages('es', timeago.EsMessages()); - Image messageImage = widget.model.getMessageImage(message.imagePath); - return Card( semanticContainer: true, clipBehavior: Clip.antiAliasWithSaveLayer, @@ -73,85 +71,62 @@ class StudyPageState extends State { onTap: () { context.push('/message/${message.id}'); }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Row(children: [ - message.imagePath != null - ? Expanded( - child: Container( - height: 150.0, - color: Theme.of(context) - .colorScheme - .secondary, //Color(0xFFF1F9FF), - child: messageImage, - )) - : const SizedBox.shrink() - ]), - const SizedBox(height: 10), - Row( - crossAxisAlignment: CrossAxisAlignment.baseline, - textBaseline: TextBaseline.ideographic, - children: [ - const SizedBox(width: 15), - Expanded( - child: Text(locale.translate(message.title!), - style: aboutCardTitleStyle.copyWith( - color: Theme.of(context).primaryColor))), - ], - ), - const SizedBox(height: 5), - Row(children: [ - const SizedBox(width: 15), - Text( - // locale.translate(message.type.toString().split('.')[1][0].toUpperCase() + - // message.type.toString().split('.')[1].substring(1)) + - '${locale.translate(message.type.toString().split('.').last.toLowerCase())} - ${timeago.format( - DateTime.now().copyWithAdditional( - years: -DateTime.now().year + message.timestamp.year, - months: -DateTime.now().month + message.timestamp.month, - days: -DateTime.now().day + message.timestamp.day, - hours: -DateTime.now().hour + message.timestamp.hour, - minutes: - -DateTime.now().minute + message.timestamp.minute), - locale: Localizations.localeOf(context).languageCode, - )}', - style: aboutCardSubtitleStyle.copyWith( - color: Theme.of(context).primaryColor)), - ]), - const SizedBox(height: 5), - Row(children: [ - const SizedBox(width: 15), - if (message.subTitle!.isNotEmpty) - Expanded( - child: Text(locale.translate(message.subTitle!), - style: aboutCardContentStyle.copyWith( - color: Theme.of(context).primaryColor))), - ]), - const SizedBox(height: 5), - Row(children: [ - const SizedBox(width: 15), - if (message.message != null && message.message!.isNotEmpty) - Expanded( - child: Text( - "${locale.translate(message.message!).substring(0, (message.message!.length > 150) ? 150 : null)}...", - style: aboutCardContentStyle, - textAlign: TextAlign.justify, - )), - const SizedBox(width: 15), - ]), - const SizedBox(height: 5), - // Row(mainAxisAlignment: MainAxisAlignment.end, children: [ - // Icon(Icons.touch_app, color: Theme.of(context).primaryColor, size: 18), - // // Text(locale.translate("pages.about.message.read_more"), - // // style: aboutCardContentStyle.copyWith( - // // color: Theme.of(context).primaryColor, fontStyle: FontStyle.italic), - // // textAlign: TextAlign.right), - // SizedBox(width: 15), - // ]), - const SizedBox(height: 10), - ], + child: Padding( + padding: const EdgeInsets.all(8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + if (message.image != null && message.image != '') + Center( + child: Container( + height: 150.0, + color: Theme.of(context) + .colorScheme + .secondary, //Color(0xFFF1F9FF), + child: widget.model.getMessageImage(message.image), + ), + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Text(locale.translate(message.title!), + style: aboutCardTitleStyle.copyWith( + color: Theme.of(context).primaryColor)), + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Text( + '${locale.translate(message.type.toString().split('.').last.toLowerCase())} - ${timeago.format( + DateTime.now().copyWithAdditional( + years: -DateTime.now().year + message.timestamp.year, + months: -DateTime.now().month + message.timestamp.month, + days: -DateTime.now().day + message.timestamp.day, + hours: -DateTime.now().hour + message.timestamp.hour, + minutes: + -DateTime.now().minute + message.timestamp.minute), + locale: Localizations.localeOf(context).languageCode, + )}', + style: aboutCardSubtitleStyle.copyWith( + color: Theme.of(context).primaryColor)), + ), + Row(children: [ + if (message.subTitle!.isNotEmpty) + Expanded( + child: Text(locale.translate(message.subTitle!), + style: aboutCardContentStyle.copyWith( + color: Theme.of(context).primaryColor))), + ]), + Row(children: [ + if (message.message != null && message.message!.isNotEmpty) + Expanded( + child: Text( + "${locale.translate(message.message!).substring(0, (message.message!.length > 150) ? 150 : null)}...", + style: aboutCardContentStyle, + textAlign: TextAlign.justify, + )), + ]), + ], + ), ), ), ); diff --git a/lib/ui/widgets/details_banner.dart b/lib/ui/widgets/details_banner.dart index 48540e75..f0c4f80b 100644 --- a/lib/ui/widgets/details_banner.dart +++ b/lib/ui/widgets/details_banner.dart @@ -20,11 +20,11 @@ class DetailsBanner extends StatelessWidget { flexibleSpace: FlexibleSpaceBar( centerTitle: true, titlePadding: const EdgeInsets.only(top: 15), - background: imagePath != null + background: imagePath != null && imagePath!.isNotEmpty ? ClipRRect( child: ImageFiltered( imageFilter: ui.ImageFilter.blur(sigmaX: 1, sigmaY: 1), - child: Image.asset(imagePath!, fit: BoxFit.fitHeight)), + child: bloc.data.studyPageViewModel.getMessageImage(imagePath)), ) : const SizedBox.shrink(), title: InkWell( diff --git a/pubspec.lock b/pubspec.lock index df3051e1..f97fbbb8 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -222,7 +222,7 @@ packages: description: path: "packages/carp_audio_package" ref: "develop-1.1.0" - resolved-ref: c3a3e9ac80ac4d98944cf77d9a45a39e4523f98f + resolved-ref: d6a8dcf9a09f94e65b00b44920f431f91570cfde url: "https://github.com/cph-cachet/carp.sensing-flutter.git" source: git version: "1.1.0" @@ -231,7 +231,7 @@ packages: description: path: "backends/carp_backend" ref: "develop-1.1.0" - resolved-ref: c3a3e9ac80ac4d98944cf77d9a45a39e4523f98f + resolved-ref: d6a8dcf9a09f94e65b00b44920f431f91570cfde url: "https://github.com/cph-cachet/carp.sensing-flutter.git" source: git version: "1.1.0" @@ -240,7 +240,7 @@ packages: description: path: "packages/carp_connectivity_package" ref: "develop-1.1.0" - resolved-ref: c3a3e9ac80ac4d98944cf77d9a45a39e4523f98f + resolved-ref: d6a8dcf9a09f94e65b00b44920f431f91570cfde url: "https://github.com/cph-cachet/carp.sensing-flutter.git" source: git version: "1.1.0" @@ -249,7 +249,7 @@ packages: description: path: "packages/carp_context_package" ref: "develop-1.1.0" - resolved-ref: c3a3e9ac80ac4d98944cf77d9a45a39e4523f98f + resolved-ref: d6a8dcf9a09f94e65b00b44920f431f91570cfde url: "https://github.com/cph-cachet/carp.sensing-flutter.git" source: git version: "1.1.0" @@ -258,7 +258,7 @@ packages: description: path: carp_core ref: "develop-1.1.0" - resolved-ref: c3a3e9ac80ac4d98944cf77d9a45a39e4523f98f + resolved-ref: d6a8dcf9a09f94e65b00b44920f431f91570cfde url: "https://github.com/cph-cachet/carp.sensing-flutter.git" source: git version: "1.1.0" @@ -267,7 +267,7 @@ packages: description: path: "packages/carp_esense_package" ref: "develop-1.1.0" - resolved-ref: c3a3e9ac80ac4d98944cf77d9a45a39e4523f98f + resolved-ref: d6a8dcf9a09f94e65b00b44920f431f91570cfde url: "https://github.com/cph-cachet/carp.sensing-flutter.git" source: git version: "1.1.0" @@ -276,7 +276,7 @@ packages: description: path: carp_mobile_sensing ref: "develop-1.1.0" - resolved-ref: c3a3e9ac80ac4d98944cf77d9a45a39e4523f98f + resolved-ref: d6a8dcf9a09f94e65b00b44920f431f91570cfde url: "https://github.com/cph-cachet/carp.sensing-flutter.git" source: git version: "1.1.0" @@ -285,7 +285,7 @@ packages: description: path: "packages/carp_polar_package" ref: "develop-1.1.0" - resolved-ref: c3a3e9ac80ac4d98944cf77d9a45a39e4523f98f + resolved-ref: d6a8dcf9a09f94e65b00b44920f431f91570cfde url: "https://github.com/cph-cachet/carp.sensing-flutter.git" source: git version: "1.1.0" @@ -302,7 +302,7 @@ packages: description: path: "packages/carp_survey_package" ref: "develop-1.1.0" - resolved-ref: c3a3e9ac80ac4d98944cf77d9a45a39e4523f98f + resolved-ref: d6a8dcf9a09f94e65b00b44920f431f91570cfde url: "https://github.com/cph-cachet/carp.sensing-flutter.git" source: git version: "1.1.0" @@ -311,7 +311,7 @@ packages: description: path: "backends/carp_webservices" ref: "develop-1.1.0" - resolved-ref: c3a3e9ac80ac4d98944cf77d9a45a39e4523f98f + resolved-ref: d6a8dcf9a09f94e65b00b44920f431f91570cfde url: "https://github.com/cph-cachet/carp.sensing-flutter.git" source: git version: "1.1.0" @@ -452,13 +452,13 @@ packages: source: hosted version: "0.7.8" device_info_plus: - dependency: transitive + dependency: "direct overridden" description: name: device_info_plus - sha256: f52ab3b76b36ede4d135aab80194df8925b553686f0fa12226b4e2d658e45903 + sha256: "9b1a0c32b2a503f8fe9f8764fac7b5fcd4f6bd35d8f49de5350bccf9e2a33b8a" url: "https://pub.dev" source: hosted - version: "8.2.2" + version: "9.0.0" device_info_plus_platform_interface: dependency: transitive description: @@ -621,14 +621,6 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.15" - flutter_native_timezone: - dependency: transitive - description: - name: flutter_native_timezone - sha256: ed7bfb982f036243de1c068e269182a877100c994f05143c8b26a325e28c1b02 - url: "https://pub.dev" - source: hosted - version: "2.0.0" flutter_plugin_android_lifecycle: dependency: transitive description: @@ -867,10 +859,10 @@ packages: dependency: transitive description: name: light - sha256: b4c8f9f1faad2c0b60f53ae0bc78c02a5645edeb889802cfed2137a0a04ed57a + sha256: d5c91decb08ca54cde1a15c625472d7a5a1ae43ede96107ac46506ddd8346ed2 url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "3.0.0" lints: dependency: transitive description: @@ -1131,10 +1123,10 @@ packages: dependency: transitive description: name: pedometer - sha256: "16d7a3df91b9ad72304cf47924dfe9c1abd50304fbf23245edbc89d8429957c1" + sha256: e8c574dae778276fa848873c6ea2015a636a91e8572a4a652b04a4fcd6c54259 url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "4.0.1" permission_handler: dependency: transitive description: @@ -1315,10 +1307,10 @@ packages: dependency: transitive description: name: screen_state - sha256: "39184c718baf303f26200f6b1392b12a549d88410e907e046d75594588c0df5d" + sha256: "5ca9ceed5326f13745b582227f4cd37b965574c49b2be9efbcd50b84ab9e0644" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "3.0.0" sensors_plus: dependency: transitive description: @@ -1371,10 +1363,10 @@ packages: dependency: transitive description: name: shared_preferences_platform_interface - sha256: fb5cf25c0235df2d0640ac1b1174f6466bd311f621574997ac59018a6664548d + sha256: "23b052f17a25b90ff2b61aad4cc962154da76fb62848a9ce088efe30d7c50ab1" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.0" shared_preferences_web: dependency: transitive description: @@ -1648,10 +1640,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: eed4e6a1164aa9794409325c3b707ff424d4d1c2a785e7db67f8bbda00e36e51 + sha256: "15f5acbf0dce90146a0f5a2c4a002b1814a6303c4c5c075aa2623b2d16156f03" url: "https://pub.dev" source: hosted - version: "6.0.35" + version: "6.0.36" url_launcher_ios: dependency: transitive description: @@ -1680,10 +1672,10 @@ packages: dependency: transitive description: name: url_launcher_platform_interface - sha256: "6c9ca697a5ae218ce56cece69d46128169a58aa8653c1b01d26fcd4aad8c4370" + sha256: bfdfa402f1f3298637d71ca8ecfe840b4696698213d5346e9d12d4ab647ee2ea url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.3" url_launcher_web: dependency: transitive description: @@ -1784,10 +1776,10 @@ packages: dependency: transitive description: name: vm_service - sha256: c620a6f783fa22436da68e42db7ebbf18b8c44b9a46ab911f666ff09ffd9153f + sha256: b8c67f5fa3897b122cf60fe9ff314f7b0ef71eab25c5f8b771480bc338f48823 url: "https://pub.dev" source: hosted - version: "11.7.1" + version: "11.7.2" watcher: dependency: transitive description: @@ -1828,6 +1820,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.1.4" + win32_registry: + dependency: transitive + description: + name: win32_registry + sha256: "1c52f994bdccb77103a6231ad4ea331a244dbcef5d1f37d8462f713143b0bfae" + url: "https://pub.dev" + source: hosted + version: "1.1.0" xdg_directories: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 0c1b566e..0932100a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -51,6 +51,7 @@ dependencies: dependency_overrides: intl: 0.18.0 + device_info_plus: 9.0.0 carp_core: git: