unified_popups 1.2.1
unified_popups: ^1.2.1 copied to clipboard
A unified popups SDK for Flutter, providing a flexible way to show toasts, dialogs, and other custom popups.
Changelog #
1.2.1 #
Added #
-
Widget 自定义支持
Pop.toast()新增messageWidget参数,支持完全自定义消息内容 WidgetPop.confirm()新增titleWidget、contentWidget、confirmButtonWidget、cancelButtonWidget参数,支持完全自定义标题、内容和按钮 WidgetPop.sheet()新增titleWidget参数,支持完全自定义标题 Widget- 所有 Widget 参数优先于对应的 String 参数,提供更灵活的定制能力
-
Confirm 回调增强
Pop.confirm()新增onConfirm和onCancel回调参数- 回调在内部关闭逻辑之前执行,允许外部完全接管按钮点击事件
- 保留原有的
Future<bool?>返回值机制,向后兼容
-
示例页面
- 新增
PopupManagerPage示例页面,展示PopScopeWidget和PopupManager.show的搭配使用 - 演示返回键处理、多弹窗管理、弹窗状态监听等场景
- 新增
【1.2.0】 #
Added #
- 新增
animationCurve参数,支持动态配置动画类型
1.1.17 #
- Add
PopupRouteObserver.- Popups such as sheet and confirm will automatically close when the route changes.
1.1.16 #
ClipRect Sheet
1.1.14 #
Fixed #
- Fix the bug where the area that disappears when multiple Loading triggers occur remains and causes unclickability due to OverLary's effect.
- Following the singleton pattern, the loading process cannot be triggered many times. The displayed OverLary will always have only one.
1.1.13 #
Added #
- Toast Toggle Feature
- Added toggle functionality for Toast, allowing users to switch between two states by tapping
- Added
tMessageparameter: alternate message text for toggle mode - Added
tImagePathparameter: alternate image path for toggle mode - Added
tToastTypeparameter: alternate toast type for toggle mode - Added
tImgColorparameter: alternate image color for toggle mode - Added
onTapparameter: callback function when toast is tapped - Added
toggleableparameter: enable/disable toggle mode (default: false) - ToastWidget changed from StatelessWidget to StatefulWidget to support state management
- When
toggleableistrueandtMessageortImagePathis provided, tapping the toast will switch between two states
1.1.12 #
Feat #
clipDuringAnimationfor PopupConfig Whether to crop the animation that exceeds the area in anchor point mode, default false.
1.1.11 #
Fixed #
- Enhanced Build Phase Error Handling
- Fixed
overlay.insert()setState error when called during build phase - Extracted
_insertPopupprivate method to handle overlay insertion logic - Added build phase detection in
PopupManager.show()method - If called during build phase (
SchedulerPhase.persistentCallbacks), automatically defers topostFrameCallbackexecution - Now fully supports calling popups in async operations and during build phase without errors
- Perfect support for scenarios like
Get.put()immediate initialization in route building process
- Fixed
1.1.10 #
Changed #
- Loading API Simplification
Pop.loading()now returnsvoidinstead ofString(loading ID)Pop.hideLoading()no longer requires a parameter- The entire application can only have one loading instance at a time, managed internally
- When showing a new loading, any existing loading is automatically closed
Added #
- PopupManager Enhancement
- Added
PopupManager.hideByType(PopupType type)method to hide popups by type - Useful for managing single-instance popup types like loading
- Added
Fixed #
- Fixed "setState() called during build" error when calling
Pop.loading()during build phase- Implemented
SafeOverlayEntrythat delays overlay insertion if called during build phase - Uses
SchedulerBindingto check build phase and defer overlay operations
- Implemented
1.1.9 #
- Added
padding constraints decorationforPop.menu
1.1.8 #
Added #
- Introduced sheet barrier options (
showBarrier,barrierDismissible,barrierColor) for finer control. - Added
dockToEdgeto reserve space for system/tab/navigation bars when sliding from the bottom/left/right edges. - Added
edgeGapwith a default ofkBottomNavigationBarHeight + 4, allowing custom edge spacing.
Changed #
- When
dockToEdgeis enabled, the barrier now uses clipping instead of margin so the reserved edge remains interactive.
Fixed #
- Improved sheet keyboard handling so bottom sheets lift with the keyboard without compressing content.
1.1.7 #
1.1.6 #
- Toast API Enhancement
- Added
imgColorparameter so custom images can be tinted directly fromPop.toast
- Added
1.1.5 #
Added #
- Confirm API Enhancement
- Added
confirmBorderandcancelBorderparameters to allow customBoxBorderfor confirm/cancel buttons - Preserves the original borderless style when a border is not provided
- Added
Changed #
ConfirmWidgetbuttons now useGestureDetector + Container, maintaining border radius, custom borders, and background colors consistently
1.1.4 #
Added #
-
Toast API Enhancement
- Added
customImagePathparameter to support custom local images - Added
imageSizeparameter to customize image size (default: 24.0) - Added
layoutDirectionparameter to support Row/Column layout switching (default: Row) - Custom images will override toastType icons when provided
- Added
-
Loading API Enhancement
- Added
customIndicatorparameter to support custom Widget (typically images) as loading indicator - Added
rotationDurationparameter to configure rotation animation speed (default: 1 second) - Custom indicator automatically includes rotation animation
- When both message and customIndicator are present, Container maintains square aspect ratio with adaptive sizing (max 25% screen width, 100px)
- Added
Changed #
- LoadingWidget changed from StatelessWidget to StatefulWidget to support rotation animation
- Loading container with message now maintains square aspect ratio for better visual consistency
1.1.1 #
Fixed #
- 修复了所有widget组件中的文本溢出问题
- ToastWidget: 使用Flexible包裹文本,支持多行显示
- ConfirmWidget: 为标题和内容文本添加maxLines和overflow处理
- LoadingWidget: 为消息文本添加溢出处理
- SheetWidget: 为标题文本添加溢出处理
- 所有文本组件现在都支持长文本的多行显示,避免溢出错误
1.1.0 #
Added #
- 为所有API入口添加了
animationDuration参数,支持外部传入不同的动画时长 - 每个API都有合理的默认动画时长:
Pop.toast(): 200ms (快速显示)Pop.loading(): 150ms (快速显示)Pop.confirm(): 250ms (适中时长)Pop.date(): 250ms (适中时长)Pop.menu(): 200ms (快速响应)Pop.sheet(): 400ms (较长动画,适合抽屉效果)
PopupConfig.animationDuration默认值从400ms调整为300ms,作为最终兜底值
Changed #
- 优化了动画时长的默认配置,不同场景使用不同的动画时长,提升用户体验
- 所有API方法现在都支持
animationDuration参数,保持向后兼容性
Technical Details #
- 参数传递链路:API方法 → 实现方法 → PopupConfig → PopupManager
- 不传参数时使用合理的默认值,传入自定义值时覆盖默认值