You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
diplomatic-quarter/lib/widgets/card/rounded_container.dart

91 lines
3.1 KiB
Dart

import 'package:diplomaticquarterapp/uitl/utils_new.dart';
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? 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<RoundedContainer> {
@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: Container(
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),
// ),
decoration: cardRadius(widget.raduis,color: widget.backgroundColor,elevation: 3),
child: widget.child,
));
}
}