import 'package:flutter/material.dart'; import 'package:tm_app/core/theme/colors.dart'; import 'package:tm_app/core/utils/size_config.dart'; import '../strings/tenders_strings.dart'; /// Segmented control switching between the "All" tenders list and the /// "Recommended" AI tab. class TendersTabBar extends StatelessWidget { const TendersTabBar({ required this.selectedIndex, required this.onChanged, super.key, }); /// 0 = All, 1 = Recommended. final int selectedIndex; final ValueChanged onChanged; @override Widget build(BuildContext context) { return Container( height: 44.0.h(), padding: EdgeInsets.all(4.0.h()), decoration: BoxDecoration( color: AppColors.grey0, borderRadius: BorderRadius.circular(12.0.w()), border: Border.all(color: AppColors.grey30), ), child: Row( children: [ _segment(TendersStrings.allTab, 0), _segment(TendersStrings.recommendedTab, 1), ], ), ); } Widget _segment(String label, int index) { final bool isActive = selectedIndex == index; return Expanded( child: GestureDetector( behavior: HitTestBehavior.opaque, onTap: () => onChanged(index), child: AnimatedContainer( duration: const Duration(milliseconds: 200), alignment: Alignment.center, decoration: BoxDecoration( color: isActive ? AppColors.mainBlue : Colors.transparent, borderRadius: BorderRadius.circular(8.0.w()), ), child: Text( label, style: TextStyle( fontSize: 14.0.sp(), fontWeight: FontWeight.w600, color: isActive ? AppColors.grey0 : AppColors.grey60, ), ), ), ), ); } }