Skip to content

Commit

Permalink
Merge pull request #190 from CosmicRaptor/main
Browse files Browse the repository at this point in the history
added guidelines
  • Loading branch information
CosmicRaptor authored Jul 11, 2024
2 parents ce5a7bf + 6c842b4 commit 6cc42af
Show file tree
Hide file tree
Showing 2 changed files with 108 additions and 23 deletions.
49 changes: 26 additions & 23 deletions lib/new_ui/screens/guidelines_screen/guidelinesscreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:tsec_app/new_ui/screens/guidelines_screen/widgets/FAQCard.dart';
import 'package:tsec_app/new_ui/screens/guidelines_screen/widgets/guidelines_card.dart';

class GuideLinesScreen extends StatefulWidget {
@override
Expand Down Expand Up @@ -248,36 +249,38 @@ class _GuideLinesScreenState extends State<GuideLinesScreen> {
SizedBox(
height: size.height * 0.01,
),
/*ListView.builder(
ListView.builder(
padding: EdgeInsets.zero,
itemCount: guideLines.length,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
//print(guideLines[index]);
Map<String, dynamic> guideline = guideLines[index];
if (guideline.containsKey("text")) {
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 30, vertical: 10),
child: Text(
"- ${guideline["text"]}",
style: TextStyle(color: Colors.white),
),
);
} else {
return Container(
margin: EdgeInsets.symmetric(
horizontal: size.width * 0.1, vertical: 20),
height: size.height * 0.2,
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(guideline['image']),
fit: BoxFit.fill),
),
);
}
return GuidelinesCard(inputGuideline: guideline);
// if (guideline.containsKey("text")) {
// return Padding(
// padding: const EdgeInsets.symmetric(
// horizontal: 30, vertical: 10),
// child: Text(
// "- ${guideline["text"]}",
// style: TextStyle(color: Colors.white),
// ),
// );
// } else {
// return Container(
// margin: EdgeInsets.symmetric(
// horizontal: size.width * 0.1, vertical: 20),
// height: size.height * 0.2,
// decoration: BoxDecoration(
// image: DecorationImage(
// image: NetworkImage(guideline['image']),
// fit: BoxFit.fill),
// ),
// );
// }
},
),*/
),
SizedBox(
height: size.height * 0.01,
),
Expand Down
82 changes: 82 additions & 0 deletions lib/new_ui/screens/guidelines_screen/widgets/guidelines_card.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import 'package:flutter/material.dart';
import 'package:tsec_app/new_ui/colors.dart';

class GuidelinesCard extends StatelessWidget {
final Map inputGuideline;
const GuidelinesCard({super.key, required this.inputGuideline});

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Card(
color: commonbgLightblack,
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(0, 0, 0, 10),
child: Text(inputGuideline['title'], style: TextStyle(fontSize: 18, color: Colors.white, fontWeight: FontWeight.bold),),
),
if(inputGuideline['content'].runtimeType == String)
Text(inputGuideline['content'], style: TextStyle(fontSize: 14, color: Colors.white),),
if(inputGuideline.containsKey('points'))
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: inputGuideline['points'].length,
itemBuilder: (context, index) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Text(inputGuideline['points'][index], style: TextStyle(fontSize: 14, color: Colors.white),),
);
},
)
else
ListView.builder(
shrinkWrap: true,
itemCount: inputGuideline['content'].length,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
//print(inputGuideline['content'][index]);
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
//sub title and then list of points
if(inputGuideline['content'].runtimeType != String)
Text(inputGuideline['content'][index]['subtitle'], style: TextStyle(fontSize: 16, color: Colors.white, fontWeight: FontWeight.bold),),
if(inputGuideline['content'].runtimeType != String)
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: inputGuideline['content'][index]['subPoints'].length,
itemBuilder: (context, subindex){
if(inputGuideline['content'][index]['subPoints'][subindex].containsKey("words")) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
inputGuideline['content'][index]['subPoints'][subindex]["words"],
style: TextStyle(
fontSize: 12, color: Colors.white),),
);
}
else {
return Container(
child: Image.network('https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png',));
}
},
)
],
);
},
)
]

),
),
),
);
}
}

0 comments on commit 6cc42af

Please sign in to comment.