Improve Detail View

This commit is contained in:
2026-03-06 23:48:48 +01:00
parent f1a72e9817
commit 89e6d6cd83
2 changed files with 126 additions and 9 deletions

View File

@@ -44,20 +44,112 @@ class _TournamentDetailPageState extends State<TournamentDetailPage> {
),
Builder(
builder: (context) {
// Demo Content
if (isShowingTeams) {
return Text("Teams");
return TournamentTeamsWidget(tournament: widget.tournament);
}
return Text("Not Teams");
return TournamentContentWidget(tournament: widget.tournament);
},
),
SizedBox(
width: double.infinity,
child: Padding(
padding: const EdgeInsets.fromLTRB(12, 0, 12, 24),
child: ElevatedButton(
child: Text("Enter"),
onPressed: () {
//TODO: Backend Call
ScaffoldMessenger.of(context).clearSnackBars();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("tournament entered")),
);
},
),
),
),
],
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.dashboard_customize_rounded),
onPressed: () {
print("Tournament entered");
},
);
}
}
class TournamentTeamsWidget extends StatelessWidget{
const TournamentTeamsWidget({super.key, required Tournament tournament});
@override
Widget build(BuildContext context) {
return Expanded(
child: Column( children: [
//TODO: Show participating Teams
Text("Teams"),
],),
);
}
}
class TournamentContentWidget extends StatelessWidget {
final Tournament tournament;
const TournamentContentWidget({super.key, required this.tournament});
@override
Widget build(BuildContext context) {
return Expanded(
child: Column(
children: [
SizedBox(height: 12),
Center(
child: Text(tournament.description, style: TextStyle(fontSize: 17)),
),
SizedBox(height: 12),
Card.filled(
child: SizedBox(
width: double.infinity,
height: 225,
child: Padding(
padding: const EdgeInsets.fromLTRB(14, 18, 14, 14),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Registration Period",
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 17,
),
),
Text(
"${tournament.registrationStartDate} - ${tournament.registrationEndDate}",
),
SizedBox(height: 24),
Text(
"Format",
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 17,
),
),
//TODO: Should show the format instead
Text(tournament.description),
Spacer(),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: () {
//TODO: Redirect to Ongoing View
ScaffoldMessenger.of(context).clearSnackBars();
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text("ongoing clicked")),
);
},
child: Text("View ongoing"),
),
),
],
),
),
),
),
],
),
);
}
@@ -85,7 +177,7 @@ class DetailHeader extends StatelessWidget {
),
image: DecorationImage(
fit: BoxFit.cover,
// Currently a demo image
//TODO: Replace with proper image
image: NetworkImage(
"https://flutter.dev/assets/image_1.w635.f71cbb614cd16a40bfb87e128278227c.png",
),