Skip to content

Incorrect use of ParentDataWidget. #485

@AbhinaiVatsal

Description

@AbhinaiVatsal

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();
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions