builder method
Implementation
Widget builder(BuildContext context, BoxConstraints constraints)
{
// Set Build Constraints in the [WidgetModel]
onLayout(constraints);
// Check if widget is visible before wasting resources on building it
if (!widget.model.visible) return Offstage();
// create the view
Widget view = (_controller != null && _controller!.value.isInitialized) ? AspectRatio(aspectRatio: _controller!.value.aspectRatio, child: VideoPlayer(_controller!)) : Container();
//if (_controller.value.isInitialized) _controller.play();
// get the children
List<Widget> children = widget.model.inflate();
// show controls
if (widget.model.controls != false)
{
// shutter
shutterbutton ??= IconView(shutterbuttonmodel);
var shutter = UnconstrainedBox(
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: GestureDetector(
onTap: startstop,
child: Stack(alignment: Alignment.center, children: [
Icon(Icons.circle, color: Colors.white38, size: 80),
shutterbutton!
]))));
children.add(Positioned(bottom: 25, left: 0, right: 0, child: shutter));
}
view = Stack(children: children);
// add margins
view = addMargins(view);
// apply user defined constraints
view = applyConstraints(view, widget.model.tightestOrDefault);
// final view
return view;
}