flutter_custom_dialog_dev 0.0.1+1

  • Readme
  • Changelog
  • Example
  • Installing
  • new10

✨ 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 #


  flutter_custom_dialog: ^1.0.6


import 'package:flutter_custom_dialog/flutter_custom_dialog.dart';

🎖 Example #









bottom sheet

pop menu
✅ Support for custom locations







left bottom

left top

right bottom

right top





✅ 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 YYDialogDemo(BuildContext context) {
  return YYDialog().build(context)
    ..width = 220
    ..height = 500
    ..barrierColor = Colors.black.withOpacity(.3)
    ..animatedFunc = (child, animation) {
      return ScaleTransition(
        child: child,
        scale: Tween(begin: 0.0, end: 1.0).animate(animation),
    ..borderRadius = 4.0

Supported attributes

widthDialog width0
heightDialog heightAdaptive component height
durationDialog animation time250 ms
gravityWhere the dialog appearscenter
gravityAnimationEnableThe dialog appears with the default animation availablefalse
marginThe margin of a dialogEdgeInsets.all(0.0)
barrierColorDialog barrierColor30% of black
backgroundColorDialog backgroundColorwhite
borderRadiusDialog borderRadius0.0
constraintsDialog constraintsno constraints
animatedFuncAnimation of dialogEmerge from the middle
barrierDismissibleWhether to click to pop up the external disappeartrue

Supported method

show[x,y]show dialog
dismissdismiss dialog
isShowingIs 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
      padding: EdgeInsets.all(25.0),
      alignment: Alignment.center,
      text: "确定要退出登录吗?",
      color: Colors.black,
      fontSize: 14.0,
      fontWeight: FontWeight.w500,
      padding: EdgeInsets.only(top: 10.0),
      gravity: Gravity.center,
      withDivider: true,
      text1: "取消",
      color1: Colors.redAccent,
      fontSize1: 14.0,
      fontWeight1: FontWeight.bold,
      onTap1: () {
      text2: "确定",
      color2: Colors.redAccent,
      fontSize2: 14.0,
      fontWeight2: FontWeight.bold,
      onTap2: () {

Semantic components supported

texttext widget
doubleButtontwo-button widget
listViewOfListTilelistTile widget
listViewOfRadioButtonlistRadio widget
dividerdivider widget
widgetcustom 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
        padding: EdgeInsets.all(0.0),
        child: Align(
          alignment: Alignment.centerLeft,
          child: Text(
            style: TextStyle(
              color: Colors.black,
              fontSize: 14.0,
              fontWeight: FontWeight.w100,

⚡ 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


Call static methods before show dialog YYDialog.init(context);

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


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

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

Bugs/Requests #

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

About #

  • QQ:510402535
  • QQ群:798874340
  • e-mail:xyj510402535@qq.com
  • g-mail:xyj51042535@gmail.com
  • Blog:http://blog.csdn.net/qq_30379689
  • Github:https://github.com/AndroidHensen

License #

Apache License 2.0

0.0.1+1 #

  • initial release.


flutter_custom_dialog_example #

Demonstrates how to use the flutter_custom_dialog plugin.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_custom_dialog_dev: ^0.0.1+1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_custom_dialog_dev/components/example/alert_dialog.dart';
import 'package:flutter_custom_dialog_dev/components/example/bottom_sheet_dialog.dart';
import 'package:flutter_custom_dialog_dev/components/example/listview_dialog.dart';
import 'package:flutter_custom_dialog_dev/components/example/progress_dialog.dart';
import 'package:flutter_custom_dialog_dev/flutter_custom_dialog.dart';
import 'package:flutter_custom_dialog_dev/flutter_custom_dialog_widget.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Oct 9, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4


Detected platforms:

Error(s) prevent platform classification:

Error(s) in lib/flutter_custom_dialog_widget.dart: Target of URI doesn't exist: 'package:flutter_custom_dialog/flutter_custom_dialog.dart'.

Health issues and suggestions

Fix lib/components/example/alert_dialog.dart. (-100 points)

Analysis of lib/components/example/alert_dialog.dart failed with 45 errors, 15 hints, including:

line 2 col 8: Target of URI doesn't exist: 'package:flutter_custom_dialog/flutter_custom_dialog.dart'.

line 4 col 1: Undefined class 'YYDialog'.

line 5 col 10: The function 'YYDialog' isn't defined.

line 15 col 16: Undefined name 'Gravity'.

line 28 col 1: Undefined class 'YYDialog'.

Fix lib/components/example/listview_dialog.dart. (-99.58 points)

Analysis of lib/components/example/listview_dialog.dart failed with 19 errors, 2 hints, including:

line 2 col 8: Target of URI doesn't exist: 'package:flutter_custom_dialog/flutter_custom_dialog.dart'.

line 5 col 3: The function 'ListTileItem' isn't defined.

line 19 col 3: The function 'ListTileItem' isn't defined.

line 33 col 3: The function 'ListTileItem' isn't defined.

line 47 col 3: The function 'ListTileItem' isn't defined.

Fix lib/components/example/progress_dialog.dart. (-76.51 points)

Analysis of lib/components/example/progress_dialog.dart failed with 5 errors, 2 hints, including:

line 2 col 8: Target of URI doesn't exist: 'package:flutter_custom_dialog/flutter_custom_dialog.dart'.

line 4 col 1: Undefined class 'YYDialog'.

line 5 col 10: The function 'YYDialog' isn't defined.

line 15 col 1: Undefined class 'YYDialog'.

line 16 col 10: The function 'YYDialog' isn't defined.

Fix additional 3 files with analysis or formatting issues. (-152.29 points)

Additional issues in the following files:

  • lib/components/example/bottom_sheet_dialog.dart (4 errors, 1 hint)
  • lib/flutter_custom_dialog_widget.dart (3 errors, 1 hint)
  • lib/flutter_custom_dialog.dart (1 error, 2 hints)

Maintenance issues and suggestions

Fix platform conflicts. (-20 points)

Error(s) prevent platform classification:

Error(s) in lib/flutter_custom_dialog_widget.dart: Target of URI doesn't exist: 'package:flutter_custom_dialog/flutter_custom_dialog.dart'.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies