badge_button 0.0.8 badge_button: ^0.0.8 copied to clipboard
This is a very beautiful button widget. Can you use. Uzbekistan is very beautiful country
Features #
Getting started #
Usage #
to /example
folder.
Parameters #
- final Color color (required),
- final Color textColor (required),
- final double textSize (required),
- final bool hasIcon (required),
- final String text (required),
- final String imagePath (optianal),
Source Code #
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
class BadgeButton extends StatelessWidget {
final Color color;
final Color textColor;
final double textSize;
final bool hasIcon;
final String text;
final String imagePath;
const BadgeButton({
super.key,
required this.color,
required this.hasIcon,
required this.text,
required this.textColor,
required this.textSize,
this.imagePath = "",
});
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.center,
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(20),
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
hasIcon
? Image.asset(
imagePath,
cacheHeight: 24,
cacheWidth: 24,
color: textColor,
)
: const SizedBox(),
hasIcon ? const SizedBox(width: 10) : const SizedBox(),
Text(
text,
style: GoogleFonts.inter(
color: textColor,
fontSize: textSize,
fontWeight: FontWeight.normal,
),
),
],
),
),
);
}
}