createTraceTemplate method
void
createTraceTemplate(
- String name,
- String backgroundImagePath, {
- int? width,
- int? height,
})
Implementation
void createTraceTemplate(
String name,
String backgroundImagePath, {
int? width,
int? height,
}) {
// Create a trace template with background image
// Use provided dimensions or defaults if not specified
final templateWidth = width ?? 800;
final templateHeight = height ?? 600;
_currentTemplate = TemplateModel(
id: DateTime.now().millisecondsSinceEpoch.toString(),
name: name,
ratio:
'${templateWidth}:${templateHeight}', // Dynamic ratio based on dimensions
canvas: CanvasModel(
width: templateWidth,
height: templateHeight,
background: BackgroundModel(type: 'image'),
backgroundImage: backgroundImagePath,
),
layers: [], // Start with empty layers for tracing
);
_selectedLayer = null;
_isEditing = true;
notifyListeners();
}