todos-contra-el-fuego-mobile/lib/widgets/rounded_btn.dart
vjrj 8da3752193 Fix 23 additional lint issues to reduce from 129 to 106 issues
- Add const constructors to @immutable classes (5 issues: prefer_const_constructors_in_immutables)
- Fix nullable value casts in firesApi.dart (3 issues: cast_nullable_to_non_nullable)
- Remove redundant default argument values (2 issues: avoid_redundant_argument_values)
- Make YourLocation immutable with final fields (2 issues: avoid_equals_and_hash_code_on_mutable_classes)
- Update imports and fix formatting

Reduces lint issues from 129 to 106. APK builds successfully (146 MB).
2026-03-11 23:45:06 +01:00

70 lines
1.8 KiB
Dart

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({
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,
);
}
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: <Widget>[
Icon(icon, size: 32.0, color: fontColor),
const SizedBox(width: 10.0),
Text(text, style: textStyle),
],
),
),
),
);
}
}