fixed web
This commit is contained in:
parent
5f02802ad1
commit
3827209ade
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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<SwotItemCard> {
|
|||
},
|
||||
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<SwotItemCard> {
|
|||
}
|
||||
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<SwotItemCard> {
|
|||
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,
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -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<UserStoryViewer>
|
|||
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<UserStoryViewer>
|
|||
_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<UserStoryViewer>
|
|||
});
|
||||
}
|
||||
}).catchError((error) {
|
||||
// ignore: avoid_print
|
||||
print("Error loading video: $error. Skipping.");
|
||||
if (mounted) {
|
||||
_nextStory();
|
||||
|
|
@ -202,44 +203,37 @@ class _UserStoryViewerState extends State<UserStoryViewer>
|
|||
_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 {
|
|||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -108,7 +108,7 @@ class _DidvanTextFieldState extends State<DidvanTextField> {
|
|||
? 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: <TextInputFormatter>[
|
||||
if (!widget.acceptSpace)
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue