当前位置:网站首页>Flutter simple and excellent open source dialog uses free_ dialog

Flutter simple and excellent open source dialog uses free_ dialog

2022-06-13 10:35:00 Two eggs and his big flowers

Preface

Today I'd like to introduce a simple , Easy-to-use dialog, The dialog Simple comparison , Can adapt to many app( There are no other animations or other pictures , Black and white style can adapt to a variety of styles app). If your app A good one is urgently needed dialog, And you're too lazy to develop , Then use this one .

Start

Integrate dialog

dependencies:
  free_dialog: ^0.0.1

git Address :https://github.com/smartbackme/free_dialog

Easy to use

example 1( Input text box ):

FreeDialog(context: context,title: " Please enter text ",
                iWidget: EditWidget(_controller!),
                btnOkOnPress: (a){
    
                  print(a);

                },
                btnCancelOnPress: (){
    

                },
                onDissmissCallback: (DismissType type){
    
                  print(type);

                }
            ).show();
          }, child: const Text(" Input text box ")),

explain :free_dialog Provides a variety of Widget To configure ( There are ,list&edit Two kinds of ), Can integrate quickly .

The display effect is as follows :
 Insert picture description here

example 2( Selection box ):

FreeDialog(context: context,title: " Please select ",
                onDissmissCallback: (DismissType type){
    
                  print(type);

                },
                iWidget: ListWidget(["123","1233","12312","12312","12312","12312","12312","12312","12312","12312","12312","12312","12312"],(a){
    
                  print(a);

                },)
            ).show();
          }, child: const Text(" Selection box ")),

The display effect is as follows :
 Insert picture description here

example 3( More content dialog):

FreeDialog(context: context,title: " Tips ",
                desc: "123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321",
                btnOkOnPress: (a){
    
                  print(a);

                },
                btnCancelOnPress: (){
    

                },
                onDissmissCallback: (DismissType type){
    
                  print(type);

                }
            ).show();

The display effect is as follows :

 Insert picture description here

example 4( More content dialog, Single button ):

FreeDialog(context: context,title: " Tips ",
                desc: "123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321123123211231232112312321",
                btnOkOnPress: (a){
    
                  print(a);

                },

                onDissmissCallback: (DismissType type){
    
                  print(type);

                }
            ).show();

The display effect is as follows :

 Insert picture description here

example 5( Less content dialog):

FreeDialog(context: context,title: " Tips ",
                desc: "111",
                btnOkOnPress: (a){
    
                  print(a);

                },

                onDissmissCallback: (DismissType type){
    
                  print(type);

                }
            ).show();

The display effect is as shown in the picture :
 Insert picture description here

example 6( Single prompt ):

FreeDialog(context: context,title: " Tips ",
                desc: "12312",
                onDissmissCallback: (DismissType type){
    
                  print(type);

                }
            ).show();

The display effect is shown in the figure :
 Insert picture description here

example 7( No exit dialog):

FreeDialog(context: context,title: " Tips ",
                desc: "1111",
                dismissOnTouchOutside: false,
                dismissOnBackKeyPress: false,
                btnCancelOnPress: (){
    

                },

                onDissmissCallback: (DismissType type){
    
                  print(type);

                }
            ).show();

Supported customization

attribute type describe The default attribute
widthdoubledialog Width The narrow side of the screen 80%
titleString Set up title If you don't pass it on, the default is no title Of
descString Set normal The text content of the box If not, don't show , If there are settings body and iwidget It doesn't show
bodyWidget Customize widgetNull
contextBuildContext@requiredNull
btnOkTextStringok written words ‘Ok’
btnOkOnPressFunction Click on okNull ( If passed, it will show ok)
btnOkColorColorok Color Color(0xFF00CA71)
btnOkWidget Pass a ok Components null
btnCancelTextString Cancel ‘Cancel’
btnCancelOnPressFunction Click Cancel Null ( If passed, it will show cancle)
btnCancelColorColor Color Cancel Colors.red
btnCancelWidget Pass a cancle Components null
dismissOnTouchOutsidebool Point external close true
onDismissCallbackFunction Exit the pop-up callback Null
animTypeAnimType Animation type AnimType.SCALE
alignmentAlignmentGeometry Typesetting Alignment.center
useRootNavigatorbool Whether to use useRootNavigatorfalse
autoHideDuration Auto disappear null
keyboardAwarebool Whether to move with the keyboard ( Fill the keyboard area )true
dismissOnBackKeyPressbool Return key exit true
buttonsBorderRadiusBorderRadiusGeometry Button RadiusBorderRadius.all(Radius.circular(100)
dialogBackgroundColorColordialog background Theme.of(context).cardColor
borderSideBorderSide The whole pop-up window shape null
iWidgetIWidget General definition widget( The source code contains edit and list)null
原网站

版权声明
本文为[Two eggs and his big flowers]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/164/202206131019108070.html