comunes-flutter/lib/widgets/roundedButton.dart
vjrj 51fe8c6431 refactor: linting de widgets de layout y utilidades
Ajustes de estilo/linting en los helpers centered* de layout,
appIntroPage, roundedButton, secretLoader y utils (refactor pendiente).
2026-07-12 23:26:43 +02:00

68 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
class RoundedBtn extends StatelessWidget {
static const btnRadius = Radius.circular(90.0);
final IconData icon;
final String text;
final Color backColor;
final Color fontColor;
final TextStyle textStyle;
final VoidCallback onPressed;
const RoundedBtn({
required this.icon,
required this.text,
required this.onPressed,
required this.backColor,
this.textStyle = const TextStyle(fontSize: 20.0, color: Colors.white),
this.fontColor = Colors.white,
});
factory RoundedBtn.nav({
required IconData icon,
required String text,
required BuildContext context,
required String route,
required Color backColor,
TextStyle textStyle = const TextStyle(fontSize: 20.0, color: Colors.white),
Color fontColor = Colors.white,
}) {
return RoundedBtn(
icon: icon,
text: text,
onPressed: () {
Navigator.pushNamed(context, route);
},
backColor: backColor,
textStyle: textStyle,
fontColor: fontColor,
);
}
@override
Widget build(BuildContext context) {
return SizedBox(
child: ElevatedButton(
onPressed: onPressed,
style: ElevatedButton.styleFrom(
backgroundColor: backColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(btnRadius),
),
),
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(icon, size: 32.0, color: fontColor),
const SizedBox(width: 10.0),
Text(text, style: textStyle),
],
),
),
),
);
}
}