buildComponentContainer method
构建组件容器
Implementation
Widget buildComponentContainer(
LayoutPosition position,
ComponentConfig componentConfig,
) {
Widget component = _buildBaseComponent(position, componentConfig);
// 应用尺寸约束
if (componentConfig.width != null || componentConfig.height != null) {
component = SizedBox(
width: componentConfig.width,
height: componentConfig.height,
child: component,
);
}
// 应用内边距
if (componentConfig.padding != null) {
component = Padding(padding: componentConfig.padding!, child: component);
}
// 应用调试边框
if (config.showDebugBounds || config.backgroundColor != null) {
component = Container(
decoration: BoxDecoration(
border: config.showDebugBounds ? Border.all(color: _getDebugColor(position), width: 2): null,
color: config.backgroundColor ?? Colors.white,
),
child: component,
);
}
// 包装为可折叠组件
return CollapsibleComponentWrapper(
position: position,
config: componentConfig,
animationManager: animationManager,
onToggle: () => behaviorManager.toggleComponent(position),
onInteraction:
componentConfig.isFloating
? () =>
behaviorManager.handleFloatingComponentInteraction(position)
: null,
child: component,
);
}