Skip to content

Instantly share code, notes, and snippets.

@bambinoua
Created December 5, 2022 08:29
Show Gist options
  • Save bambinoua/31848a16222eeba75fdb648e529ff6cf to your computer and use it in GitHub Desktop.
Save bambinoua/31848a16222eeba75fdb648e529ff6cf to your computer and use it in GitHub Desktop.
Test
// Main video widget.
class VideoState extends State {
Widget build(...) {
return Row(
childred: [
SideBar(), // can be hidden (depending on this overlay which can be created deeper should change its sze as VideoMonitor widget will also be resized.
VideoMonitor(), // contains VideoMonitorGrid
],
);
}
}
// VideoMonitor which is part of Video widget.
class VideoMonitorState extends State {
final layerLink = LayerLink();
Widget build(...) {
Expaned(
child: CompositedTransformTarget(
link: layerLink,
child: Provider.value(
value: layerLink,
child: SomeOtherWidgets(
child: VideoMonitorGrid(),
)
),
),
),
}
// Wrapper for different grid layouts
class VideoMonitorGridState extends State {
Widget build(...) {
return SomeOtherWidgets(
return specificDesignGridBuilder(this); // depending of selector specific designed widget is built.
);
}
}
// Specific video layout
class VideoMonitor2x2 extends State {
Widget build(...) {
// Widget chich will be zoomed
return VideoCameraZoomed(
child: GestureDetector(
onDoubleTap: _showOverlay(),
child: widget.child,
),
);
}
void _showOverLay() {
final layerLink = context.read<LayerLink>();
final cellRect = context.getRect();
final gridRect = Rect.fromLTWH(
layerLink.leader.offset.dx,
layerLink.leader.offset.dx,
layerLink.leaderSize.width,
layerLink.leaderSize.height,
);
final rectAnimation = RectTween(begin: cellRect, end: gridRect).animate(controller);
_overlayEntry = OverlayEntry(
builder: (_) {
return CompositedTransformFollower(
link: layerLink,
showWhenUnlinked: false,
offset: -gridRect.topLeft,
child: GestureDetector(
onDoubleTap: _hideOverlay(),
child: AnimatedBuilder(
builder: (contet,child) {
return Stack(
children: [
Positioned(
// left,top,width, rect from rectAnimation
child: widget.child // zooming widget is hare
),
],
);
}
),
),
);
}
);
}
}
So when I change width of Sidebar, VideoMonitor's width is also changed. Along the chain created Overlay
expanded (only first time). If I show Sidebar again, i.e. width of the VideoMonitor() become less, than Overlay's width must
also decreased but it does not so because `gridRect` is not changed. I need some how to force update the OverlayEntry's builder.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment