flutter_general_dialog 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 46

flutter_general_dialog #

A simple Dialog widget

install #

dependencies:
  flutter_general_dialog:

example #

showGeneralDialog(
  context: context,
  barrierDismissible: true,
  barrierColor: Color(0x80000000),
  barrierLabel: 'Dismiss',
  transitionDuration: Duration(milliseconds: 300),
  transitionBuilder: (
    BuildContext context,
    Animation<double> animation,
    Animation<double> secondaryAnimation,
    Widget child,
  ) {
    var tween =
        Tween(begin: Offset(0, 1), end: Offset(0, 0.8));
    return SlideTransition(
      position: tween.animate(
        CurvedAnimation(
          parent: animation,
          curve: Curves.easeOut,
        ),
      ),
      child: child,
    );
  },
  pageBuilder: (
    BuildContext context,
    Animation<double> animation,
    Animation<double> secondaryAnimation,
  ) {
    return FlutterGeneralDialog(
      padding: EdgeInsets.all(4),
      child: Padding(
        padding: const EdgeInsets.fromLTRB(18, 18, 18, 0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: <Widget>[
            Text(
              'Dialog title ?',
              style: TextStyle(
                fontSize: 18,
                fontWeight: FontWeight.bold,
              ),
            ),
            SizedBox(height: 10),
            ButtonBar(
              children: <Widget>[
                FlatButton(
                  onPressed: () =>
                      Navigator.of(context).pop(),
                  child: Text('OK'),
                ),
              ],
            ),
          ],
        ),
      ),
    );
  },
);

[0.1.0] - 2020-2-14 #

  • A simple Dialog widget

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_general_dialog/flutter_general_dialog.dart';

void main() => runApp(
      MaterialApp(
        home: Scaffold(
          appBar: AppBar(
            title: Text('example'),
          ),
          body: Center(
            child: Builder(
              builder: (context) => RaisedButton(
                child: Text('general_dialog'),
                onPressed: () {
                  showGeneralDialog(
                    context: context,
                    barrierDismissible: true,
                    barrierColor: Color(0x80000000),
                    barrierLabel: 'Dismiss',
                    transitionDuration: Duration(milliseconds: 300),
                    transitionBuilder: (
                      BuildContext context,
                      Animation<double> animation,
                      Animation<double> secondaryAnimation,
                      Widget child,
                    ) {
                      var tween =
                          Tween(begin: Offset(0, 1), end: Offset(0, 0.8));
                      return SlideTransition(
                        position: tween.animate(
                          CurvedAnimation(
                            parent: animation,
                            curve: Curves.easeOut,
                          ),
                        ),
                        child: child,
                      );
                    },
                    pageBuilder: (
                      BuildContext context,
                      Animation<double> animation,
                      Animation<double> secondaryAnimation,
                    ) {
                      return FlutterGeneralDialog(
                        padding: EdgeInsets.all(4),
                        child: Padding(
                          padding: const EdgeInsets.fromLTRB(18, 18, 18, 0),
                          child: Column(
                            crossAxisAlignment: CrossAxisAlignment.stretch,
                            children: <Widget>[
                              Text(
                                'Dialog title ?',
                                style: TextStyle(
                                  fontSize: 18,
                                  fontWeight: FontWeight.bold,
                                ),
                              ),
                              SizedBox(height: 10),
                              ButtonBar(
                                children: <Widget>[
                                  FlatButton(
                                    onPressed: () =>
                                        Navigator.of(context).pop(),
                                    child: Text('OK'),
                                  ),
                                ],
                              ),
                            ],
                          ),
                        ),
                      );
                    },
                  );
                },
              ),
            ),
          ),
        ),
      ),
    );

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_general_dialog: ^0.1.0

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support 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_general_dialog/flutter_general_dialog.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
46
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [flutter_general_dialog] that is in a package requiring null.

Health suggestions

Format lib/flutter_general_dialog.dart.

Run flutter format to format lib/flutter_general_dialog.dart.

Maintenance suggestions

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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8 1.2.2
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test