import 'package:flutter/material.dart'; class RoundedContainer extends StatefulWidget { final double width; final double height; final double raduis; final Color backgroundColor; final double margin; final double elevation; final bool showBorder; final Color borderColor; final bool customCornerRaduis; final double topLeft; final double bottomRight; final double topRight; final double bottomLeft; final Widget child; final double borderWidth; RoundedContainer( {@required this.child, this.width, this.height, this.raduis = 10, this.backgroundColor = Colors.white, this.margin = 10, this.elevation = 1, this.showBorder = false, this.borderColor = Colors.red, this.customCornerRaduis = false, this.topLeft = 0, this.topRight = 0, this.bottomRight = 0, this.bottomLeft = 0, this.borderWidth = 1}); @override _RoundedContainerState createState() => _RoundedContainerState(); } class _RoundedContainerState extends State { @override Widget build(BuildContext context) { return Container( width: widget.width, height: widget.height, margin: EdgeInsets.all(widget.margin), decoration: widget.showBorder == true ? BoxDecoration( color: Theme.of(context).primaryColor, border: Border.all( color: widget.borderColor, width: widget.borderWidth), borderRadius: widget.customCornerRaduis ? BorderRadius.only( topLeft: Radius.circular(widget.topLeft), topRight: Radius.circular(widget.topRight), bottomRight: Radius.circular(widget.bottomRight), bottomLeft: Radius.circular(widget.bottomLeft)) : BorderRadius.circular(widget.raduis), boxShadow: [ BoxShadow( color: Colors.grey.withOpacity(0.1), spreadRadius: 10, blurRadius: 5, offset: Offset(0, 5), // changes position of shadow ), ]) : null, child: Card( margin: EdgeInsets.all(0), shape: RoundedRectangleBorder( borderRadius: widget.customCornerRaduis ? BorderRadius.only( topLeft: Radius.circular(widget.topLeft), topRight: Radius.circular(widget.topRight), bottomRight: Radius.circular(widget.bottomRight), bottomLeft: Radius.circular(widget.bottomLeft)) : BorderRadius.circular(widget.raduis), ), color: widget.backgroundColor, child: widget.child, )); } }