Skip to content

Add custom toast alignment support#821

Merged
Pante merged 2 commits into
mainfrom
feature/custom-toast-alignment
Jan 19, 2026
Merged

Add custom toast alignment support#821
Pante merged 2 commits into
mainfrom
feature/custom-toast-alignment

Conversation

@Pante

@Pante Pante commented Jan 19, 2026

Copy link
Copy Markdown
Member

Describe the changes
Fixes #743

Checklist

  • I have read the CONTRIBUTING.md.
  • I have included the relevant unit/golden tests.
  • I have included the relevant samples.
  • I have updated the documentation accordingly.
  • I have added the required flutters_hook for widget controllers.
  • I have updated the CHANGELOG.md if necessary.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for custom toast alignment by converting FToastAlignment from an enum to a final class, allowing users to specify arbitrary positioning beyond the predefined alignment options.

Changes:

  • Changed FToastAlignment from an enum to a final class with a public constructor for custom alignments
  • Updated golden tests to use named alignment strings instead of enum values
  • Added example demonstrating custom alignment usage

Reviewed changes

Copilot reviewed 6 out of 132 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
forui/lib/src/widgets/toast/toaster.dart Converted FToastAlignment from enum to final class with custom constructor
forui/lib/src/widgets/toast/animated_toaster.dart Fixed switch case ordering for alignment transforms
forui/test/src/widgets/toast/toaster_golden_test.dart Updated tests to use named strings and added custom alignment test case
forui/CHANGELOG.md Documented the breaking change from enum to final class
docs_snippets/lib/main.dart Added route for custom alignment example
docs_snippets/lib/examples/widgets/toast.dart Added example page demonstrating custom alignment
Comments suppressed due to low confidence (1)

forui/test/src/widgets/toast/toaster_golden_test.dart:1

  • The custom alignment test case uses FToastAlignment(const Alignment(-0.5, -0.5), 1) but there's no verification that this custom alignment actually positions the toast correctly. Consider adding a specific test that validates the custom alignment behavior beyond golden file comparison, particularly testing edge cases for the toastAlignment parameter bounds (e.g., -1, 0, 1).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread forui/CHANGELOG.md Outdated
Comment thread forui/lib/src/widgets/toast/toaster.dart
@auto-maid

auto-maid Bot commented Jan 19, 2026

Copy link
Copy Markdown
Contributor

Documentation Preview

Latest Commit SHA 3f4cf18
Preview URL https://cec7a902-forui-docs-dev.duobase.workers.dev/docs

You're seeing this because the docs/samples were updated.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Pante Pante merged commit ddb68dd into main Jan 19, 2026
23 checks passed
@Pante Pante deleted the feature/custom-toast-alignment branch January 19, 2026 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to change the position of toast?

2 participants