diff --git a/lib/models/overview_data.dart b/lib/models/overview_data.dart index 8fb0b7a..118c074 100644 --- a/lib/models/overview_data.dart +++ b/lib/models/overview_data.dart @@ -56,6 +56,9 @@ class OverviewData { case 'saha': typeInteger = 6; break; + case 'infography': + typeInteger = 7; + break; default: typeInteger = 5; } diff --git a/lib/views/widgets/overview/multitype.dart b/lib/views/widgets/overview/multitype.dart index f27ab2b..3f319fc 100644 --- a/lib/views/widgets/overview/multitype.dart +++ b/lib/views/widgets/overview/multitype.dart @@ -10,6 +10,7 @@ import 'package:didvan/services/media/media.dart'; import 'package:didvan/services/network/request.dart'; import 'package:didvan/utils/date_time.dart'; import 'package:didvan/views/podcasts/studio_details/studio_details_state.dart'; +import 'package:didvan/views/widgets/bookmark_button.dart'; import 'package:didvan/views/widgets/didvan/card.dart'; import 'package:didvan/views/widgets/didvan/text.dart'; import 'package:didvan/views/widgets/didvan/text_field.dart'; @@ -61,22 +62,22 @@ class MultitypeOverview extends StatelessWidget { } IconData get _icon { - if (item.type == 'radar') { - return DidvanIcons.scanning_light; + switch (item.type) { + case 'radar': + return DidvanIcons.scanning_light; + case 'news': + return DidvanIcons.foolad_light; + case 'video': + return DidvanIcons.video_light; + case 'podcast': + return DidvanIcons.podcast_light; + case 'delphi': + return DidvanIcons.saha_light; + case 'infography': + return DidvanIcons.info_circle_light; + default: + return DidvanIcons.radar_light; } - if (item.type == 'news') { - return DidvanIcons.foolad_light; - } - if (item.type == 'video') { - return DidvanIcons.video_light; - } - if (item.type == 'podcast') { - return DidvanIcons.podcast_light; - } - if (item.type == 'delphi') { - return DidvanIcons.saha_light; - } - return DidvanIcons.radar_light; } @override @@ -191,56 +192,75 @@ class MultitypeOverview extends StatelessWidget { ), ], ), - if (enableCaption) - Column( - children: [ - const SizedBox(height: 8), - Row( - children: [ - Icon( - Icons.edit_outlined, - size: 16, - color: Theme.of(context).colorScheme.caption, - ), - const SizedBox(width: 4), - DidvanText( - 'یادداشت‌های من', - style: Theme.of(context).textTheme.labelSmall, - color: Theme.of(context).colorScheme.caption, - ), - ], - ), - Row( - children: [ - Flexible( - child: Container( - height: 1, - color: Theme.of(context).colorScheme.primary, + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + if (enableCaption) + Expanded( + child: Column( + children: [ + const SizedBox(height: 8), + Row( + children: [ + Icon( + Icons.edit_outlined, + size: 16, + color: Theme.of(context).colorScheme.caption, + ), + const SizedBox(width: 4), + DidvanText( + 'یادداشت‌های من', + style: Theme.of(context).textTheme.labelSmall, + color: Theme.of(context).colorScheme.caption, + ), + ], ), - ), - Flexible( - flex: 2, - child: Container( - height: 1, - color: Theme.of(context).colorScheme.border, + Row( + children: [ + Flexible( + child: Container( + height: 1, + color: Theme.of(context).colorScheme.primary, + ), + ), + Flexible( + flex: 2, + child: Container( + height: 1, + color: Theme.of(context).colorScheme.border, + ), + ) + ], ), - ) - ], - ), - DidvanTextField( - disableBorders: true, - initialValue: item.description, - hintText: 'برای اضافه کردن یادداشت لمس کنید.', - onChanged: (value) => UserProvider.changeItemMark( - item.type, - item.id, - null, - description: value, + DidvanTextField( + disableBorders: true, + initialValue: item.description, + hintText: 'برای اضافه کردن یادداشت لمس کنید.', + onChanged: (value) => UserProvider.changeItemMark( + item.type, + item.id, + null, + description: value, + ), + isSmall: true, + ), + ], ), - isSmall: true, ), - ], - ), + if (!enableCaption) const Spacer(), + const SizedBox( + width: 12, + ), + BookmarkButton( + value: item.marked, + onMarkChanged: (value) => onMarkChanged(item.id, value), + gestureSize: 32, + type: item.type, + itemId: item.id, + askForConfirmation: true, + ), + ], + ), ], ), );