YY.inc에서 개발한 플러터용 의미론적 다이얼로그 패키지로, 접근성과 사용자 정의가 가능한 다이얼로그 컴포넌트를 제공하도록 설계되었습니다. 스크린 리더 지원 및 사용자 경험 향상을 위해 적절한 의미론을 중시합니다. 오픈소스이며 커뮤니티의 기여를 환영합니다. 플러터의 위젯 시스템을 기반으로 구축되어, 최소한의 뼈대 코드로 일관되고 재사용 가능한 다이얼로그를 생성할 수 있습니다. 포괄적인 UI 디자인과 구조화된 다이얼로그 상호작용이 필요한 앱에 이상적입니다.
Global dialog function encapsulation, with a semantic way to fill the content inside the dialog, the current function provided
Support for a few semantic component methods to populate the component content inside dialog
Support for customizing semantic components for developers to freely populate component content inside dialog
Support setting dialog background color, foreground color, position, animation, click the external disappear and other functions, see the details below
The dialog appears with the default animation available
false
margin
The margin of a dialog
EdgeInsets.all(0.0)
barrierColor
Dialog barrierColor
30% of black
decoration
Dialog decoration
null
backgroundColor
Dialog backgroundColor
white
borderRadius
Dialog borderRadius
0.0
constraints
Dialog constraints
no constraints
animatedFunc
Animation of dialog
Emerge from the middle
showCallBack
dialog show callbacks
not
dismissCallBack
dialog dismiss callbacks
not
barrierDismissible
Whether to click to pop up the external disappear
true
useRootNavigator
Whether to use root navigation
true
After setting gravity, set gravityAnimationEnable = true if animation is needed
If the decoration property is set, the backgroundColor and borderRadius are not in effect; they are mutually exclusive
Supported method
method
description
show[x,y]
show dialog
dismiss
dismiss dialog
isShowing
Is the dialog showing
⚡ Semantic Widget
The contents of the components inside the dialog are encapsulated by semantic functions in advance to quickly build the dialog, as shown in the following table
Since the existing semantic components only assist in the rapid UI construction, they are far from meeting the requirements in actual project development
So it provides the ability to insert custom semantic components into dialog
Insert the component into the dialog through 'widget()'
Application scenario: after the network request comes back, there is no Context to refer to in the callback, at this time, the Context needs to be initialized in advance, and then the dialog can be called without the Context
1、init
Call static methods before show dialog YYDialog.init(context);
classAppHomeextendsStatelessWidget{
Widgetbuild(BuildContext context) {
//1、init contextYYDialog.init(context);
//2、Subsequent use may not be required context
......
}
}
2、use
direct use YYDialog,Note that it must be called build()