All Projects → YYFlutter → Flutter Custom Dialog

YYFlutter / Flutter Custom Dialog

Licence: apache-2.0
🚀🚀🚀 Semantic dialog

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to Flutter Custom Dialog

SlidingUpMenu
🚀 A very customizable library that allows you to present menu items (from menu resource and/or other sources) to users as a bottom sheet.
Stars: ✭ 26 (-92.28%)
Mutual labels:  dialog
Easydialog
通过封装DialogFragment实现的dialog,非自定义view,纯净原生!
Stars: ✭ 280 (-16.91%)
Mutual labels:  dialog
Artdialog
经典的网页对话框组件
Stars: ✭ 3,110 (+822.85%)
Mutual labels:  dialog
Ngx Smart Modal
Modal/Dialog component crafted for Angular
Stars: ✭ 256 (-24.04%)
Mutual labels:  dialog
Rflutter alert
RFlutter Alert is super customizable and easy-to-use alert / popup dialog library for Flutter. You may create reusable alert styles or add buttons as much as you want with ease.
Stars: ✭ 271 (-19.58%)
Mutual labels:  dialog
Rakugo Archive
Framework (inspired by Ren'Py) for story driven games in Godot.
Stars: ✭ 291 (-13.65%)
Mutual labels:  dialog
hcn
Hybrid Code Networks https://arxiv.org/abs/1702.03274
Stars: ✭ 81 (-75.96%)
Mutual labels:  dialog
Vuejs Dialog
A lightweight, promise based alert, prompt and confirm dialog
Stars: ✭ 327 (-2.97%)
Mutual labels:  dialog
Md Date Time Picker
An implementation of Material Design Picker components in vanilla CSS, JS, and HTML
Stars: ✭ 272 (-19.29%)
Mutual labels:  dialog
Android Loading Dialog
这个是我在泡网看见的一个等待的dialog
Stars: ✭ 297 (-11.87%)
Mutual labels:  dialog
Vue Modal Dialogs
Promisify dialogs in Vue!
Stars: ✭ 259 (-23.15%)
Mutual labels:  dialog
Vue Ydui
A mobile components Library with Vue2.js. 一只基于Vue2.x的移动端组件库。
Stars: ✭ 2,798 (+730.27%)
Mutual labels:  dialog
React Native Picker
纯JS实现的一个高效流畅的日期选择器和区域选择器,支持android、ios
Stars: ✭ 295 (-12.46%)
Mutual labels:  dialog
Longpresspopup
Make a Popup appear long pressing on a view and handle drag-release events on its elements
Stars: ✭ 256 (-24.04%)
Mutual labels:  dialog
Dialog2
移动端弹窗插件第二版,包括常见的 alert、confirm。toast、notice 四种类型弹窗,支持 jQuery 和 Zepto 库。(已停止维护,请使用vue、react 等新框架)
Stars: ✭ 311 (-7.72%)
Mutual labels:  dialog
bootstrap-modal-wrapper
Bootstrap modal factory that supports dynamic modal creations and nested stacked modal features.
Stars: ✭ 18 (-94.66%)
Mutual labels:  dialog
Gonorth
GoNorth is a story and content planning tool for RPGs and other open world games.
Stars: ✭ 289 (-14.24%)
Mutual labels:  dialog
Malert
Custom alert View to iOS applications
Stars: ✭ 328 (-2.67%)
Mutual labels:  dialog
Vodal
A Vue modal with animations.
Stars: ✭ 312 (-7.42%)
Mutual labels:  dialog
Mbtileparser
MBTileParser is a game engine written using pure UIKit in the days before SpriteKit.
Stars: ✭ 297 (-11.87%)
Mutual labels:  dialog

✨ flutter_custom_dialog

pub package

[Lanuage ~~] English | 中文文档

Global dialog function encapsulation, with a semantic way to fill the content inside the dialog, the current function provided

  1. Support for a few semantic component methods to populate the component content inside dialog
  2. Support for customizing semantic components for developers to freely populate component content inside dialog
  3. Support setting dialog background color, foreground color, position, animation, click the external disappear and other functions, see the details below
  4. Support no Context call dialog, see below

🎖 Installing

1、install

dependencies:
  flutter_custom_dialog: ^1.0.20

2、import

import 'package:flutter_custom_dialog/flutter_custom_dialog.dart';

🎖 Example

dialog_demo


divider

body

head&body

listTile

ListRadio

progress

progress&body

bottom sheet

notice

pop menu
✅ Support for custom locations

dialog_gravity


bottom

top

left

right

center

left bottom

left top

right bottom

right top

dialog_animation


scaleIn

fadeIn

rotateIn

customIn
✅ Support for custom animations

⚡ Dialog Property

dialog property Settings can be called through the method of member variables, as detailed in the following table

YYDialog YYNoticeDialog() {
  return YYDialog().build()
    ..width = 120
    ..height = 110
    ..backgroundColor = Colors.black.withOpacity(0.8)
    ..borderRadius = 10.0
    ..showCallBack = () {
      print("showCallBack invoke");
    }
    ..dismissCallBack = () {
      print("dismissCallBack invoke");
    }
    ..widget(Padding(
      padding: EdgeInsets.only(top: 21),
      child: Image.asset(
        'images/success.png',
        width: 38,
        height: 38,
      ),
    ))
    ..widget(Padding(
      padding: EdgeInsets.only(top: 10),
      child: Text(
        "Success",
        style: TextStyle(
          fontSize: 15,
          color: Colors.white,
        ),
      ),
    ))
    ..animatedFunc = (child, animation) {
      return ScaleTransition(
        child: child,
        scale: Tween(begin: 0.0, end: 1.0).animate(animation),
      );
    }
    ..show();
}

Supported attributes

property description default
width Dialog width 0
height Dialog height Adaptive component height
duration Dialog animation time 250 ms
gravity Where the dialog appears center
gravityAnimationEnable 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

YYDialog YYAlertDialogWithDivider(BuildContext context) {
  return YYDialog().build(context)
    ..width = 220
    ..borderRadius = 4.0
    ..text(
      padding: EdgeInsets.all(25.0),
      alignment: Alignment.center,
      text: "确定要退出登录吗?",
      color: Colors.black,
      fontSize: 14.0,
      fontWeight: FontWeight.w500,
    )
    ..divider()
    ..doubleButton(
      padding: EdgeInsets.only(top: 10.0),
      gravity: Gravity.center,
      withDivider: true,
      text1: "取消",
      color1: Colors.redAccent,
      fontSize1: 14.0,
      fontWeight1: FontWeight.bold,
      onTap1: () {
        print("取消");
      },
      text2: "确定",
      color2: Colors.redAccent,
      fontSize2: 14.0,
      fontWeight2: FontWeight.bold,
      onTap2: () {
        print("确定");
      },
    )
    ..show();
}

Semantic components supported

method description
text text widget
doubleButton two-button widget
listViewOfListTile listTile widget
listViewOfRadioButton listRadio widget
divider divider widget
widget custom semantic widget

⚡ Custom Widget

Customize dialog interior component content

  • 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()'

YYDialog YYDialogDemo(BuildContext context) {
  return YYDialog().build(context)
    ..width = 220
    ..height = 500
    ..widget(
      Padding(
        padding: EdgeInsets.all(0.0),
        child: Align(
          alignment: Alignment.centerLeft,
          child: Text(
            "",
            style: TextStyle(
              color: Colors.black,
              fontSize: 14.0,
              fontWeight: FontWeight.w100,
            ),
          ),
        ),
      ),
    )
    ..show();
}

⚡ Without the Context to invoke

  • 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);

class AppHome extends StatelessWidget {
  Widget build(BuildContext context) {
    //1、init context
    YYDialog.init(context);
    //2、Subsequent use may not be required context
    ......
  }
}

2、use

direct use YYDialog,Note that it must be called build()

YYDialog YYAlertDialogBody() {
  return YYDialog().build()
    ..width = 240
    ..text(
      text: "Hello YYDialog",
      color: Colors.grey[700],
    )
    ..show();
}

🔥🔥 Attention

1、dismiss

  • Do not use 'Navigator.pop(context)' to make the popover disappear, or you will close your page
  • This problem has been solved internally in YYDialog, and you can simply call 'dismiss()' supplied internally
var yyDialog = YYDialog();
yyDialog?.dismiss();

Bugs/Requests

  • If your application has problems, please submit your code and effect to Issue.
  • Pull request are also welcome.

About

License

Apache License 2.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].