1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- import 'package:flutter/material.dart';
- class RoundedButton extends StatelessWidget {
- final VoidCallback? press;
- final String? title;
- final double? width;
- final double? height;
- final BorderRadius borderRadius;
- final Color borderColor;
- final Color color;
- final Color textColor;
- const RoundedButton({
- Key? key,
- this.press,
- this.title,
- this.width,
- this.height,
- this.borderRadius = BorderRadius.zero,
- this.borderColor = Colors.transparent,
- this.color = Colors.transparent,
- this.textColor = Colors.white,
- }) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return ConstrainedBox(
- constraints: BoxConstraints(
- minWidth: 100,
- maxWidth: width ?? double.infinity,
- minHeight: 50,
- maxHeight: height ?? 60,
- ),
- child: Container(
- margin: const EdgeInsets.symmetric(vertical: 10),
- decoration: BoxDecoration(
- border: Border.all(color: borderColor),
- borderRadius: borderRadius,
- color: color,
- ),
- child: SizedBox.expand(
- child: TextButton(
- child: Text(title ?? '', style: TextStyle(color: textColor)),
- onPressed: press,
- ),
- ),
- ),
- );
- }
- }
|