Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect use of ParentDataWidget. #485

Closed
AbhinaiVatsal opened this issue Jun 2, 2021 · 4 comments
Closed

Incorrect use of ParentDataWidget. #485

AbhinaiVatsal opened this issue Jun 2, 2021 · 4 comments

Comments

@AbhinaiVatsal
Copy link

Getting this error while using Chewie.

I/flutter ( 7546): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter ( 7546): The following assertion was thrown while applying parent data.:
I/flutter ( 7546): Incorrect use of ParentDataWidget.
I/flutter ( 7546): The ParentDataWidget Expanded(flex: 1) wants to apply ParentData of type FlexParentData to a
I/flutter ( 7546): RenderObject, which has been set up to accept ParentData of incompatible type StackParentData.
I/flutter ( 7546): Usually, this means that the Expanded widget has the wrong ancestor RenderObjectWidget. Typically,
I/flutter ( 7546): Expanded widgets are placed directly inside Flex widgets.
I/flutter ( 7546): The offending Expanded is currently placed inside a Stack widget.
I/flutter ( 7546): The ownership chain for the RenderObject that received the incompatible parent data was:
I/flutter ( 7546): Center ← Expanded ← Stack ← AbsorbPointer ← Listener ← _GestureSemantics ← RawGestureDetector ←
I/flutter ( 7546): GestureDetector ← _RawMouseRegion ← MouseRegion ← ⋯

CODE :

class VideoPlayerWidget extends StatefulWidget {
const VideoPlayerWidget({this.url});

final String url;

@OverRide
_VideoPlayerWidgetState createState() => _VideoPlayerWidgetState();
}

class _VideoPlayerWidgetState extends State {
ChewieController _chewieController;
VideoPlayerController _controller;
@OverRide
void initState() {
final Uri uri =
signMyObject(objectKey: widget.url, bucketName: BUCKET_NAME);
_controller = VideoPlayerController.network(uri.toString());
_chewieController = ChewieController(
videoPlayerController: _controller,
aspectRatio: ASPECT_RATIO,
autoInitialize: true,
autoPlay: true,
deviceOrientationsAfterFullScreen: [DeviceOrientation.portraitUp],
materialProgressColors: ChewieProgressColors(
playedColor: Colors.purple,
handleColor: Colors.purple,
backgroundColor: Colors.grey,
bufferedColor: Colors.purple[100],
),
placeholder: Container(
color: Colors.grey,
),
);
super.initState();
}

@OverRide
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: SafeArea(
child: Center(
child: Chewie(
controller: _chewieController,
),
),
),
),
);
}

@OverRide
void dispose() {
_controller.dispose();
_chewieController.dispose();
super.dispose();
}
}

@AntonIatsenko
Copy link

Same for me

@yuxiang-projz
Copy link

+1

@Ahmadre
Copy link
Collaborator

Ahmadre commented Jun 8, 2021

It's fixed guys. An Expanded was inside a Stack.

Fix will come soon with a new version 👍🏼

@Ahmadre
Copy link
Collaborator

Ahmadre commented Jun 10, 2021

Fixed in v. 1.2.2

Please update your chewie :)

@Ahmadre Ahmadre closed this as completed Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants