feat : Replace tab system

This commit is contained in:
Yaël Perret
2025-09-02 20:38:21 +02:00
parent 1dfb5bd121
commit 434dad4ef8

View File

@@ -25,7 +25,9 @@ class EventDetailsView extends StackedView<EventDetailsViewModel> {
length: 2,
child: Scaffold(
backgroundColor: Colors.white,
body: SingleChildScrollView(
body: NestedScrollView(
headerSliverBuilder: (context, innerBoxIsScrolled) => [
SliverToBoxAdapter(
child: Column(
children: [
Container(
@@ -39,7 +41,7 @@ class EventDetailsView extends StackedView<EventDetailsViewModel> {
),
Container(
color: Colors.white,
padding: const EdgeInsets.all(16.0),
padding: const EdgeInsets.only(left: 16.0, right: 16.0, top: 16.0, bottom: 0.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -47,18 +49,17 @@ class EventDetailsView extends StackedView<EventDetailsViewModel> {
Text(
'Disc\'Octonelle 2',
style: Theme.of(context).textTheme.headlineLarge?.copyWith(
color: Colors.black
color: Colors.black,
),
),
const SizedBox(height: 16),
Center(
child: Container(
width: MediaQuery.of(context).size.width * 0.8,
child: Table(
columnWidths: const {
0: FixedColumnWidth(80.0), // Largeur fixe pour les icônes
1: FlexColumnWidth(), // Prend l'espace restant
0: FixedColumnWidth(80.0),
1: FlexColumnWidth(),
},
children: [
// Date
@@ -179,9 +180,7 @@ class EventDetailsView extends StackedView<EventDetailsViewModel> {
),
),
),
const SizedBox(height: 16),
// TabBar
TabBar(
tabs: const [
@@ -199,47 +198,50 @@ class EventDetailsView extends StackedView<EventDetailsViewModel> {
viewModel.setSelectedTab(index);
},
),
],
),
),
// Contenu des onglets basé sur l'index sélectionné
],
),
),
],
body: TabBarView(
children: [
// Tab 1: Publications
Container(
color: const Color(0xFFEFF0FF),
child: ListView.builder(
padding: const EdgeInsets.all(16.0),
child: viewModel.selectedTabIndex == 0
? Column(
mainAxisSize: MainAxisSize.min,
children: List.generate(10, (index) {
itemCount: 10,
itemBuilder: (context, index) {
return PostCardWidget(
title: 'Publication ${index + 1}',
content: 'Voici le contenu de la publication ${index + 1}. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
authorName: 'L\'Octonelle',
authorImageUrl: '', // URL vide pour utiliser l'icône par défaut
authorImageUrl: '',
publishDate: DateTime.now().subtract(Duration(days: index)),
imageUrls: index % 3 == 0 ? ['assets/images/Affiche.jpg'] : null,
likesCount: (index + 1) * 5,
commentsCount: (index + 1) * 2,
aspectRatio: 4/5,
onLike: () {
// Action lors du clic sur "J'aime"
print('Like publication ${index + 1}');
},
onComment: () {
// Action lors du clic sur "Commenter"
print('Comment publication ${index + 1}');
},
onShare: () {
// Action lors du clic sur "Partager"
print('Share publication ${index + 1}');
},
);
}),
)
: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
},
),
),
// Tab 2: À propos
Container(
color: const Color(0xFFEFF0FF),
child: ListView(
padding: const EdgeInsets.all(16.0),
children: [
Text(
'À propos de L\'Octonelle',
@@ -253,7 +255,6 @@ class EventDetailsView extends StackedView<EventDetailsViewModel> {
'Description détaillée de l\'organisation L\'Octonelle et de ses activités...',
style: TextStyle(color: Colors.black87),
),
// Contenu supplémentaire pour tester le scroll
...List.generate(20, (index) => Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Text('Ligne de contenu ${index + 1}'),