From 57972c5772c34c67428d8a747f14d72258e4e1e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Kowali=C5=84ski?= Date: Mon, 6 Jan 2025 23:46:02 +0100 Subject: [PATCH 1/2] feat(science-clubs): add verified badge UI --- .../widgets/science_clubs_section.dart | 4 +- .../widgets/science_clubs_section.dart | 2 +- .../science_club_detail_view.dart | 19 ++------ .../widgets/ensure_visible_tags.dart | 32 +++++--------- .../widgets/science_club_card.dart | 1 + .../widgets/strategic_badge.dart | 44 +++++++++++++++++++ .../widgets/verified_badge.dart | 31 +++++++++++++ lib/l10n/app_pl.arb | 10 ++--- lib/widgets/big_preview_card.dart | 9 ++-- lib/widgets/dual_text_max_lines.dart | 32 +++++--------- lib/widgets/wide_tile_card.dart | 8 +++- 11 files changed, 122 insertions(+), 70 deletions(-) create mode 100644 lib/features/science_clubs_view/widgets/strategic_badge.dart create mode 100644 lib/features/science_clubs_view/widgets/verified_badge.dart diff --git a/lib/features/department_detail_view/widgets/science_clubs_section.dart b/lib/features/department_detail_view/widgets/science_clubs_section.dart index 7b533273..1ffcc3a4 100644 --- a/lib/features/department_detail_view/widgets/science_clubs_section.dart +++ b/lib/features/department_detail_view/widgets/science_clubs_section.dart @@ -15,7 +15,6 @@ import "../../navigator/utils/navigation_commands.dart"; import "../../science_clubs_view/repository/science_clubs_repository.dart"; import "../repository/department_details_repository.dart"; -// TODO(simon-the-shark): Resolve if the list button should redirect to list of all study circles or only ones related to the department., #165 class DepartmentScienceClubsSection extends ConsumerWidget { const DepartmentScienceClubsSection(this.department, {super.key}); final DepartmentDetails? department; @@ -83,7 +82,8 @@ class _ScienceClubsList extends ConsumerWidget { ? sciClub.cover?.filename_disk : sciClub.logo?.filename_disk, onClick: () async => ref.navigateSciClubsDetail(sciClub.id), - showBadge: sciClub.source == ScienceClubsViewConfig.source, + showVerifiedBadge: sciClub.source == ScienceClubsViewConfig.source, + showStrategicBadge: true, ), ); }, diff --git a/lib/features/home_view/widgets/science_clubs_section.dart b/lib/features/home_view/widgets/science_clubs_section.dart index b02c3a4e..5fd84afe 100644 --- a/lib/features/home_view/widgets/science_clubs_section.dart +++ b/lib/features/home_view/widgets/science_clubs_section.dart @@ -104,7 +104,7 @@ class _BuildScienceClubCard extends StatelessWidget { directusUrl: (sciClub.useCoverAsPreviewPhoto ?? false) ? sciClub.cover?.filename_disk : sciClub.logo?.filename_disk, - showBadge: sciClub.source == ScienceClubsViewConfig.source, + showVerifiedBadge: sciClub.source == ScienceClubsViewConfig.source, onClick: () async => ref.navigateSciClubsDetail(sciClub.id), ); } diff --git a/lib/features/science_club_detail_view/science_club_detail_view.dart b/lib/features/science_club_detail_view/science_club_detail_view.dart index 7f3001aa..65ee8ef7 100644 --- a/lib/features/science_club_detail_view/science_club_detail_view.dart +++ b/lib/features/science_club_detail_view/science_club_detail_view.dart @@ -15,6 +15,8 @@ import "../../widgets/loading_widgets/contact_section_loading.dart"; import "../../widgets/loading_widgets/header_section_loading.dart"; import "../../widgets/loading_widgets/shimmer_loading.dart"; import "../../widgets/my_error_widget.dart"; +import "../science_clubs_view/widgets/strategic_badge.dart"; +import "../science_clubs_view/widgets/verified_badge.dart"; import "repository/science_club_details_repository.dart"; import "widgets/about_us_section.dart"; import "widgets/about_us_section_loading.dart"; @@ -69,21 +71,8 @@ class _SciClubDetailDataView extends ConsumerWidget { style: context.textTheme.headline, children: [ if (value.source == ScienceClubsViewConfig.source) - WidgetSpan( - baseline: TextBaseline.ideographic, - alignment: PlaceholderAlignment.middle, - child: SizedBox.square( - dimension: 16, - child: Padding( - padding: const EdgeInsets.only(left: 4), - child: Icon( - Icons.verified_sharp, - size: 12, - color: context.colorTheme.orangePomegranade, - ), - ), - ), - ), + const VerifiedBadge(), + const StrategicBadge(), ], ), ), diff --git a/lib/features/science_clubs_view/widgets/ensure_visible_tags.dart b/lib/features/science_clubs_view/widgets/ensure_visible_tags.dart index f2c90db4..ee1ccdaf 100644 --- a/lib/features/science_clubs_view/widgets/ensure_visible_tags.dart +++ b/lib/features/science_clubs_view/widgets/ensure_visible_tags.dart @@ -3,9 +3,10 @@ import "dart:math"; import "package:auto_size_text/auto_size_text.dart"; import "package:flutter/material.dart"; -import "../../../theme/app_theme.dart"; import "../../../utils/calculate_lines.dart"; import "../../../widgets/dual_text_max_lines.dart"; +import "strategic_badge.dart"; +import "verified_badge.dart"; class EnsureVisibleTags extends DualTextMaxLines { /// DualTextMaxLines with third text row that must have at least one line @@ -19,12 +20,12 @@ class EnsureVisibleTags extends DualTextMaxLines { super.key, this.secondSubtitle, this.secondSubtitleStyle, - this.badge = false, + super.showVerifiedBadge = false, + super.showStrategicBadge = false, }); final String? secondSubtitle; final TextStyle? secondSubtitleStyle; - final bool badge; @override Widget build(BuildContext context) { @@ -32,7 +33,12 @@ class EnsureVisibleTags extends DualTextMaxLines { return super.build(context); } final placeholderDimensions = [ - if (badge) + if (showVerifiedBadge) + const PlaceholderDimensions( + size: Size(12, 12), + alignment: PlaceholderAlignment.middle, + ), + if (showStrategicBadge) const PlaceholderDimensions( size: Size(12, 12), alignment: PlaceholderAlignment.middle, @@ -56,22 +62,8 @@ class EnsureVisibleTags extends DualTextMaxLines { ? titleStyle : titleStyle?.copyWith(fontSize: fontSize), children: [ - if (badge) - WidgetSpan( - baseline: TextBaseline.ideographic, - alignment: PlaceholderAlignment.middle, - child: SizedBox.square( - dimension: 16, - child: Padding( - padding: const EdgeInsets.only(left: 4), - child: Icon( - Icons.verified_sharp, - size: 12, - color: context.colorTheme.orangePomegranade, - ), - ), - ), - ), + if (showVerifiedBadge) const VerifiedBadge(), + if (showStrategicBadge) const StrategicBadge(), ], ); diff --git a/lib/features/science_clubs_view/widgets/science_club_card.dart b/lib/features/science_clubs_view/widgets/science_club_card.dart index 54455a74..d95c175b 100644 --- a/lib/features/science_clubs_view/widgets/science_club_card.dart +++ b/lib/features/science_clubs_view/widgets/science_club_card.dart @@ -22,6 +22,7 @@ class ScienceClubCard extends StatelessWidget { .toList() .join(", "), showBadge: sciClub.source == ScienceClubsViewConfig.source, + showStrategicBadge: true, activeShadows: null, trailing: Padding( padding: const EdgeInsets.only( diff --git a/lib/features/science_clubs_view/widgets/strategic_badge.dart b/lib/features/science_clubs_view/widgets/strategic_badge.dart new file mode 100644 index 00000000..934a7c01 --- /dev/null +++ b/lib/features/science_clubs_view/widgets/strategic_badge.dart @@ -0,0 +1,44 @@ +import "package:flutter/material.dart"; + +import "../../../theme/app_theme.dart"; + +class StrategicBadge extends WidgetSpan { + const StrategicBadge() + : super( + baseline: TextBaseline.ideographic, + alignment: PlaceholderAlignment.middle, + child: const SizedBox.square( + dimension: 16, + child: _StrategicBadgeWidget(), + ), + ); +} + +class _StrategicBadgeWidget extends StatelessWidget { + const _StrategicBadgeWidget(); + + @override + Widget build(BuildContext context) { + return Tooltip( + message: "Koło strategiczne PWr", + child: Stack( + children: [ + Center( + child: Icon( + Icons.shield, + size: 14, + color: context.colorTheme.blueAzure, + ), + ), + Align( + alignment: const Alignment(0, -1 / 4), + child: Text( + context.localize.strategic_club_abbr, + style: context.textTheme.bodyWhite.copyWith(fontSize: 6), + ), + ), + ], + ), + ); + } +} diff --git a/lib/features/science_clubs_view/widgets/verified_badge.dart b/lib/features/science_clubs_view/widgets/verified_badge.dart new file mode 100644 index 00000000..ceff0bf9 --- /dev/null +++ b/lib/features/science_clubs_view/widgets/verified_badge.dart @@ -0,0 +1,31 @@ +import "package:flutter/material.dart"; + +import "../../../theme/app_theme.dart"; + +class VerifiedBadge extends WidgetSpan { + const VerifiedBadge() + : super( + baseline: TextBaseline.ideographic, + alignment: PlaceholderAlignment.middle, + child: const _VerifiedBadgeWidget(), + ); +} + +class _VerifiedBadgeWidget extends StatelessWidget { + const _VerifiedBadgeWidget(); + + @override + Widget build(BuildContext context) { + return SizedBox.square( + dimension: 16, + child: Padding( + padding: const EdgeInsets.only(left: 4), + child: Icon( + Icons.verified_sharp, + size: 12, + color: context.colorTheme.orangePomegranade, + ), + ), + ); + } +} diff --git a/lib/l10n/app_pl.arb b/lib/l10n/app_pl.arb index 4e990b47..0fbabe14 100644 --- a/lib/l10n/app_pl.arb +++ b/lib/l10n/app_pl.arb @@ -241,11 +241,7 @@ "are_lowered_curbs" : "Krawężniki w okolicach budynku {value, select, false{nie} other{}} są obniżone. ", "are_no_barriers": "Wokół budynku {value, select, true{nie ma barier uniemożliwiających dojścia} false{znajdują się bariery uniemożliwiające dojście} other{}} do budynku. ", "is_path_to_accessible_entrance_marked" : "Ścieżka do wejścia dostępnego dla osób z niepełnosprawnościami {value, select, false{nie} other{}} jest wyraźnie oznaczona. ", - "is_noisy_street_near_building" : "W okolicy {value, select, false{nie ma ruchliwej, hałaśliwej ulicy. } true{znajduje się ruchliwa, hałaśliwa ulica. } other{}}" - - - - - - + "is_noisy_street_near_building" : "W okolicy {value, select, false{nie ma ruchliwej, hałaśliwej ulicy. } true{znajduje się ruchliwa, hałaśliwa ulica. } other{}}", + "strategicBadgeTooltip": "Koło Strategiczne PWr", + "strategic_club_abbr": "KS" } diff --git a/lib/widgets/big_preview_card.dart b/lib/widgets/big_preview_card.dart index 08eef82d..84344391 100644 --- a/lib/widgets/big_preview_card.dart +++ b/lib/widgets/big_preview_card.dart @@ -16,7 +16,8 @@ class BigPreviewCard extends StatelessWidget { this.date, required this.onClick, this.boxFit = BoxFit.scaleDown, - this.showBadge = false, + this.showVerifiedBadge = false, + this.showStrategicBadge = false, }); final String title; @@ -25,7 +26,8 @@ class BigPreviewCard extends StatelessWidget { final DateTime? date; final VoidCallback? onClick; final BoxFit boxFit; - final bool showBadge; + final bool showVerifiedBadge; + final bool showStrategicBadge; @override Widget build(BuildContext context) { @@ -80,7 +82,8 @@ class BigPreviewCard extends StatelessWidget { subtitleStyle: context.textTheme.body, spacing: 7, maxTotalLines: 8, - showBadge: showBadge, + showVerifiedBadge: showVerifiedBadge, + showStrategicBadge: showStrategicBadge, ), const Spacer(), MaterialButton( diff --git a/lib/widgets/dual_text_max_lines.dart b/lib/widgets/dual_text_max_lines.dart index 2d48f9e6..2641b2e7 100644 --- a/lib/widgets/dual_text_max_lines.dart +++ b/lib/widgets/dual_text_max_lines.dart @@ -1,6 +1,7 @@ import "package:flutter/material.dart"; -import "../theme/colors.dart"; +import "../features/science_clubs_view/widgets/strategic_badge.dart"; +import "../features/science_clubs_view/widgets/verified_badge.dart"; class DualTextSpan extends TextSpan { DualTextSpan( @@ -10,28 +11,15 @@ class DualTextSpan extends TextSpan { TextStyle? subtitleStyle, double spacing, { bool showBadge = false, + bool showStrategicBadge = false, }) : super( children: [ TextSpan( text: title, style: titleStyle, children: [ - if (showBadge) - const WidgetSpan( - baseline: TextBaseline.ideographic, - alignment: PlaceholderAlignment.middle, - child: SizedBox.square( - dimension: 16, - child: Padding( - padding: EdgeInsets.only(left: 4), - child: Icon( - Icons.verified_sharp, - size: 12, - color: ColorsConsts.orangePomegranade, - ), - ), - ), - ), + if (showBadge) const VerifiedBadge(), + if (showStrategicBadge) const StrategicBadge(), ], ), if (subtitle != null) @@ -56,7 +44,8 @@ class DualTextMaxLines extends StatelessWidget { this.titleStyle, this.subtitleStyle, this.spacing = 0, - this.showBadge = false, + this.showVerifiedBadge = false, + this.showStrategicBadge = false, super.key, }); @@ -66,8 +55,8 @@ class DualTextMaxLines extends StatelessWidget { final TextStyle? subtitleStyle; final double spacing; final int maxTotalLines; - final bool showBadge; - + final bool showVerifiedBadge; + final bool showStrategicBadge; @override Widget build(BuildContext context) { return RichText( @@ -79,7 +68,8 @@ class DualTextMaxLines extends StatelessWidget { subtitle, subtitleStyle, spacing, - showBadge: showBadge, + showBadge: showVerifiedBadge, + showStrategicBadge: showStrategicBadge, ), ); } diff --git a/lib/widgets/wide_tile_card.dart b/lib/widgets/wide_tile_card.dart index ca75587f..f6e45974 100644 --- a/lib/widgets/wide_tile_card.dart +++ b/lib/widgets/wide_tile_card.dart @@ -40,6 +40,7 @@ class WideTileCard extends StatelessWidget { this.crossAxisAlignment = CrossAxisAlignment.start, super.key, this.showBadge = false, + this.showStrategicBadge = false, }); final String title; @@ -55,6 +56,7 @@ class WideTileCard extends StatelessWidget { final LinearGradient? activeGradient; final CrossAxisAlignment crossAxisAlignment; final bool showBadge; + final bool showStrategicBadge; @override Widget build(BuildContext context) { return ClipRRect( @@ -78,6 +80,7 @@ class WideTileCard extends StatelessWidget { subtitle, secondSubtitle, showBadge: showBadge, + showStrategicBadge: showStrategicBadge, isActive: isActive, ), ), @@ -98,6 +101,7 @@ class _TitlesColumn extends StatelessWidget { this.secondSubtitle, { required this.isActive, this.showBadge = false, + this.showStrategicBadge = false, }); final String title; @@ -105,6 +109,7 @@ class _TitlesColumn extends StatelessWidget { final String? secondSubtitle; final bool isActive; final bool showBadge; + final bool showStrategicBadge; @override Widget build(BuildContext context) { return LayoutBuilder( @@ -132,7 +137,8 @@ class _TitlesColumn extends StatelessWidget { ? context.textTheme.bodyWhite : context.textTheme.bodyBlue, maxTotalLines: 4, - badge: showBadge, + showVerifiedBadge: showBadge, + showStrategicBadge: true, ), ); }, From 57a29d203e8b2ebbda9f9c77c34d5497ca1b667c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Kowali=C5=84ski?= Date: Tue, 7 Jan 2025 00:04:21 +0100 Subject: [PATCH 2/2] feat(science-clubs): connect `isStrategic` to directus --- lib/api_base/schema.graphql | 154 +++++++++--------- .../widgets/science_clubs_section.dart | 2 +- .../widgets/science_clubs_section.dart | 14 +- .../repository/getScienceClubDetails.graphql | 1 + .../science_club_detail_view.dart | 2 +- .../repository/getScienceClubs.graphql | 1 + .../widgets/science_club_card.dart | 2 +- .../widgets/strategic_badge.dart | 3 +- lib/widgets/wide_tile_card.dart | 2 +- 9 files changed, 92 insertions(+), 89 deletions(-) diff --git a/lib/api_base/schema.graphql b/lib/api_base/schema.graphql index d2b421de..40d109a1 100644 --- a/lib/api_base/schema.graphql +++ b/lib/api_base/schema.graphql @@ -15,10 +15,6 @@ type Query { Scientific_Circles_Links_by_id(id: ID!, version: String): Scientific_Circles_Links Scientific_Circles_Links_aggregated(groupBy: [String], filter: Scientific_Circles_Links_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [Scientific_Circles_Links_aggregated!]! Scientific_Circles_Links_by_version(version: String!, id: ID!): version_Scientific_Circles_Links - Scientific_Circles(filter: Scientific_Circles_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [Scientific_Circles!]! - Scientific_Circles_by_id(id: ID!, version: String): Scientific_Circles - Scientific_Circles_aggregated(groupBy: [String], filter: Scientific_Circles_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [Scientific_Circles_aggregated!]! - Scientific_Circles_by_version(version: String!, id: ID!): version_Scientific_Circles Posts(filter: Posts_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [Posts!]! Posts_by_id(id: ID!, version: String): Posts Posts_aggregated(groupBy: [String], filter: Posts_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [Posts_aggregated!]! @@ -85,6 +81,10 @@ type Query { Changelog_Screenshots_by_id(id: ID!, version: String): Changelog_Screenshots Changelog_Screenshots_aggregated(groupBy: [String], filter: Changelog_Screenshots_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [Changelog_Screenshots_aggregated!]! Changelog_Screenshots_by_version(version: String!, id: ID!): version_Changelog_Screenshots + Scientific_Circles(filter: Scientific_Circles_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [Scientific_Circles!]! + Scientific_Circles_by_id(id: ID!, version: String): Scientific_Circles + Scientific_Circles_aggregated(groupBy: [String], filter: Scientific_Circles_filter, limit: Int, offset: Int, page: Int, search: String, sort: [String]): [Scientific_Circles_aggregated!]! + Scientific_Circles_by_version(version: String!, id: ID!): version_Scientific_Circles } type Scientific_Circles_Tags { @@ -111,6 +111,7 @@ type Scientific_Circles { department(filter: Departments_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): Departments desc2: String useCoverAsPreviewPhoto: Boolean + isStrategic: Boolean! tags(filter: Scientific_Circles_Tags_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [Scientific_Circles_Tags] tags_func: count_functions links(filter: Scientific_Circles_Links_filter, sort: [String], limit: Int, offset: Int, page: Int, search: String): [Scientific_Circles_Links] @@ -397,6 +398,7 @@ input Scientific_Circles_filter { department: Departments_filter desc2: string_filter_operators useCoverAsPreviewPhoto: boolean_filter_operators + isStrategic: boolean_filter_operators tags: Scientific_Circles_Tags_filter tags_func: count_function_filter_operators links: Scientific_Circles_Links_filter @@ -610,70 +612,6 @@ type version_Scientific_Circles_Links { scientific_circle_id: JSON } -type Scientific_Circles_aggregated { - group: JSON - countAll: Int - count: Scientific_Circles_aggregated_count - countDistinct: Scientific_Circles_aggregated_count - avg: Scientific_Circles_aggregated_fields - sum: Scientific_Circles_aggregated_fields - avgDistinct: Scientific_Circles_aggregated_fields - sumDistinct: Scientific_Circles_aggregated_fields - min: Scientific_Circles_aggregated_fields - max: Scientific_Circles_aggregated_fields -} - -type Scientific_Circles_aggregated_count { - id: Int - status: Int - sort: Int - date_created: Int - date_updated: Int - name: Int - logo: Int - cover: Int - description: Int - type: Int - source: Int - shortDescription: Int - department: Int - desc2: Int - useCoverAsPreviewPhoto: Int - tags: Int - links: Int -} - -type Scientific_Circles_aggregated_fields { - id: Float - sort: Float - department: Float -} - -"""""" -type version_Scientific_Circles { - id: ID! - status: String - sort: Int - date_created: Date - date_created_func: datetime_functions - date_updated: Date - date_updated_func: datetime_functions - name: String! - logo: JSON - cover: JSON - description: String - type: String - source: String - shortDescription: String - department: JSON - desc2: String - useCoverAsPreviewPhoto: Boolean - tags: JSON - tags_func: count_functions - links: JSON - links_func: count_functions -} - type Posts_aggregated { group: JSON countAll: Int @@ -1610,13 +1548,78 @@ type version_Changelog_Screenshots { screenshot_preview: JSON } +type Scientific_Circles_aggregated { + group: JSON + countAll: Int + count: Scientific_Circles_aggregated_count + countDistinct: Scientific_Circles_aggregated_count + avg: Scientific_Circles_aggregated_fields + sum: Scientific_Circles_aggregated_fields + avgDistinct: Scientific_Circles_aggregated_fields + sumDistinct: Scientific_Circles_aggregated_fields + min: Scientific_Circles_aggregated_fields + max: Scientific_Circles_aggregated_fields +} + +type Scientific_Circles_aggregated_count { + id: Int + status: Int + sort: Int + date_created: Int + date_updated: Int + name: Int + logo: Int + cover: Int + description: Int + type: Int + source: Int + shortDescription: Int + department: Int + desc2: Int + useCoverAsPreviewPhoto: Int + isStrategic: Int + tags: Int + links: Int +} + +type Scientific_Circles_aggregated_fields { + id: Float + sort: Float + department: Float +} + +"""""" +type version_Scientific_Circles { + id: ID! + status: String + sort: Int + date_created: Date + date_created_func: datetime_functions + date_updated: Date + date_updated_func: datetime_functions + name: String! + logo: JSON + cover: JSON + description: String + type: String + source: String + shortDescription: String + department: JSON + desc2: String + useCoverAsPreviewPhoto: Boolean + isStrategic: Boolean! + tags: JSON + tags_func: count_functions + links: JSON + links_func: count_functions +} + type Subscription { directus_files_mutated(event: EventEnum): directus_files_mutated Scientific_Circles_Tags_mutated(event: EventEnum): Scientific_Circles_Tags_mutated Tags_mutated(event: EventEnum): Tags_mutated Posts_Tags_mutated(event: EventEnum): Posts_Tags_mutated Scientific_Circles_Links_mutated(event: EventEnum): Scientific_Circles_Links_mutated - Scientific_Circles_mutated(event: EventEnum): Scientific_Circles_mutated Posts_mutated(event: EventEnum): Posts_mutated AcademicCalendarData_mutated(event: EventEnum): AcademicCalendarData_mutated WeekExceptions_mutated(event: EventEnum): WeekExceptions_mutated @@ -1635,6 +1638,7 @@ type Subscription { Changelog_mutated(event: EventEnum): Changelog_mutated Changelog_Change_mutated(event: EventEnum): Changelog_Change_mutated Changelog_Screenshots_mutated(event: EventEnum): Changelog_Screenshots_mutated + Scientific_Circles_mutated(event: EventEnum): Scientific_Circles_mutated } type directus_files_mutated { @@ -1673,12 +1677,6 @@ type Scientific_Circles_Links_mutated { data: Scientific_Circles_Links } -type Scientific_Circles_mutated { - key: ID! - event: EventEnum - data: Scientific_Circles -} - type Posts_mutated { key: ID! event: EventEnum @@ -1785,4 +1783,10 @@ type Changelog_Screenshots_mutated { key: ID! event: EventEnum data: Changelog_Screenshots +} + +type Scientific_Circles_mutated { + key: ID! + event: EventEnum + data: Scientific_Circles } \ No newline at end of file diff --git a/lib/features/department_detail_view/widgets/science_clubs_section.dart b/lib/features/department_detail_view/widgets/science_clubs_section.dart index 1ffcc3a4..e8a6682e 100644 --- a/lib/features/department_detail_view/widgets/science_clubs_section.dart +++ b/lib/features/department_detail_view/widgets/science_clubs_section.dart @@ -83,7 +83,7 @@ class _ScienceClubsList extends ConsumerWidget { : sciClub.logo?.filename_disk, onClick: () async => ref.navigateSciClubsDetail(sciClub.id), showVerifiedBadge: sciClub.source == ScienceClubsViewConfig.source, - showStrategicBadge: true, + showStrategicBadge: sciClub.isStrategic, ), ); }, diff --git a/lib/features/home_view/widgets/science_clubs_section.dart b/lib/features/home_view/widgets/science_clubs_section.dart index 5fd84afe..033e4938 100644 --- a/lib/features/home_view/widgets/science_clubs_section.dart +++ b/lib/features/home_view/widgets/science_clubs_section.dart @@ -71,8 +71,7 @@ class _ScienceClubsDataList extends ConsumerWidget { itemCount: scienceClubs.length, itemBuilder: (BuildContext context, int index) { final sciClub = scienceClubs[index]; - final sciClubCard = _BuildScienceClubCard(sciClub: sciClub, ref: ref); - + final sciClubCard = _ScienceClubCard(sciClub: sciClub); if (index != scienceClubs.length - 1) { return MediumLeftPadding( child: sciClubCard, @@ -87,17 +86,13 @@ class _ScienceClubsDataList extends ConsumerWidget { } } -class _BuildScienceClubCard extends StatelessWidget { - const _BuildScienceClubCard({ - required this.sciClub, - required this.ref, - }); +class _ScienceClubCard extends ConsumerWidget { + const _ScienceClubCard({required this.sciClub}); final ScienceClub sciClub; - final WidgetRef ref; @override - Widget build(BuildContext context) { + Widget build(BuildContext context, WidgetRef ref) { return BigPreviewCard( title: sciClub.name, shortDescription: sciClub.shortDescription ?? "", @@ -106,6 +101,7 @@ class _BuildScienceClubCard extends StatelessWidget { : sciClub.logo?.filename_disk, showVerifiedBadge: sciClub.source == ScienceClubsViewConfig.source, onClick: () async => ref.navigateSciClubsDetail(sciClub.id), + showStrategicBadge: sciClub.isStrategic, ); } } diff --git a/lib/features/science_club_detail_view/repository/getScienceClubDetails.graphql b/lib/features/science_club_detail_view/repository/getScienceClubDetails.graphql index d3dae30a..86b7c802 100644 --- a/lib/features/science_club_detail_view/repository/getScienceClubDetails.graphql +++ b/lib/features/science_club_detail_view/repository/getScienceClubDetails.graphql @@ -16,5 +16,6 @@ query GetScienceClubDetails($id: ID!) { department { name } + isStrategic } } diff --git a/lib/features/science_club_detail_view/science_club_detail_view.dart b/lib/features/science_club_detail_view/science_club_detail_view.dart index 65ee8ef7..ba477912 100644 --- a/lib/features/science_club_detail_view/science_club_detail_view.dart +++ b/lib/features/science_club_detail_view/science_club_detail_view.dart @@ -72,7 +72,7 @@ class _SciClubDetailDataView extends ConsumerWidget { children: [ if (value.source == ScienceClubsViewConfig.source) const VerifiedBadge(), - const StrategicBadge(), + if (value.isStrategic) const StrategicBadge(), ], ), ), diff --git a/lib/features/science_clubs_view/repository/getScienceClubs.graphql b/lib/features/science_clubs_view/repository/getScienceClubs.graphql index 59f869f5..5eaeeae1 100644 --- a/lib/features/science_clubs_view/repository/getScienceClubs.graphql +++ b/lib/features/science_clubs_view/repository/getScienceClubs.graphql @@ -24,5 +24,6 @@ query GetScienceClubs { filename_disk } useCoverAsPreviewPhoto + isStrategic } } diff --git a/lib/features/science_clubs_view/widgets/science_club_card.dart b/lib/features/science_clubs_view/widgets/science_club_card.dart index d95c175b..cfbf786c 100644 --- a/lib/features/science_clubs_view/widgets/science_club_card.dart +++ b/lib/features/science_clubs_view/widgets/science_club_card.dart @@ -22,7 +22,7 @@ class ScienceClubCard extends StatelessWidget { .toList() .join(", "), showBadge: sciClub.source == ScienceClubsViewConfig.source, - showStrategicBadge: true, + showStrategicBadge: sciClub.isStrategic, activeShadows: null, trailing: Padding( padding: const EdgeInsets.only( diff --git a/lib/features/science_clubs_view/widgets/strategic_badge.dart b/lib/features/science_clubs_view/widgets/strategic_badge.dart index 934a7c01..b437cf5d 100644 --- a/lib/features/science_clubs_view/widgets/strategic_badge.dart +++ b/lib/features/science_clubs_view/widgets/strategic_badge.dart @@ -1,6 +1,7 @@ import "package:flutter/material.dart"; import "../../../theme/app_theme.dart"; +import "../../../utils/context_extensions.dart"; class StrategicBadge extends WidgetSpan { const StrategicBadge() @@ -20,7 +21,7 @@ class _StrategicBadgeWidget extends StatelessWidget { @override Widget build(BuildContext context) { return Tooltip( - message: "Koło strategiczne PWr", + message: context.localize.strategicBadgeTooltip, child: Stack( children: [ Center( diff --git a/lib/widgets/wide_tile_card.dart b/lib/widgets/wide_tile_card.dart index f6e45974..e9f8aeae 100644 --- a/lib/widgets/wide_tile_card.dart +++ b/lib/widgets/wide_tile_card.dart @@ -138,7 +138,7 @@ class _TitlesColumn extends StatelessWidget { : context.textTheme.bodyBlue, maxTotalLines: 4, showVerifiedBadge: showBadge, - showStrategicBadge: true, + showStrategicBadge: showStrategicBadge, ), ); },