story icon fixed
This commit is contained in:
parent
5bdb516275
commit
399374530e
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 |
|
|
@ -97,9 +97,9 @@ class UserStories {
|
|||
String _mapCategoryToIcon(String category) {
|
||||
switch (category) {
|
||||
case 'MACRO_TRENDS':
|
||||
return 'lib/assets/icons/MACRO_TRENDS.svg';
|
||||
return 'lib/assets/icons/MACRO_TRENDS_N.png';
|
||||
case 'INDUSTRY_ENVIRONMENT':
|
||||
return 'lib/assets/icons/INDUSTRY_ENVIRONMENT.svg';
|
||||
return 'lib/assets/icons/INDUSTRY_ENVIRONMENT_N.png';
|
||||
case 'COMPETITION_ENVIRONMENT':
|
||||
return Assets.startup;
|
||||
case 'OPPORTUNITIES':
|
||||
|
|
@ -111,11 +111,11 @@ String _mapCategoryToIcon(String category) {
|
|||
case 'STARTUPS':
|
||||
return Assets.startup;
|
||||
case 'CONCEPTS':
|
||||
return 'lib/assets/icons/CONCEPTS.svg';
|
||||
return 'lib/assets/icons/CONCEPTS_N.png';
|
||||
case 'MACRO_ENVIRONMENT':
|
||||
return 'lib/assets/icons/MACRO_ENVIRONMENT.svg';
|
||||
return 'lib/assets/icons/MACRO_ENVIRONMENT_N.png';
|
||||
case 'MODERN_INVESTMENTS':
|
||||
return 'lib/assets/icons/MODERN_INVESTMENTS.svg';
|
||||
return 'lib/assets/icons/MODERN_INVESTMENTS_N.png';
|
||||
default:
|
||||
return Assets.stats;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,23 @@ class AiSectionBNB extends StatelessWidget {
|
|||
title: 'عکس ساز',
|
||||
selectedIcon: cameraSolid,
|
||||
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(
|
||||
isSelected: currentTabIndex == 1,
|
||||
|
|
@ -77,7 +93,25 @@ class AiSectionBNB extends StatelessWidget {
|
|||
title: 'جست و جو',
|
||||
selectedIcon: searchSolid,
|
||||
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(
|
||||
isSelected: currentTabIndex == 4,
|
||||
|
|
@ -173,4 +207,4 @@ class _AiNavBarItem extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:didvan/models/story_model.dart';
|
||||
import 'package:didvan/routes/routes.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 {
|
||||
final UserStories userStories;
|
||||
final VoidCallback onTap;
|
||||
|
|
@ -76,32 +73,43 @@ class _StoryCircle extends StatelessWidget {
|
|||
shape: BoxShape.circle,
|
||||
gradient: isViewed
|
||||
? 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(
|
||||
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,
|
||||
end: Alignment.bottomLeft,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.white,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: CircleAvatar(
|
||||
backgroundColor: const Color.fromARGB(255, 230, 242, 246),
|
||||
backgroundColor:
|
||||
const Color.fromARGB(255, 230, 242, 246),
|
||||
child: ClipOval(
|
||||
child: SvgPicture.asset(
|
||||
"lib/assets/icons/MACRO_TRENDS.svg",
|
||||
child: Image.asset(
|
||||
userStories.user
|
||||
.profileImageUrl,
|
||||
fit: BoxFit.cover,
|
||||
width: 50.0,
|
||||
height: 50.0,
|
||||
placeholderBuilder: (context) => const CircularProgressIndicator(strokeWidth: 2.0),
|
||||
width: 50.0,
|
||||
height: 50.0,
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return const Icon(Icons.person,
|
||||
color: Colors.grey, size: 40.0);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
@ -121,4 +129,4 @@ class _StoryCircle extends StatelessWidget {
|
|||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,29 +128,29 @@ class _UserStoryViewerState extends State<UserStoryViewer>
|
|||
break;
|
||||
case MediaType.video:
|
||||
_videoController =
|
||||
VideoPlayerController.networkUrl(Uri.parse(story.url))
|
||||
..initialize().then((_) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
if (_videoController!.value.isInitialized) {
|
||||
// Check for a valid duration
|
||||
if (_videoController!.value.duration > Duration.zero) {
|
||||
_animationController.duration =
|
||||
_videoController!.value.duration;
|
||||
} else {
|
||||
// Fallback to default duration if video duration is invalid
|
||||
_animationController.duration = story.duration;
|
||||
}
|
||||
_videoController!.play();
|
||||
_animationController.forward();
|
||||
} else {
|
||||
// Fallback for failed initialization
|
||||
_animationController.duration = story.duration;
|
||||
_animationController.forward();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
VideoPlayerController.networkUrl(Uri.parse(story.url));
|
||||
_videoController!.initialize().then((_) {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
if (_videoController!.value.isInitialized &&
|
||||
_videoController!.value.duration > Duration.zero) {
|
||||
_animationController.duration =
|
||||
_videoController!.value.duration;
|
||||
_videoController!.play();
|
||||
// _animationController.forward();
|
||||
} else {
|
||||
print(
|
||||
"Video failed to initialize or has zero duration. Skipping.");
|
||||
_nextStory();
|
||||
}
|
||||
});
|
||||
}
|
||||
}).catchError((error) {
|
||||
print("Error loading video: $error. Skipping.");
|
||||
if (mounted) {
|
||||
_nextStory();
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
setState(() {});
|
||||
|
|
@ -360,15 +360,16 @@ class _UserInfo extends StatelessWidget {
|
|||
backgroundColor: Colors.grey[300],
|
||||
child: ClipOval(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(5.0),
|
||||
child: SvgPicture.asset(
|
||||
padding: const EdgeInsets.all(0.0),
|
||||
child: Image.asset(
|
||||
user.profileImageUrl,
|
||||
width: 40.0,
|
||||
height: 40.0,
|
||||
fit: BoxFit.cover,
|
||||
placeholderBuilder: (context) => const CircularProgressIndicator(
|
||||
strokeWidth: 2.0,
|
||||
),
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
return const Icon(Icons.person,
|
||||
color: Colors.grey, size: 40.0);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
@ -403,4 +404,4 @@ class _UserInfo extends StatelessWidget {
|
|||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue