Created
June 15, 2019 16:33
-
-
Save onatcipli/fa4d7d9c33d07067de62241dae98b5ea to your computer and use it in GitHub Desktop.
Dart Package Medium Article
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library custom_alert_box; | |
import 'package:flutter/material.dart'; | |
class CustomAlertBox { | |
/// Bu şekilde döküman yorumları oluşturabilirsiniz kullanan kişiler için faydalı olur. | |
static Future showCustomAlertBox({ | |
@required BuildContext context, | |
@required Widget willDisplayWidget, | |
}) { | |
assert(context != null, "context is null!!"); | |
assert(willDisplayWidget != null, "willDisplayWidget is null!!"); | |
return showDialog( | |
context: context, | |
builder: (context) { | |
return AlertDialog( | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.all(Radius.circular(15)), | |
), | |
content: Column( | |
mainAxisSize: MainAxisSize.min, | |
children: <Widget>[ | |
willDisplayWidget, | |
MaterialButton( | |
color: Colors.white30, | |
child: Text('close alert'), | |
onPressed: () { | |
Navigator.of(context).pop(); | |
}, | |
) | |
], | |
), | |
elevation: 10, | |
); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment