import 'package:flutter/material.dart'; // OWNER : Ibrahim albitar // DATE : 05-04-2020 // DESCRIPTION : Custom widget for rounded container and custom decoration class RoundedContainer extends StatefulWidget { final double width; 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; RoundedContainer( {this.child, this.width, 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, }); @override _RoundedContainerState createState() => _RoundedContainerState(); } class _RoundedContainerState extends State { @override Widget build(BuildContext context) { return Container( width: widget.width?? null, margin: EdgeInsets.all(widget.margin), decoration: widget.showBorder == true ? BoxDecoration( color: Theme.of(context).primaryColor, border: Border.all(color: Colors.red, width: 1), 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), ) : 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, )); } }