Skip to content

Conversation

@Gupta-02
Copy link

Overview
This PR implements a comprehensive undo/redo system with a visual history timeline for the Flutter text editing app, providing users with intuitive navigation through their editing history.

Key Features Implemented
🔄 Advanced Undo/Redo Functionality
Linear History Management: Implemented a robust history system using HistoryEntry objects that track canvas states
Smart State Preservation: Each history entry captures the complete canvas state including text items, drawing paths, and canvas settings
Truncation on New Actions: When users perform new actions after undoing, the history is properly truncated to maintain consistency
📊 Visual History Timeline
Timeline Widget: New HistoryTimeline widget displays a chronological list of all editing actions
Thumbnail Previews: Each history entry shows a miniature preview of the canvas state using CanvasThumbnail widget
Action Descriptions: Clear, descriptive labels for each action (e.g., "Added text", "Drew path", "Changed background")
Timestamps: Each entry includes the exact time when the action was performed
🎯 Interactive Navigation
Jump-to Functionality: Users can click on any history entry to instantly jump to that state
Visual Feedback: Current position in history is clearly highlighted in the timeline
Smooth Transitions: Seamless state restoration when navigating through history
⚡ Performance Optimizations
RepaintBoundary: Used RepaintBoundary for efficient thumbnail generation without impacting main canvas performance
Immutable State: Leveraged Flutter's immutable state pattern with copyWith methods for reliable state management
Memory Efficient: History entries store complete state snapshots for accurate restoration
Technical Implementation
New Files Added:
history_entry.dart - Data model for history entries with timestamps and descriptions
history_node.dart - Supporting model for history structure
history_timeline.dart - Main timeline widget with interactive list
canvas_thumbnail.dart - Thumbnail generation using RepaintBoundary
Modified Files:
canvas_state.dart - Added history list and current history index management
canvas_cubit.dart - Enhanced with _addToHistory(), undo(), and redo() methods
canvas_screen.dart - Integrated timeline button and undo/redo controls
User Experience Improvements
Intuitive Controls: Clear undo/redo buttons with visual state indicators
Visual History: Users can see exactly what changed at each step with thumbnail previews
Time-based Navigation: Easy to understand chronological progression of edits
Non-destructive Editing: Users can experiment freely knowing they can always return to previous states
Testing Considerations
History navigation works correctly in both directions
Thumbnail generation is performant and doesn't block UI
State restoration is accurate and complete
Edge cases handled (empty history, maximum undo steps, etc.)
This implementation provides a professional-grade undo/redo system that significantly enhances the user experience of the text editing app, making it more powerful and user-friendly.

@github-actions
Copy link
Contributor

Our Pull Request Approval Process

Thanks for contributing!

Reviewers

Do not assign reviewers. Our Queue Monitors will review your PR and assign them.
When your PR has been assigned reviewers contact them to get your code reviewed and approved via:

  1. comments in this PR

Reviewing Your Code

Your reviewer(s) will have the following roles:

  1. arbitrators of future discussions with other contributors about the validity of your changes
  2. point of contact for evaluating the validity of your work
  3. person who verifies matching issues by others that should be closed.
  4. person who gives general guidance in fixing your tests

Other

🎯 Please be considerate of our volunteers' time. Contacting the person who assigned the reviewers is not advised unless they ask for your input. Do not @ the person who did the assignment otherwise.

@may-tas
Copy link
Owner

may-tas commented Oct 27, 2025

@Gupta-02 attach a screen recording.

@Gupta-02
Copy link
Author

Hey check the files I have not added new thinks just changed the files

@may-tas
Copy link
Owner

may-tas commented Oct 27, 2025

@Gupta-02 I just wanted to see the working of the feature, can you please record the screen and show me what you have implemented.

@Gupta-02
Copy link
Author

Kk I will try to record and comeback

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

This pull request did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please verify it has no conflicts with the main branch and rebase if needed. Mention it now if you need help or give permission to other people to finish your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants