From cf955290fa76157da06f1d931addad19494802d8 Mon Sep 17 00:00:00 2001 From: ibrahim Date: Mon, 29 Jul 2024 12:20:53 +0200 Subject: [PATCH] fix: Expanding a template without subtrial does nothing on Dashboard --- .../dashboard/studies_table_item.dart | 28 +++++++++++++++++++ designer_v2/lib/localization/app_en.arb | 1 + 2 files changed, 29 insertions(+) diff --git a/designer_v2/lib/features/dashboard/studies_table_item.dart b/designer_v2/lib/features/dashboard/studies_table_item.dart index 32c9c2f96..b30d5b4cc 100644 --- a/designer_v2/lib/features/dashboard/studies_table_item.dart +++ b/designer_v2/lib/features/dashboard/studies_table_item.dart @@ -7,6 +7,7 @@ import 'package:studyu_designer_v2/features/dashboard/studies_table.dart'; import 'package:studyu_designer_v2/features/study/study_participation_badge.dart'; import 'package:studyu_designer_v2/features/study/study_status_badge.dart'; import 'package:studyu_designer_v2/features/study/study_type_badge.dart'; +import 'package:studyu_designer_v2/localization/app_translation.dart'; import 'package:studyu_designer_v2/theme.dart'; import 'package:studyu_designer_v2/utils/extensions.dart'; import 'package:studyu_designer_v2/utils/model_action.dart'; @@ -111,6 +112,33 @@ class _StudiesTableItemState extends State { ); subRows.add(_buildStudyRow(theme, subStudy, actions: subActions)); } + } else if (widget.isExpanded && studyGroup.subStudies.isEmpty) { + subRows.add( + Divider( + thickness: isHovering ? 1.5 : 0.75, + color: theme.colorScheme.primaryContainer.withOpacity(0.9), + height: 0.0, + ), + ); + + subRows.add( + Container( + decoration: BoxDecoration( + color: theme.colorScheme.primaryContainer.withOpacity(0.3), + ), + padding: const EdgeInsets.symmetric(horizontal: 48, vertical: 32), + child: Row( + children: [ + Text( + tr.substudies_not_found, + style: widget.normalTextStyle, + maxLines: 3, + overflow: TextOverflow.fade, + ), + ], + ), + ), + ); } return Column( diff --git a/designer_v2/lib/localization/app_en.arb b/designer_v2/lib/localization/app_en.arb index cbd89bd70..2d1ee57e2 100644 --- a/designer_v2/lib/localization/app_en.arb +++ b/designer_v2/lib/localization/app_en.arb @@ -107,6 +107,7 @@ "studies_list_header_participants_active": "Active", "studies_list_header_participants_completed": "Completed", "studies_not_found": "No Studies found", + "substudies_not_found": "Sub-studies not found for this Template Trial", "modify_query": "Modify your query", "studies_empty": "You don't have any studies yet", "studies_empty_description": "Build your own study from scratch or create a new draft copy from an already published study!",