Advertisement
hasancse1991

Untitled

Oct 1st, 2021
1,285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.23 KB | None | 0 0
  1. class VariableWidthBottomSheet extends StatelessWidget {
  2.   final Widget child;
  3.   final double widthOfSheet;
  4.   final EdgeInsetsGeometry padding;
  5.   final AlignmentGeometry align;
  6.   final Color bgColor;
  7.   final double borderRadius;
  8.  
  9.   const VariableWidthBottomSheet({
  10.     Key? key,
  11.     required this.widthOfSheet,
  12.     required this.child,
  13.     this.padding = const EdgeInsets.all(AppValues.margin),
  14.     this.align = Alignment.bottomCenter,
  15.     this.bgColor = Colors.white,
  16.     this.borderRadius = AppValues.smallRadius,
  17.   }) : super(key: key);
  18.  
  19.   @override
  20.   Widget build(BuildContext context) {
  21.     return GestureDetector(
  22.       onTap: () => Navigator.of(context).pop(),
  23.       child: Container(
  24.         width: MediaQuery.of(context).size.width,
  25.         padding: padding,
  26.         color: Colors.transparent,
  27.         child: Align(
  28.           alignment: align,
  29.           child: Container(
  30.             decoration: BoxDecoration(
  31.               color: bgColor,
  32.               borderRadius: BorderRadius.all(Radius.circular(borderRadius)),
  33.             ),
  34.             padding: const EdgeInsets.all(AppValues.smallPadding),
  35.             width: widthOfSheet,
  36.             child: child,
  37.           ),
  38.         ),
  39.       ),
  40.     );
  41.   }
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement