123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- // void main() {
- // List<ElementProperty>elementProperties = [
- // ElementProperty(top: 0, left: 0)
- // ];
- // print('Original:');
- // elementProperties[0].printAll();
- // print('\n\n\n');
- // List<List<ElementProperty>> undoStack = [];
- // // Add to undoStack
- // undoStack.add(cloneState(elementProperties));
- // // State changes
- // elementProperties.first.top = 10;
- // print('Original:');
- // elementProperties[0].printAll();
- // print('UndoStack:');
- // undoStack.first.first.printAll();
- // // Add to undoStack
- // undoStack.add(cloneState(elementProperties));
- // // State changes
- // elementProperties.first.top = 20;
- // print('Original2:');
- // elementProperties[0].printAll();
- // print('UndoStack2:');
- // undoStack.first.first.printAll();
- // undoStack.last.first.printAll();
- // }
- // List<ElementProperty> cloneState(List<ElementProperty> elementProperties) {
- // List<ElementProperty> clonedElementProperties = elementProperties.map((elementProperty) {
- // return ElementProperty(
- // top: elementProperty.top,
- // left: elementProperty.left,
- // );
- // }).toList();
- // return clonedElementProperties;
- // }
- // class ElementProperty {
- // double top;
- // double left;
- // ElementProperty({
- // required this.top,
- // required this.left,
- // });
- // void printAll() {
- // print('top: $top, left: $left');
- // }
- // }
|