feat : New listing + MainView

This commit is contained in:
Yaël Perret
2025-06-27 09:04:37 +02:00
parent 2b143bd884
commit 9a328ec9d8
55 changed files with 1036 additions and 615 deletions

View File

@@ -1,13 +1,12 @@
import 'package:bahla_front/ui/common/images.dart';
import 'package:flutter/material.dart';
import 'package:stacked/stacked.dart';
import 'package:bahla_front/ui/common/app_colors.dart';
import 'package:bahla_front/ui/common/ui_helpers.dart';
import 'package:intl/intl.dart';
import 'home_viewmodel.dart';
class HomeView extends StackedView<HomeViewModel> {
const HomeView({Key? key}) : super(key: key);
@override
Widget builder(
@@ -16,42 +15,113 @@ class HomeView extends StackedView<HomeViewModel> {
Widget? child,
) {
return Scaffold(
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 25.0),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
children: [
Image(
image: AssetImage(Images.ExempleAffiche),
height: 200,
),
],
),
Column(
children: [
Container(
child: Text(
"Disc'Octonelle 2",
style: Theme.of(context).textTheme.titleLarge,
),
),
],
)
],
)
],
backgroundColor: Theme.of(context).colorScheme.background,
body: ListView.builder(
itemCount: viewModel.events.length,
itemBuilder: (context, index) {
return Container(
margin: const EdgeInsets.all(8),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary,
borderRadius: BorderRadius.circular(8),
),
),
child:
IntrinsicHeight(
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Flexible(
flex: 1,
child: AspectRatio(
aspectRatio: 1,
child: Container(
margin: const EdgeInsets.only(right: 16),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
bottomLeft: Radius.circular(8),
),
image: DecorationImage(
image: AssetImage(viewModel.events[index].picture),
fit: BoxFit.cover,
),
),
),
),
),
Expanded(
flex: 2,
child:
Container(
margin: const EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
viewModel.events[index].date != null
? DateFormat.yMMMMd(Localizations.localeOf(context).toString())
.format(viewModel.events[index].date!)
: 'No date',
style: Theme.of(context).textTheme.titleMedium,
),
Text(
viewModel.events[index].name,
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
IconButton(
icon: const Icon(Icons.favorite_border),
onPressed: () {
// Handle more options
},
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
viewModel.events[index].organizer,
style: Theme.of(context).textTheme.bodyLarge,
),
Text(
viewModel.events[index].place ?? 'No place',
style: Theme.of(context).textTheme.bodyMedium,
),
],
),
IconButton(
icon: const Icon(Icons.place),
onPressed: () {
// Handle favorite action
},
),
],
),
const SizedBox(height: 8),
],
),
),
),
],
),
),
);
},
),
);
);
}
@override