项目作者: C4s4r

项目描述 :
A Flutter package that provides an animated dialog to display a child, text or textfield in a modern look.
高级语言: C++
项目地址: git://github.com/C4s4r/animated_popup_dialog.git
创建时间: 2021-04-06T19:34:07Z
项目社区:https://github.com/C4s4r/animated_popup_dialog

开源协议:BSD 3-Clause "New" or "Revised" License

下载


Animated Popup Dialog

GitHub last commit
GitHub

A package that provides an animated dialog to display a child, text or textfield in a modern look.















Any child you want



Combination of title
and description



Title and textfield









You can see the implementation of the different types further down this text and in the example folder.

Getting Started

As usual, begin by adding the package to your pubspec.yaml file, see install instruction.

Here is a basic setup with the Animated Popup Dialog:

  1. import 'package:flutter/material.dart';
  2. import 'package:animated_popup_dialog/animated_popup_dialog.dart';
  3. class GettingStartedExample extends StatelessWidget {
  4. @override
  5. Widget build(BuildContext context) {
  6. return Scaffold(
  7. body: Center(
  8. child: ElevatedButton(
  9. child: Text('Popup with text'),
  10. onPressed: () {
  11. Navigator.of(context).push(PageRouteBuilder(
  12. opaque: false, // needed for transparent background
  13. pageBuilder: (context, _, __) {
  14. return AnimatedPopupDialog.text(
  15. title: 'Title',
  16. description:
  17. 'For details regarding fonts see ...',
  18. );
  19. },
  20. ));
  21. },
  22. ),
  23. ),
  24. );
  25. }
  26. }

Different types of the PopupDialog

You can use one of the following modes:

  • AnimatedPopupDialog(): Creates a PopupDialog that allows to place any widget you want as a child.
  • AnimatedPopupDialog.text(): Creates a PopupDialog with a title and a description.
  • AnimatedPopupDialog.textfield(): Creates a PopupDialog with a title and a textfield.

Getting the return of the textfield

To get the textfield value when the PopupDialog is closed, use as following:

  1. ElevatedButton(
  2. child: Text('Popup with textfield'),
  3. onPressed: () async {
  4. String result = await Navigator.of(context).push(PageRouteBuilder(
  5. opaque: false,
  6. pageBuilder: (context, _, __) {
  7. return AnimatedPopupDialog.textfield(
  8. title: 'Title',
  9. textFieldText: 'textFieldText',
  10. );
  11. },
  12. ));
  13. },
  14. ),