story icon fixed

This commit is contained in:
mohamadmahdi jebeli 2025-06-24 15:53:30 +03:30
parent 5bdb516275
commit 399374530e
9 changed files with 94 additions and 51 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -97,9 +97,9 @@ class UserStories {
String _mapCategoryToIcon(String category) { String _mapCategoryToIcon(String category) {
switch (category) { switch (category) {
case 'MACRO_TRENDS': case 'MACRO_TRENDS':
return 'lib/assets/icons/MACRO_TRENDS.svg'; return 'lib/assets/icons/MACRO_TRENDS_N.png';
case 'INDUSTRY_ENVIRONMENT': case 'INDUSTRY_ENVIRONMENT':
return 'lib/assets/icons/INDUSTRY_ENVIRONMENT.svg'; return 'lib/assets/icons/INDUSTRY_ENVIRONMENT_N.png';
case 'COMPETITION_ENVIRONMENT': case 'COMPETITION_ENVIRONMENT':
return Assets.startup; return Assets.startup;
case 'OPPORTUNITIES': case 'OPPORTUNITIES':
@ -111,11 +111,11 @@ String _mapCategoryToIcon(String category) {
case 'STARTUPS': case 'STARTUPS':
return Assets.startup; return Assets.startup;
case 'CONCEPTS': case 'CONCEPTS':
return 'lib/assets/icons/CONCEPTS.svg'; return 'lib/assets/icons/CONCEPTS_N.png';
case 'MACRO_ENVIRONMENT': case 'MACRO_ENVIRONMENT':
return 'lib/assets/icons/MACRO_ENVIRONMENT.svg'; return 'lib/assets/icons/MACRO_ENVIRONMENT_N.png';
case 'MODERN_INVESTMENTS': case 'MODERN_INVESTMENTS':
return 'lib/assets/icons/MODERN_INVESTMENTS.svg'; return 'lib/assets/icons/MODERN_INVESTMENTS_N.png';
default: default:
return Assets.stats; return Assets.stats;
} }

View File

@ -53,7 +53,23 @@ class AiSectionBNB extends StatelessWidget {
title: 'عکس ساز', title: 'عکس ساز',
selectedIcon: cameraSolid, selectedIcon: cameraSolid,
unselectedIcon: cameraRegular, unselectedIcon: cameraRegular,
onTap: () => onTabChanged(0), onTap: () {
final aiState = context.read<AiState>();
if (aiState.tools != null && aiState.tools!.isNotEmpty) {
final Tools imageGenTool = aiState.tools![0]; // ابزار عکس ساز
if (imageGenTool.bots != null && imageGenTool.bots!.isNotEmpty) {
final bot = imageGenTool.bots!.first;
Navigator.of(context).pushNamed(
Routes.aiChat,
arguments: AiChatArgs(bot: bot, isTool: imageGenTool.bots),
);
}
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('ابزار عکس ساز در حال بارگذاری است...')),
);
}
},
), ),
_AiNavBarItem( _AiNavBarItem(
isSelected: currentTabIndex == 1, isSelected: currentTabIndex == 1,
@ -77,7 +93,25 @@ class AiSectionBNB extends StatelessWidget {
title: 'جست و جو', title: 'جست و جو',
selectedIcon: searchSolid, selectedIcon: searchSolid,
unselectedIcon: searchRegular, unselectedIcon: searchRegular,
onTap: () => onTabChanged(3), onTap: () {
final aiState = context.read<AiState>();
// نکته: طبق کد شما، تب جستجو (اندیس ۳) ویجت تحلیل نمودار را نمایش میدهد
// که از ابزار اندیس ۱ استفاده میکند.
if (aiState.tools != null && aiState.tools!.length > 1) {
final Tools chartAnalysisTool = aiState.tools![1];
if (chartAnalysisTool.bots != null && chartAnalysisTool.bots!.isNotEmpty) {
final bot = chartAnalysisTool.bots!.first;
Navigator.of(context).pushNamed(
Routes.aiChat,
arguments: AiChatArgs(bot: bot, isTool: chartAnalysisTool.bots),
);
}
} else {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('ابزار جستجو در حال بارگذاری است...')),
);
}
},
), ),
_AiNavBarItem( _AiNavBarItem(
isSelected: currentTabIndex == 4, isSelected: currentTabIndex == 4,

View File

@ -1,4 +1,3 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:didvan/models/story_model.dart'; import 'package:didvan/models/story_model.dart';
import 'package:didvan/routes/routes.dart'; import 'package:didvan/routes/routes.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -41,8 +40,6 @@ class StorySection extends StatelessWidget {
} }
} }
// lib/views/home/main/widgets/story_section.dart
class _StoryCircle extends StatelessWidget { class _StoryCircle extends StatelessWidget {
final UserStories userStories; final UserStories userStories;
final VoidCallback onTap; final VoidCallback onTap;
@ -76,10 +73,16 @@ class _StoryCircle extends StatelessWidget {
shape: BoxShape.circle, shape: BoxShape.circle,
gradient: isViewed gradient: isViewed
? const LinearGradient( ? const LinearGradient(
colors: [Color.fromARGB(255, 184, 184, 184),Color.fromARGB(255, 184, 184, 184)], colors: [
Color.fromARGB(255, 184, 184, 184),
Color.fromARGB(255, 184, 184, 184)
],
) )
: const LinearGradient( : const LinearGradient(
colors: [ Color.fromARGB(255, 27, 60, 79), Color.fromARGB(255, 27, 60, 79)], colors: [
Color.fromARGB(255, 27, 60, 79),
Color.fromARGB(255, 27, 60, 79)
],
begin: Alignment.topRight, begin: Alignment.topRight,
end: Alignment.bottomLeft, end: Alignment.bottomLeft,
), ),
@ -94,14 +97,19 @@ class _StoryCircle extends StatelessWidget {
child: Padding( child: Padding(
padding: const EdgeInsets.all(4.0), padding: const EdgeInsets.all(4.0),
child: CircleAvatar( child: CircleAvatar(
backgroundColor: const Color.fromARGB(255, 230, 242, 246), backgroundColor:
const Color.fromARGB(255, 230, 242, 246),
child: ClipOval( child: ClipOval(
child: SvgPicture.asset( child: Image.asset(
"lib/assets/icons/MACRO_TRENDS.svg", userStories.user
.profileImageUrl,
fit: BoxFit.cover, fit: BoxFit.cover,
width: 50.0, width: 50.0,
height: 50.0, height: 50.0,
placeholderBuilder: (context) => const CircularProgressIndicator(strokeWidth: 2.0), errorBuilder: (context, error, stackTrace) {
return const Icon(Icons.person,
color: Colors.grey, size: 40.0);
},
), ),
), ),
), ),

View File

@ -128,29 +128,29 @@ class _UserStoryViewerState extends State<UserStoryViewer>
break; break;
case MediaType.video: case MediaType.video:
_videoController = _videoController =
VideoPlayerController.networkUrl(Uri.parse(story.url)) VideoPlayerController.networkUrl(Uri.parse(story.url));
..initialize().then((_) { _videoController!.initialize().then((_) {
if (mounted) { if (mounted) {
setState(() { setState(() {
if (_videoController!.value.isInitialized) { if (_videoController!.value.isInitialized &&
// Check for a valid duration _videoController!.value.duration > Duration.zero) {
if (_videoController!.value.duration > Duration.zero) { _animationController.duration =
_animationController.duration = _videoController!.value.duration;
_videoController!.value.duration; _videoController!.play();
} else { // _animationController.forward();
// Fallback to default duration if video duration is invalid } else {
_animationController.duration = story.duration; print(
} "Video failed to initialize or has zero duration. Skipping.");
_videoController!.play(); _nextStory();
_animationController.forward(); }
} else { });
// Fallback for failed initialization }
_animationController.duration = story.duration; }).catchError((error) {
_animationController.forward(); print("Error loading video: $error. Skipping.");
} if (mounted) {
}); _nextStory();
} }
}); });
break; break;
} }
setState(() {}); setState(() {});
@ -360,15 +360,16 @@ class _UserInfo extends StatelessWidget {
backgroundColor: Colors.grey[300], backgroundColor: Colors.grey[300],
child: ClipOval( child: ClipOval(
child: Padding( child: Padding(
padding: const EdgeInsets.all(5.0), padding: const EdgeInsets.all(0.0),
child: SvgPicture.asset( child: Image.asset(
user.profileImageUrl, user.profileImageUrl,
width: 40.0, width: 40.0,
height: 40.0, height: 40.0,
fit: BoxFit.cover, fit: BoxFit.cover,
placeholderBuilder: (context) => const CircularProgressIndicator( errorBuilder: (context, error, stackTrace) {
strokeWidth: 2.0, return const Icon(Icons.person,
), color: Colors.grey, size: 40.0);
},
), ),
), ),
), ),