diff --git a/lib/routes/route_generator.dart b/lib/routes/route_generator.dart index b328d00..617a4dd 100644 --- a/lib/routes/route_generator.dart +++ b/lib/routes/route_generator.dart @@ -496,7 +496,6 @@ class RouteGenerator { textScaler: const TextScaler.linear(1.0), ), child: Container( - // ignore: deprecated_member_use color: Theme.of(context).colorScheme.background, alignment: Alignment.center, child: AspectRatio(aspectRatio: 9 / 16, child: page), diff --git a/lib/views/home/main/widgets/swot_item_card.dart b/lib/views/home/main/widgets/swot_item_card.dart index 1ad2b51..977aa3a 100644 --- a/lib/views/home/main/widgets/swot_item_card.dart +++ b/lib/views/home/main/widgets/swot_item_card.dart @@ -1,3 +1,5 @@ +// lib/views/home/main/widgets/swot_item_card.dart + import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image_platform_interface/cached_network_image_platform_interface.dart'; import 'package:didvan/config/theme_data.dart'; @@ -52,7 +54,7 @@ class _SwotItemCardState extends State { }, child: Container( height: 500 , - width: 250, + width: kIsWeb ? 350 : 250, margin: const EdgeInsets.only(right: 0), padding: const EdgeInsets.all(0), decoration: BoxDecoration( @@ -76,7 +78,7 @@ class _SwotItemCardState extends State { } return Container( height: 150, - width: 300, + width: kIsWeb ? 350 : 300, decoration: BoxDecoration( color: Theme.of(context).colorScheme.disabledBackground, @@ -90,11 +92,11 @@ class _SwotItemCardState extends State { httpHeaders: { 'Authorization': 'Bearer ${RequestService.token}' }, - width: 300, + width: kIsWeb ? 350 : 300, height: 150, imageUrl: widget.item.imageUrl, - placeholder: (context, _) => const ShimmerPlaceholder( - width: 300, + placeholder: (context, _) => ShimmerPlaceholder( + width: kIsWeb ? 350 : 300, height: 150, ), ), diff --git a/lib/views/story_viewer/story_viewer_page.dart b/lib/views/story_viewer/story_viewer_page.dart index e02d221..33bd89e 100644 --- a/lib/views/story_viewer/story_viewer_page.dart +++ b/lib/views/story_viewer/story_viewer_page.dart @@ -1,4 +1,4 @@ -// ignore_for_file: avoid_print +// lib/views/story_viewer/story_viewer_page.dart import 'package:cached_network_image/cached_network_image.dart'; import 'package:didvan/models/story_model.dart'; @@ -86,14 +86,13 @@ class _UserStoryViewerState extends State late AnimationController _animationController; VideoPlayerController? _videoController; int _currentStoryIndex = 0; - bool _isLongPressing = false; @override void initState() { super.initState(); _animationController = AnimationController(vsync: this); - final allStoriesInGroupViewed = + final allStoriesInGroupViewed = widget.userStories.stories.every((story) => story.isViewed.value); if (allStoriesInGroupViewed) { @@ -155,6 +154,7 @@ class _UserStoryViewerState extends State _videoController!.play(); _animationController.forward(); } else { + // ignore: avoid_print print( "Video failed to initialize or has zero duration. Skipping."); _nextStory(); @@ -162,6 +162,7 @@ class _UserStoryViewerState extends State }); } }).catchError((error) { + // ignore: avoid_print print("Error loading video: $error. Skipping."); if (mounted) { _nextStory(); @@ -202,44 +203,37 @@ class _UserStoryViewerState extends State _videoController?.play(); } - void _handleTap(TapUpDetails details) { - if (_isLongPressing) { - _isLongPressing = false; - _resumeStory(); - return; - } - final double screenWidth = MediaQuery.of(context).size.width; - final double dx = details.globalPosition.dx; - - if (dx > screenWidth / 2) { - _nextStory(); - } else { - _previousStory(); - } - } - @override Widget build(BuildContext context) { final story = widget.userStories.stories[_currentStoryIndex]; return Scaffold( backgroundColor: Colors.black, - body: GestureDetector( - onTapUp: _handleTap, - onLongPressStart: (_) { - _isLongPressing = true; - _pauseStory(); - }, - onLongPressEnd: (_) { - _isLongPressing = false; - _resumeStory(); - }, - child: Stack( - fit: StackFit.expand, - children: [ - _buildMediaViewer(story), - _buildStoryHeader(), - ], - ), + body: Stack( + fit: StackFit.expand, + children: [ + _buildMediaViewer(story), + Row( + children: [ + Expanded( + child: GestureDetector( + onTap: _previousStory, + onLongPress: _pauseStory, + onLongPressUp: _resumeStory, + child: Container(color: Colors.transparent), + ), + ), + Expanded( + child: GestureDetector( + onTap: _nextStory, + onLongPress: _pauseStory, + onLongPressUp: _resumeStory, + child: Container(color: Colors.transparent), + ), + ), + ], + ), + _buildStoryHeader(), + ], ), ); } @@ -405,13 +399,6 @@ class _UserInfo extends StatelessWidget { fontWeight: FontWeight.w600, ), ), - // DidvanText( - // DateTimeUtils.momentGenerator(user.createdAt), - // style: const TextStyle( - // color: Colors.white70, - // fontSize: 14.0, - // ), - // ), ], ), ), @@ -422,4 +409,4 @@ class _UserInfo extends StatelessWidget { ], ); } -} +} \ No newline at end of file diff --git a/lib/views/widgets/didvan/text_field.dart b/lib/views/widgets/didvan/text_field.dart index f3ffb1e..33f739e 100644 --- a/lib/views/widgets/didvan/text_field.dart +++ b/lib/views/widgets/didvan/text_field.dart @@ -108,7 +108,7 @@ class _DidvanTextFieldState extends State { ? TextDirection.ltr : TextDirection.rtl, child: Padding( - padding: const EdgeInsets.fromLTRB(8,8,0,8), + padding: const EdgeInsets.fromLTRB(8,8,0,15), child: TextFormField( inputFormatters: [ if (!widget.acceptSpace) diff --git a/lib/views/widgets/skeleton_image.dart b/lib/views/widgets/skeleton_image.dart index ef8c323..2dff810 100644 --- a/lib/views/widgets/skeleton_image.dart +++ b/lib/views/widgets/skeleton_image.dart @@ -44,7 +44,7 @@ class SkeletonImage extends StatelessWidget { child: const Icon(Icons.image_not_supported_outlined)); }, errorListener: (value) {}, - fit: BoxFit.cover, + fit: kIsWeb? BoxFit.fill:BoxFit.cover, imageRenderMethodForWeb: ImageRenderMethodForWeb.HttpGet, httpHeaders: {'Authorization': 'Bearer ${RequestService.token}'}, width: width,