popup_build 2.1.0
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.



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