Files
tm_app/lib/views/tenders/widgets/tenders_tab_bar.dart
T
AmirReza Jamali 50e4f43738 feat: add AI recommendations flow for tenders
Implement company AI onboarding/recommendation models, services, repository, and tender UI integration with supporting tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-16 11:47:52 +03:30

65 lines
1.8 KiB
Dart

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<int> 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,
),
),
),
),
);
}
}