2023-05-26 21:21:16 +00:00
|
|
|
/*
|
|
|
|
* This file is part of Stack Wallet.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2023 Cypher Stack
|
|
|
|
* All Rights Reserved.
|
|
|
|
* The code is distributed under GPLv3 license, see LICENSE file for details.
|
|
|
|
* Generated by Cypher Stack on 2023-05-26
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2023-03-13 20:37:05 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2024-05-23 00:37:06 +00:00
|
|
|
import '../utilities/constants.dart';
|
|
|
|
import 'conditional_parent.dart';
|
2022-08-26 08:11:35 +00:00
|
|
|
|
|
|
|
class RoundedContainer extends StatelessWidget {
|
|
|
|
const RoundedContainer({
|
2024-05-27 23:56:22 +00:00
|
|
|
super.key,
|
2022-08-26 08:11:35 +00:00
|
|
|
this.child,
|
|
|
|
required this.color,
|
|
|
|
this.padding = const EdgeInsets.all(12),
|
2022-09-16 23:54:46 +00:00
|
|
|
this.radiusMultiplier = 1.0,
|
2022-09-18 17:27:38 +00:00
|
|
|
this.width,
|
|
|
|
this.height,
|
2022-10-10 03:36:43 +00:00
|
|
|
this.borderColor,
|
2023-04-04 02:19:18 +00:00
|
|
|
this.hoverColor,
|
2023-02-02 21:37:59 +00:00
|
|
|
this.boxShadow,
|
2023-03-13 20:37:05 +00:00
|
|
|
this.onPressed,
|
2024-05-27 23:56:22 +00:00
|
|
|
});
|
2022-08-26 08:11:35 +00:00
|
|
|
|
|
|
|
final Widget? child;
|
|
|
|
final Color color;
|
|
|
|
final EdgeInsets padding;
|
2022-09-16 23:54:46 +00:00
|
|
|
final double radiusMultiplier;
|
2022-09-18 17:27:38 +00:00
|
|
|
final double? width;
|
|
|
|
final double? height;
|
2022-10-10 03:36:43 +00:00
|
|
|
final Color? borderColor;
|
2023-04-04 02:19:18 +00:00
|
|
|
final Color? hoverColor;
|
2023-02-02 21:37:59 +00:00
|
|
|
final List<BoxShadow>? boxShadow;
|
2023-03-13 20:37:05 +00:00
|
|
|
final VoidCallback? onPressed;
|
2022-08-26 08:11:35 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-03-13 20:37:05 +00:00
|
|
|
return ConditionalParent(
|
|
|
|
condition: onPressed != null,
|
|
|
|
builder: (child) => RawMaterialButton(
|
2023-04-02 19:48:14 +00:00
|
|
|
fillColor: color,
|
2023-04-04 02:19:18 +00:00
|
|
|
hoverColor: hoverColor,
|
2023-04-02 19:48:14 +00:00
|
|
|
elevation: 0,
|
|
|
|
highlightElevation: 0,
|
|
|
|
disabledElevation: 0,
|
|
|
|
hoverElevation: 0,
|
|
|
|
focusElevation: 0,
|
2023-03-13 20:37:05 +00:00
|
|
|
padding: const EdgeInsets.all(0),
|
|
|
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
Constants.size.circularBorderRadius * radiusMultiplier,
|
|
|
|
),
|
2023-05-15 21:33:32 +00:00
|
|
|
side: borderColor == null
|
|
|
|
? BorderSide.none
|
|
|
|
: BorderSide(
|
|
|
|
color: borderColor!,
|
|
|
|
width: 1.2,
|
|
|
|
),
|
2022-08-26 08:11:35 +00:00
|
|
|
),
|
2023-03-13 20:37:05 +00:00
|
|
|
onPressed: onPressed,
|
2022-08-26 08:11:35 +00:00
|
|
|
child: child,
|
|
|
|
),
|
2023-03-13 20:37:05 +00:00
|
|
|
child: Container(
|
|
|
|
width: width,
|
|
|
|
height: height,
|
|
|
|
decoration: BoxDecoration(
|
2023-04-02 19:48:14 +00:00
|
|
|
color: onPressed != null ? Colors.transparent : color,
|
2023-03-13 20:37:05 +00:00
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
Constants.size.circularBorderRadius * radiusMultiplier,
|
|
|
|
),
|
|
|
|
border: borderColor == null ? null : Border.all(color: borderColor!),
|
|
|
|
boxShadow: boxShadow,
|
|
|
|
),
|
|
|
|
child: Padding(
|
|
|
|
padding: padding,
|
|
|
|
child: child,
|
|
|
|
),
|
|
|
|
),
|
2022-08-26 08:11:35 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|