Created
August 19, 2020 09:34
-
-
Save ShaiqAhmedkhan/78bec9a4145881662c50848f08a12ffe to your computer and use it in GitHub Desktop.
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
import 'dart:ui'; | |
import 'package:custom_dialog_flutter_demo/constants.dart'; | |
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/material.dart'; | |
class CustomDialogBox extends StatefulWidget { | |
final String title, descriptions, text; | |
final Image img; | |
const CustomDialogBox({Key key, this.title, this.descriptions, this.text, this.img}) : super(key: key); | |
@override | |
_CustomDialogBoxState createState() => _CustomDialogBoxState(); | |
} | |
class _CustomDialogBoxState extends State<CustomDialogBox> { | |
@override | |
Widget build(BuildContext context) { | |
return Dialog( | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(Constants.padding), | |
), | |
elevation: 0, | |
backgroundColor: Colors.transparent, | |
child: contentBox(context), | |
); | |
} | |
contentBox(context){ | |
return Stack( | |
children: <Widget>[ | |
Container( | |
padding: EdgeInsets.only(left: Constants.padding,top: Constants.avatarRadius | |
+ Constants.padding, right: Constants.padding,bottom: Constants.padding | |
), | |
margin: EdgeInsets.only(top: Constants.avatarRadius), | |
decoration: BoxDecoration( | |
shape: BoxShape.rectangle, | |
color: Colors.white, | |
borderRadius: BorderRadius.circular(Constants.padding), | |
boxShadow: [ | |
BoxShadow(color: Colors.black,offset: Offset(0,10), | |
blurRadius: 10 | |
), | |
] | |
), | |
child: Column( | |
mainAxisSize: MainAxisSize.min, | |
children: <Widget>[ | |
Text(widget.title,style: TextStyle(fontSize: 22,fontWeight: FontWeight.w600),), | |
SizedBox(height: 15,), | |
Text(widget.descriptions,style: TextStyle(fontSize: 14),textAlign: TextAlign.center,), | |
SizedBox(height: 22,), | |
Align( | |
alignment: Alignment.bottomRight, | |
child: FlatButton( | |
onPressed: (){ | |
Navigator.of(context).pop(); | |
}, | |
child: Text(widget.text,style: TextStyle(fontSize: 18),)), | |
), | |
], | |
), | |
), | |
Positioned( | |
left: Constants.padding, | |
right: Constants.padding, | |
child: CircleAvatar( | |
backgroundColor: Colors.transparent, | |
radius: Constants.avatarRadius, | |
child: ClipRRect( | |
borderRadius: BorderRadius.all(Radius.circular(Constants.avatarRadius)), | |
child: Image.asset("assets/model.jpeg") | |
), | |
), | |
), | |
], | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment