"Add infography type and bookmark button in MultitypeOverview"

This commit adds a new type 'infography' in the OverviewData class and assigns it an integer value of 7. It also includes a bookmark button in the MultitypeOverview widget for the new type and all other types. The bookmark button is imported from the bookmark\_button.dart file. The commit also moves the caption section to a separate row and adjusts the flex properties of the containers.
This commit is contained in:
MohammadTaha Basiri 2024-04-01 16:43:57 +03:30
parent e606555234
commit 0173a5240c
2 changed files with 84 additions and 61 deletions

View File

@ -56,6 +56,9 @@ class OverviewData {
case 'saha': case 'saha':
typeInteger = 6; typeInteger = 6;
break; break;
case 'infography':
typeInteger = 7;
break;
default: default:
typeInteger = 5; typeInteger = 5;
} }

View File

@ -10,6 +10,7 @@ import 'package:didvan/services/media/media.dart';
import 'package:didvan/services/network/request.dart'; import 'package:didvan/services/network/request.dart';
import 'package:didvan/utils/date_time.dart'; import 'package:didvan/utils/date_time.dart';
import 'package:didvan/views/podcasts/studio_details/studio_details_state.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/card.dart';
import 'package:didvan/views/widgets/didvan/text.dart'; import 'package:didvan/views/widgets/didvan/text.dart';
import 'package:didvan/views/widgets/didvan/text_field.dart'; import 'package:didvan/views/widgets/didvan/text_field.dart';
@ -61,22 +62,22 @@ class MultitypeOverview extends StatelessWidget {
} }
IconData get _icon { IconData get _icon {
if (item.type == 'radar') { switch (item.type) {
return DidvanIcons.scanning_light; 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 @override
@ -191,56 +192,75 @@ class MultitypeOverview extends StatelessWidget {
), ),
], ],
), ),
if (enableCaption) Row(
Column( crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
const SizedBox(height: 8), if (enableCaption)
Row( Expanded(
children: [ child: Column(
Icon( children: [
Icons.edit_outlined, const SizedBox(height: 8),
size: 16, Row(
color: Theme.of(context).colorScheme.caption, children: [
), Icon(
const SizedBox(width: 4), Icons.edit_outlined,
DidvanText( size: 16,
'یادداشت‌های من', color: Theme.of(context).colorScheme.caption,
style: Theme.of(context).textTheme.labelSmall, ),
color: Theme.of(context).colorScheme.caption, const SizedBox(width: 4),
), DidvanText(
], 'یادداشت‌های من',
), style: Theme.of(context).textTheme.labelSmall,
Row( color: Theme.of(context).colorScheme.caption,
children: [ ),
Flexible( ],
child: Container(
height: 1,
color: Theme.of(context).colorScheme.primary,
), ),
), Row(
Flexible( children: [
flex: 2, Flexible(
child: Container( child: Container(
height: 1, height: 1,
color: Theme.of(context).colorScheme.border, 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,
DidvanTextField( hintText: 'برای اضافه کردن یادداشت لمس کنید.',
disableBorders: true, onChanged: (value) => UserProvider.changeItemMark(
initialValue: item.description, item.type,
hintText: 'برای اضافه کردن یادداشت لمس کنید.', item.id,
onChanged: (value) => UserProvider.changeItemMark( null,
item.type, description: value,
item.id, ),
null, isSmall: true,
description: value, ),
],
), ),
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,
),
],
),
], ],
), ),
); );