Skip to content

Commit

Permalink
Added guidelines Functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
SayedZeeshanHyder committed Jul 8, 2024
1 parent c50b05b commit 60092e9
Show file tree
Hide file tree
Showing 4 changed files with 203 additions and 4 deletions.
154 changes: 154 additions & 0 deletions lib/new_ui/screens/guidelines_screen/guidelinesscreen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
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';

class GuideLinesScreen extends StatefulWidget {
@override
State<GuideLinesScreen> createState() => _GuideLinesScreenState();
}

class _GuideLinesScreenState extends State<GuideLinesScreen> {
List guideLines = [];
List faqs = [];

@override
void initState() {
super.initState();
setGuidelines();
}

setGuidelines() {
FirebaseFirestore.instance
.collection("Guidelines")
.doc("Guidelines")
.get()
.then((value) {
setState(() {
faqs = value.data()!['faqs'];
guideLines = value.data()!['guidelines'];
});
});
}

@override
Widget build(BuildContext context) {
Size size = MediaQuery.of(context).size;
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
foregroundColor: Colors.white,
),
body: guideLines.isNotEmpty && faqs.isNotEmpty
? SingleChildScrollView(
child: Column(
children: [
SizedBox(
height: size.height * 0.02,
),
Container(
width: size.width * 0.85,
child: Text(
"Guidelines",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w700,
fontSize: 25),
),
),
SizedBox(
height: size.height * 0.01,
),
ListView.builder(
padding: EdgeInsets.zero,
itemCount: guideLines.length,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
Map<String, dynamic> guideline = guideLines[index];
if (guideline.containsKey("text")) {
return Padding(
padding: const EdgeInsets.symmetric(
horizontal: 30, vertical: 10),
child: Text(
"- This would be a point from the Guidelines therefore Tryign to make it long so that it could be checked for overflow",
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,
),
Container(
width: size.width * 0.85,
child: Text(
"FAQ",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w700,
fontSize: 25),
),
),
SizedBox(
height: size.height * 0.01,
),
ListView.builder(
padding: EdgeInsets.zero,
itemCount: faqs.length,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
Map<String,dynamic> faq = faqs[index];
return FAQCard(faqContent: faq["content"],faqTitle: faq["title"],);
}),
SizedBox(
height: size.height * 0.03,
),
],
),
)
: const Center(
child: CircularProgressIndicator(),
),
);
}
}

class ViewImage extends StatelessWidget {
final int index;

ViewImage({required this.index});

@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Hero(
tag: "pic$index",
child: Container(
margin: EdgeInsets.symmetric(horizontal: 5, vertical: 5),
decoration: BoxDecoration(
image: DecorationImage(
image: NetworkImage(
"https://i.pinimg.com/564x/98/24/71/982471c8a222007297475323a0c4f5f9.jpg"),
fit: BoxFit.fitWidth),
),
),
),
),
);
}
}
37 changes: 37 additions & 0 deletions lib/new_ui/screens/guidelines_screen/widgets/FAQCard.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import 'package:flutter/material.dart';

class FAQCard extends StatelessWidget {
final faqTitle;
final faqContent;

FAQCard({required this.faqContent,required this.faqTitle});

@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 10,vertical: 7),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.white),
),
child: Theme(
data: ThemeData().copyWith(dividerColor: Colors.transparent),
child: ExpansionTile(
expandedCrossAxisAlignment: CrossAxisAlignment.start,
expandedAlignment: Alignment.centerLeft,
iconColor: Colors.white,
collapsedIconColor: Colors.white,
collapsedTextColor: Colors.white,
textColor: Colors.white,
title: Text(faqTitle),
children: [
Padding(
padding: const EdgeInsets.all(15.0),
child: Text(faqContent,style: TextStyle(color: Colors.white),),
),
],
),
),
);
}
}
14 changes: 11 additions & 3 deletions lib/new_ui/screens/railway_screen/railway_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'package:tsec_app/models/concession_details_model/concession_details_mode
import 'package:tsec_app/models/concession_request_model/concession_request_model.dart';
// import 'package:tsec_app/models/concession_request_model/concession_request_model.dart';
import 'package:tsec_app/models/student_model/student_model.dart';
import 'package:tsec_app/new_ui/screens/guidelines_screen/guidelinesscreen.dart';
import 'package:tsec_app/new_ui/screens/railway_screen/railwayform.dart';
import 'package:tsec_app/new_ui/screens/railway_screen/widgets/concession_status_modal.dart';
import 'package:tsec_app/new_ui/screens/railway_screen/widgets/railway_dropdown_search.dart';
Expand Down Expand Up @@ -474,7 +475,7 @@ class _RailwayConcessionScreenState
return false;
}
}
print(concessionRequestData);
print("Inside Build = ${concessionRequestData?.toJson()}");
return currState != ""
? Center(
child: Column(
Expand Down Expand Up @@ -645,15 +646,22 @@ class _RailwayConcessionScreenState
SizedBox(
height: 15,
),
Text(
/*Text(
"Pass collected on ${DateFormat('dd/MM/yyyy').format((concessionRequestData.passCollected!['date'] as Timestamp).toDate())}",
style: TextStyle(fontSize: 13, color: Colors.grey),
),
),*/
],


],
),
),

SizedBox(
height: 15,
),
InkWell(onTap: ()=> Navigator.push(context, MaterialPageRoute(builder: (context)=> GuideLinesScreen(),),),child: Text("View Guidelines",style: TextStyle(color: Colors.white),),),

],
),
)
Expand Down
2 changes: 1 addition & 1 deletion lib/services/concession_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class ConcessionService {
if (value.exists) {
print("Concession Request Present");
var detailsMap = value.data() as Map<String, dynamic>;
print(detailsMap);
print("Deatils Map = ${detailsMap}");
ConcessionRequestModel concessionRequestData =
ConcessionRequestModel.fromJson(detailsMap);
print("Concession Request Data Got = ${concessionRequestData.toJson()}");
Expand Down

0 comments on commit 60092e9

Please sign in to comment.