df02cff668
- Renamed BottomNavigation to TenderBottomNavigation for clarity. - Updated TendersScreen to use TenderBottomNavigation. - Converted TendersScreen from StatelessWidget to StatefulWidget to manage tab state. - Added TabController for handling tab changes and improved layout with SafeArea and PageView.
85 lines
2.4 KiB
Dart
85 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../../common/widgets/bottom_navigation.dart';
|
|
import '../../core/constants/colors.dart';
|
|
import '../../core/utils/size_config.dart';
|
|
import 'models/tender_model.dart';
|
|
import 'widgets/widgets.dart';
|
|
|
|
class TendersScreen extends StatefulWidget {
|
|
const TendersScreen({super.key});
|
|
|
|
@override
|
|
State<TendersScreen> createState() => _TendersScreenState();
|
|
}
|
|
|
|
class _TendersScreenState extends State<TendersScreen>
|
|
with SingleTickerProviderStateMixin {
|
|
late final TabController controller;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
controller = TabController(length: 2, vsync: this);
|
|
// Add listener to rebuild when tab changes
|
|
controller.addListener(() {
|
|
setState(() {});
|
|
});
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
controller.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
backgroundColor: AppColors.backgroundColor,
|
|
bottomNavigationBar: TenderBottomNavigation(),
|
|
body: SafeArea(
|
|
child: SingleChildScrollView(
|
|
child: Padding(
|
|
padding: EdgeInsets.symmetric(
|
|
horizontal: 24.0.w(),
|
|
vertical: 24.0.h(),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
TenderAppBar(),
|
|
SizedBox(height: 24.0.h()),
|
|
|
|
MainTabBar(controller: controller),
|
|
SizedBox(height: 24.0.h()),
|
|
SizedBox(
|
|
width: double.infinity,
|
|
height: 762.0.h(),
|
|
child: PageView.builder(
|
|
scrollDirection: Axis.horizontal,
|
|
itemCount: sampleTenders.length,
|
|
itemBuilder: (context, index) {
|
|
final tender = sampleTenders[index];
|
|
|
|
return TenderCard(
|
|
date: tender.date,
|
|
deadline: tender.deadline,
|
|
title: tender.title,
|
|
description: tender.description,
|
|
tenderId: tender.tenderId,
|
|
location: tender.location,
|
|
country: tender.country,
|
|
matchPercentage: tender.matchPercentage,
|
|
);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|