Skip to content

Commit 7ea9871

Browse files
author
Anastasia Artemyeva
committed
Add comments
1 parent e04961f commit 7ea9871

7 files changed

+15
-1
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ A Flutter package for showing platform dialogs without using new routes.
66
- Supports Material and Cupertino dialogs
77
- Flutter-based solution, no additional imports needed
88

9+
![Overlay Dialog Demo](https://github.com/mera-company/flutter-overlay-dialog/blob/master/doc/overlay_dialog_demo.gif?raw=true =300x533)
10+
911
# What's the problem?
1012

1113
During project develop we stucks with several problems with Flutter dialogs. This package solves several problems of standart Flutter approach.

lib/src/animation/appear_widget.dart

+4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,15 @@ import 'dart:ui';
44
import 'package:flutter/cupertino.dart';
55
import 'package:flutter/widgets.dart';
66

7+
// Supported animation type
8+
// opacity creates fade in / out effect
9+
// blur makes background blurred
710
enum AppearStyle {
811
opacity,
912
blur
1013
}
1114

15+
// Uses to animate dialog appearance
1216
class AppearWidget extends StatefulWidget {
1317
final Widget _child;
1418
final Stream _progress;

lib/src/dialog_factory.dart

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import 'package:flutter/widgets.dart';
77
import 'entity/dialog_action.dart';
88
import 'entity/dialog_style.dart';
99

10+
// Platform dialog factory
1011
class DialogFactory {
1112
factory DialogFactory(DialogStyle type) {
1213
if (type == DialogStyle.material) {

lib/src/dialog_helper.dart

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class DialogHelper {
2222
Function _currentCallback;
2323
StreamController<double> _currentController;
2424

25+
// Shows the dialog
2526
void show(BuildContext context, DialogWidget dialog, {bool rootOverlay = true}) {
2627
hideImmediate(context);
2728

@@ -63,6 +64,7 @@ class DialogHelper {
6364
_currentController.add(1.0);
6465
}
6566

67+
// Hide opened dialog with animation
6668
void hide(BuildContext context) {
6769
if (_currentCallback != null) {
6870
ModalRoute.of(context)?.removeScopedWillPopCallback(_currentCallback);
@@ -84,6 +86,7 @@ class DialogHelper {
8486
}
8587
}
8688

89+
// Hide opened dialog without animation, clear closable callback if any
8790
void hideImmediate(BuildContext context) {
8891
//reset back press handler
8992
if (_currentCallback != null) {

lib/src/entity/dialog_action.dart

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import 'package:flutter/widgets.dart';
22

3+
// Default action to handle dialog button tap
4+
// isDefault and isDestructive flags are used for Cupertino dialogs
35
class DialogAction {
46
String title;
57
Function handler;

lib/src/entity/dialog_style.dart

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Dialog style,
2+
// adaptive dialog chooses style depends on platform
13
enum DialogStyle {
24
material,
35
cupertino,

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: overlay_dialog
22
description: A Flutter package for showing platform dialogs without using new routes.
33
version: 0.0.2
4-
homepage: https://ctogitlab.mera.com/anartem/flutter-overlay-dialog
4+
homepage: https://github.com/mera-company/flutter-overlay-dialog
55

66
environment:
77
sdk: ">=2.7.0 <3.0.0"

0 commit comments

Comments
 (0)