Skip to content

Instantly share code, notes, and snippets.

@josue1dario2
Created January 11, 2023 01:02
Show Gist options
  • Save josue1dario2/1168086c09c48e6276569ba57df30d21 to your computer and use it in GitHub Desktop.
Save josue1dario2/1168086c09c48e6276569ba57df30d21 to your computer and use it in GitHub Desktop.
Generic Button Pink
class GenericButton extends StatelessWidget {
const GenericButton({
Key? key,
required this.navigator,
required this.text,
required this.sizeButton,
required this.hasIcon,
required this.ulrImage,
}) : super(key: key);
final Widget navigator;
final String text;
final double sizeButton;
final bool hasIcon;
final String ulrImage;
@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
return MaterialButton(
elevation: 0,
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => navigator),
);
},
child: Container(
decoration: BoxDecoration(
color: const Color(0xFFF6F1FB),
borderRadius: BorderRadius.circular(40.0),
),
height: size.height * 0.062,
width: sizeButton,
child: Center(
child: (hasIcon)
? Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ImageIcon(
AssetImage(ulrImage),
size: 24,
color: const Color(0xFF9356D1),
),
const SizedBox(
width: 10,
),
CustomText(
text: text,
size: 12,
weight: FontWeight.w600,
color: const Color(0xFF9356D1))
],
)
: CustomText(
text: text,
size: 12,
weight: FontWeight.w600,
color: const Color(0xFF9356D1))),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment