Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Message details and study page restyle #165

Merged
merged 5 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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`)
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -226,15 +221,14 @@ 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
flutter_activity_recognition: 5c3b026997742b01e82424ef257db9640822ad77
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
Expand Down
75 changes: 35 additions & 40 deletions lib/ui/pages/message_details_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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),
Expand All @@ -55,56 +55,51 @@ 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(
locale.translate(message.message!),
style: aboutCardContentStyle,
textAlign: TextAlign.justify,
)
: const SizedBox.shrink(),
if (message.message != null)
Text(
locale.translate(message.message!),
style: aboutCardContentStyle,
textAlign: TextAlign.justify,
)
],
),
),
),
],
),
),
Padding(
padding: const EdgeInsets.only(bottom: 30),
child: message.url != null
? Padding(
padding: const EdgeInsets.all(8.0),
child: InkWell(
onTap: () async {
try {
await launchUrl(Uri.parse(message.url!));
} catch (error) {
warning(
"Could not launch message URL - '${message.url!}'");
}
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.public_outlined,
color: Theme.of(context).primaryColor),
Text(
locale.translate('pages.about.study.website'),
style: aboutCardSubtitleStyle.copyWith(
color: Theme.of(context).primaryColor)),
],
),
),
)
: const SizedBox.shrink(),
),
if (message.url != null && message.url!.isNotEmpty)
Padding(
padding: const EdgeInsets.only(bottom: 30),
child: Padding(
padding: const EdgeInsets.all(8.0),
child: InkWell(
onTap: () async {
try {
await launchUrl(Uri.parse(message.url!));
} catch (error) {
warning(
"Could not launch message URL - '${message.url!}'");
}
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(Icons.public_outlined,
color: Theme.of(context).primaryColor),
Text(locale.translate('pages.about.study.website'),
style: aboutCardSubtitleStyle.copyWith(
color: Theme.of(context).primaryColor)),
],
),
),
),
),
],
),
),
Expand Down
138 changes: 57 additions & 81 deletions lib/ui/pages/study_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ class StudyPageState extends State<StudyPage> {
timeago.setLocaleMessages('da', timeago.DaMessages());
timeago.setLocaleMessages('es', timeago.EsMessages());

Image messageImage = widget.model.getMessageImage(message.imagePath);

return Card(
semanticContainer: true,
clipBehavior: Clip.antiAliasWithSaveLayer,
Expand All @@ -73,85 +71,63 @@ class StudyPageState extends State<StudyPage> {
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,
)),
]),
],
),
),
),
);
Expand Down
7 changes: 4 additions & 3 deletions lib/ui/widgets/details_banner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ 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(
Expand Down Expand Up @@ -58,7 +59,7 @@ class DetailsBanner extends StatelessWidget {
),
isCarpBanner
? Row(
mainAxisAlignment: MainAxisAlignment.end,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Icon(Icons.touch_app,
Expand Down
Loading