0 purchases
popup box
popup_box Flutter #
Table of Contents #
Importing the dependency
Parameters
Making a button
3.1 Starter declaration
3.2 Making the Text
3.2 Putting together the code
Importing the dependency #
pubsec.yaml
dependencies:
popup_box:
copied to clipboard
*.dart
import 'package:popup_box/popup_box.dart';
copied to clipboard
Parameters #
@required BuildContext context
@required Widget willDisplayWidget
@required Widget button
Usage with an example #
Starter declaration #
floatingActionButton: FloatingActionButton(
onPressed: () async {
await PopupBox.showPopupBox()}
copied to clipboard
Making a button #
floatingActionButton: FloatingActionButton(
onPressed: () async {
await PopupBox.showPopupBox(
context: context,
button: MaterialButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
color: Colors.blue,
child: Text(
'Ok',
style: TextStyle(fontSize: 20),
),
onPressed: () {
Navigator.of(context).pop();
},
),
copied to clipboard
Making the Text #
willDisplayWidget: Column(
children: <Widget>[
Text(
'Hi',
style: TextStyle(fontSize: 40, color: Colors.black),
),
SizedBox(
height: 30,
)
],
));
copied to clipboard
Putting together the code #
floatingActionButton: FloatingActionButton(
onPressed: () async {
await PopupBox.showPopupBox(
context: context,
button: MaterialButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
color: Colors.blue,
child: Text(
'Ok',
style: TextStyle(fontSize: 20),
),
onPressed: () {
Navigator.of(context).pop();
},
),
willDisplayWidget: Column(
children: <Widget>[
Text(
'Hi',
style: TextStyle(fontSize: 40, color: Colors.black),
),
SizedBox(
height: 30,
)
],
));
},)
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.