import 'package:flutter/material.dart'; /// Rounded button widget with icon and text. /// Used primarily in the active fires page. class RoundedBtn extends StatelessWidget { const RoundedBtn({ super.key, 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, Key? key, TextStyle textStyle = const TextStyle(fontSize: 20.0, color: Colors.white), Color fontColor = Colors.white, }) { return RoundedBtn( key: key, icon: icon, text: text, onPressed: () { Navigator.pushNamed(context, route); }, backColor: backColor, textStyle: textStyle, fontColor: fontColor, ); } static const Radius btnRadius = Radius.circular(90.0); final IconData icon; final String text; final Color backColor; final Color fontColor; final TextStyle textStyle; final VoidCallback onPressed; @override Widget build(BuildContext context) { return SizedBox( child: ElevatedButton( onPressed: onPressed, style: ElevatedButton.styleFrom( backgroundColor: backColor, shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all(btnRadius), ), ), child: Padding( padding: const EdgeInsets.all(10.0), child: Row( mainAxisSize: MainAxisSize.min, children: [ Icon(icon, size: 32.0, color: fontColor), const SizedBox(width: 10.0), Text(text, style: textStyle), ], ), ), ), ); } }