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).
This commit is contained in:
parent
9b0fe987f8
commit
51fe8c6431
15 changed files with 141 additions and 126 deletions
|
|
@ -1,56 +1,68 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class RoundedBtn extends StatelessWidget {
|
||||
final btnRadius = new Radius.circular(90.0);
|
||||
static const btnRadius = Radius.circular(90.0);
|
||||
|
||||
final IconData icon;
|
||||
final String text;
|
||||
final Color backColor;
|
||||
final Color fontColor;
|
||||
final TextStyle textStyle;
|
||||
VoidCallback onPressed;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
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});
|
||||
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,
|
||||
});
|
||||
|
||||
RoundedBtn.nav(
|
||||
{@required this.icon,
|
||||
@required this.text,
|
||||
@required BuildContext context,
|
||||
@required route,
|
||||
@required this.backColor,
|
||||
this.textStyle = const TextStyle(fontSize: 20.0, color: Colors.white),
|
||||
this.fontColor = Colors.white}) {
|
||||
this.onPressed = () {
|
||||
Navigator.pushNamed(context, route);
|
||||
};
|
||||
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 new SizedBox(
|
||||
child: new RaisedButton(
|
||||
elevation: 1.0,
|
||||
color: backColor,
|
||||
child: new Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: new Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
new Icon(icon, size: 32.0, color: fontColor),
|
||||
new SizedBox(width: 10.0),
|
||||
new Text(text, style: textStyle),
|
||||
],
|
||||
),
|
||||
return SizedBox(
|
||||
child: ElevatedButton(
|
||||
onPressed: onPressed,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: backColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(btnRadius),
|
||||
),
|
||||
onPressed: onPressed,
|
||||
shape: new 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),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue