refactor buildcontext as internal
This commit is contained in:
@@ -25,6 +25,7 @@ class LazyCanvasController with ChangeNotifier {
|
||||
bool _init = false;
|
||||
late final SpatialHashing<int> _spatialHash;
|
||||
TickerProvider? _ticker;
|
||||
late BuildContext _context;
|
||||
|
||||
bool debug;
|
||||
|
||||
@@ -71,6 +72,10 @@ class LazyCanvasController with ChangeNotifier {
|
||||
_ticker = ticker;
|
||||
}
|
||||
|
||||
void setBuildContext(BuildContext context) {
|
||||
_context = context;
|
||||
}
|
||||
|
||||
// ==================== Child Management ====================
|
||||
|
||||
/// Add a child at a given position with a widget. Returns the child ID.
|
||||
@@ -174,7 +179,7 @@ class LazyCanvasController with ChangeNotifier {
|
||||
// ==================== Positioning Logic ====================
|
||||
|
||||
/// Currently rendered widgets with their position info
|
||||
List<ChildInfo> widgetsWithScreenPositions(BuildContext context, {bool forceRebuild = false}) {
|
||||
List<ChildInfo> widgetsWithScreenPositions({bool forceRebuild = false}) {
|
||||
if (!_init) return [];
|
||||
|
||||
final idsToBuild = _childrenWithinBuildArea(_gsCenter, _buildExtent);
|
||||
@@ -218,7 +223,6 @@ class LazyCanvasController with ChangeNotifier {
|
||||
/// an offstage rendering will be used ( double render )
|
||||
/// Preferred horizontal margin used for [ScalingMode.fitInViewport].
|
||||
void focusOnChild(
|
||||
BuildContext context,
|
||||
int id, {
|
||||
ScalingMode scalingMode = ScalingMode.keepScale,
|
||||
bool animate = true,
|
||||
@@ -236,7 +240,7 @@ class LazyCanvasController with ChangeNotifier {
|
||||
// else do an offstage render
|
||||
childSize ??= childInfo.lastRenderedSize != null && !forceRedraw
|
||||
? childInfo.lastRenderedSize
|
||||
: measureWidgetSize(context, (_) => childInfo.widget);
|
||||
: measureWidgetSize(_context, (_) => childInfo.widget);
|
||||
|
||||
/*
|
||||
margin is symmatric on ltrb so
|
||||
|
||||
Reference in New Issue
Block a user