import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; class MainTabButton extends StatefulWidget { final VoidCallback? onTap; final bool isRedDot; final bool selected; final String icon; final String title; final String selectedIcon; const MainTabButton({ super.key, required this.selected, required this.icon, required this.selectedIcon, this.isRedDot = false, this.onTap, required this.title }); @override State createState() => MainTabButtonState(); } class MainTabButtonState extends State { @override Widget build(BuildContext context) { if (widget.isRedDot) { return Expanded( child: GestureDetector( onTap: widget.onTap, child: Container( color: Colors.transparent, alignment: Alignment.center, child: Stack( clipBehavior: Clip.none, children: [ Column( children: [ SizedBox(height: 5.w,), widget.selected ? Image.asset(widget.selectedIcon, width: 25.w, height: 25.w) : Image.asset(widget.icon, width: 25.w, height: 25.w), Text(widget.title, style: const TextStyle( fontSize: 12 ),) ], ), ], ), ), )); } return Expanded( child: GestureDetector( onTap: widget.onTap, child: Container( alignment: Alignment.center, color: Colors.transparent, child: Column( children: [ SizedBox(height: 5.w,), widget.selected ? Image.asset(widget.selectedIcon, width: 25.w, height: 25.w) : Image.asset(widget.icon, width: 25.w, height: 25.w), Text(widget.title, style: const TextStyle( fontSize: 12 ),) ], ), ), ), ); } }