Skip to content
This repository has been archived by the owner on Sep 22, 2024. It is now read-only.

Commit

Permalink
Revert "Refactored heading and section widget into separate files"
Browse files Browse the repository at this point in the history
This reverts commit 4316c90.
  • Loading branch information
MASTERAMARJEET committed Mar 8, 2021
1 parent 4316c90 commit e9e832f
Showing 1 changed file with 72 additions and 11 deletions.
83 changes: 72 additions & 11 deletions lib/details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,75 @@ import 'package:flutter/material.dart';

import './event/event_model.dart';
import './widgets/contact.dart';
import './widgets/heading.dart';
import './widgets/section.dart';

class DetailsPage extends StatelessWidget {
final EventDetail eventDetail;
DetailsPage(this.eventDetail);
@override
Widget build(BuildContext context) {
Widget sectionWidget(String title, List<String> list) {
if (list.length == 0) {
return Container();
}
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
alignment: Alignment.topLeft,
child: Text(
title,
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w500,
),
),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0,
top: 8.0,
),
child: RichText(
text: TextSpan(
style: TextStyle(
color: Colors.black,
fontSize: 14,
fontWeight: FontWeight.w400,
),
children: list.map((e) => TextSpan(text: e + '\n\n')).toList(),
),
),
),
],
);
}

Widget headingWidget(String name, String desc) {
return Column(
children: [
Text(
name,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
Text(
desc,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
),
),
SizedBox(
height: 20.0,
),
],
);
}

return Scaffold(
appBar: AppBar(
title: Center(
Expand Down Expand Up @@ -77,19 +138,19 @@ class DetailsPage extends StatelessWidget {
),
child: ListView(
children: <Widget>[
HeadingWidget(
headingWidget(
eventDetail.name ?? "", eventDetail.shortDesc ?? ""),
SectionWidget("About:", eventDetail.about ?? []),
SectionWidget("Event Details:", eventDetail.details ?? []),
SectionWidget("Prizes:", eventDetail.prize ?? []),
SectionWidget("Judging Criteria:", eventDetail.judge ?? []),
SectionWidget("Eligibility Criteria:",
sectionWidget("About:", eventDetail.about ?? []),
sectionWidget("Event Details:", eventDetail.details ?? []),
sectionWidget("Prizes:", eventDetail.prize ?? []),
sectionWidget("Judging Criteria:", eventDetail.judge ?? []),
sectionWidget("Eligibility Criteria:",
eventDetail.rules?.eligible ?? []),
SectionWidget("Participant’s Guidelines:",
sectionWidget("Participant’s Guidelines:",
eventDetail.rules?.guide ?? []),
SectionWidget(
sectionWidget(
"Submission details:", eventDetail.submission ?? []),
SectionWidget("Event timeline:", eventDetail.timeline ?? []),
sectionWidget("Event timeline:", eventDetail.timeline ?? []),
ContactWidget("Contact Details", eventDetail.contact ?? []),
],
)),
Expand Down

0 comments on commit e9e832f

Please sign in to comment.