popup_build 2.1.0 copy "popup_build: ^2.1.0" to clipboard
popup_build: ^2.1.0 copied to clipboard

A Flutter library that the creation of basic popup UIs such as dialogs, bottom sheets, selection sheets, etc.

A Flutter library that the creation of basic popup UIs such as dialogs, bottom sheets, selection sheets, etc.

Popup Build Example 1 Popup Build Example 2 Popup Build Example 3

Getting started #

To install, add it to your pubspec.yaml file:

dependencies:
    popup_build:
copied to clipboard

To import it:

import 'package:popup_build/popup_build.dart';
copied to clipboard

Usage #

Reusable UI Components

You can create reusable UI components using extensions. Here's an example:

extension PopupExt on Popup {
  Popup get all10 =>
      copyWith(
        outPadding: const EdgeInsets.all(10.0),
        inPadding: const EdgeInsets.all(10.0),
      );

  Popup get back =>
      copyWith(
          button: Container(
              decoration: const BoxDecoration(
                  color: Colors.grey,
                  borderRadius: BorderRadius.all(Radius.circular(10))),
              child: const BackButton()));

  Popup get close =>
      copyWith(
          button: Container(
              decoration: const BoxDecoration(
                  color: Colors.grey,
                  borderRadius: BorderRadius.all(Radius.circular(10))),
              child: const CloseButton()));
}
copied to clipboard

Implementation in main()

Here's how you can use the library in your main() function:

void main() =>
    runApp(MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: SafeArea(
          child: Padding(
            padding: const EdgeInsets.all(20.0),
            child: Builder(
                builder: (context) =>
                    Row(
                      children: [
                        Expanded(
                          child: ElevatedButton(
                              onPressed: () =>
                                  const Popup(Column(
                                    mainAxisSize: MainAxisSize.min,
                                    children: [
                                      Text('Bottom Sheet'),
                                      TextField(),
                                    ],
                                  ))
                                      .all10
                                      .icHandle
                                      .back
                                      .close
                                      .showSheet(context),
                              child: const Text('Bottom Sheet')),
                        ),
                        Expanded(
                          child: ElevatedButton(
                              onPressed: () =>
                                  PopupActionSheet
                                      .build(
                                    const [
                                      Text('Item 1'),
                                      Text('Item 2'),
                                      Text('Item 3'),
                                    ],
                                  )
                                      .copyWith(
                                    outPadding: const EdgeInsets.all(20.0),
                                    inPadding:
                                    const EdgeInsets.only(bottom: 20.0),
                                  )
                                      .close
                                      .showAction(context),
                              child: const Text('Action Sheet')),
                        ),
                        Expanded(
                          child: ElevatedButton(
                              onPressed: () =>
                                  const Popup(Text('Dialog'))
                                      .all10
                                      .close
                                      .showDialog(context),
                              child: const Text('Dialog')),
                        ),
                      ],
                    )),
          ),
        ),
      ),
    ));
copied to clipboard
0
likes
160
points
164
downloads

Publisher

verified publisherhunghv.com

Weekly Downloads

2024.09.28 - 2025.04.12

A Flutter library that the creation of basic popup UIs such as dialogs, bottom sheets, selection sheets, etc.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, flutter_svg

More

Packages that depend on popup_build