Skip to content

Commit

Permalink
Merge pull request #142 from anotherwebguy/#38faqs
Browse files Browse the repository at this point in the history
added code for faqs screen
himanshusharma89 authored Mar 19, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 2a6c1e4 + 5a71695 commit 152c0d2
Showing 4 changed files with 179 additions and 95 deletions.
Binary file added assets/FAQ.pdf
Binary file not shown.
82 changes: 82 additions & 0 deletions lib/views/faqs_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import 'package:advance_pdf_viewer/advance_pdf_viewer.dart';
import 'package:flutter/material.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/widgets/retro_button.dart';

class FaqsScreen extends StatefulWidget {
@override
_FaqsScreenState createState() => _FaqsScreenState();
}

class _FaqsScreenState extends State<FaqsScreen> {

bool _loading=true;
PDFDocument _doc;

@override
void initState() {
// TODO: implement initState
super.initState();
loadDocument();
}

Future<void> loadDocument() async {
_doc = await PDFDocument.fromAsset('assets/FAQ.pdf');

setState(() => _loading = false);
}

Future<void> changePDF(int value) async {
setState(() => _loading = true);
if (value == 1) {
_doc = await PDFDocument.fromAsset('assets/FAQ.pdf');
} else if (value == 2) {
_doc = await PDFDocument.fromURL(
'http://conorlastowka.com/book/CitationNeededBook-Sample.pdf',
);
} else {
_doc = await PDFDocument.fromAsset('assets/FAQ.pdf');
}
setState(() => _loading = false);
}


@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: RelicColors.backgroundColor,
leading: Padding(
padding: const EdgeInsets.all(8.0),
child: GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: RetroButton(
upperColor: Colors.white,
lowerColor: Colors.black,
width: 35,
height: 35,
borderColor: Colors.white,
child: const Icon(
Icons.arrow_back,
color: Colors.black,
),
),
),
),
title: const Text('FAQs'),
elevation: 0.0,
),
body: Center(
child: _loading
? const Center(child: CircularProgressIndicator())
: PDFViewer(
document: _doc,
zoomSteps: 1,
scrollDirection: Axis.vertical,
),
),
);
}
}
191 changes: 96 additions & 95 deletions lib/views/settings.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/views/address_screen.dart';
import 'package:retro_shopping/views/faqs_screen.dart';
import 'package:retro_shopping/views/orders.dart';
import 'package:retro_shopping/widgets/retro_button.dart';
import 'package:retro_shopping/widgets/settings_item.dart';
@@ -65,102 +66,102 @@ class _SettingsState extends State<Settings> {
decoration:
const BoxDecoration(color: RelicColors.primaryColor),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
settingsItem(context, 'Your Orders',
Icons.bookmark_border_sharp,
tags: Order()),
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(context, 'Change Username/\nPassword',
Icons.person),
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(context, 'FAQs', Icons.question_answer),
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(
context, 'Manage Address', Icons.location_pin,
tags: AddressScreen()),
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(
context, 'T&C', Icons.quick_contacts_dialer),
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
Row(
children: <Widget>[
const SizedBox(
height: 70,
),
Expanded(
child: Row(
children: const <Widget>[
SizedBox(
width: 5,
),
Icon(
Icons.notifications_active,
size: 30,
color: Colors.white,
),
SizedBox(
width: 5,
),
Text('Notifications(on/off)',
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 20))
],
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
settingsItem(context, 'Your Orders',
Icons.bookmark_border_sharp,
tags: Order()),
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(context, 'Change Username/\nPassword',
Icons.person),
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(context, 'FAQs', Icons.question_answer,tags: FaqsScreen()),
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(
context, 'Manage Address', Icons.location_pin,
tags: AddressScreen()),
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(
context, 'T&C', Icons.quick_contacts_dialer),
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
Row(
children: <Widget>[
const SizedBox(
height: 70,
),
),
Switch(
value: switchedOn,
onChanged: (bool value) {
setState(() {
switchedOn = value;
});
},
activeColor: Colors.white,
activeTrackColor: Colors.black,
)
],
),
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(context, 'LogOut', Icons.logout),
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(context, 'GitHub Repo Link',
Icons.verified_user_outlined),
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
],
),
Expanded(
child: Row(
children: const <Widget>[
SizedBox(
width: 5,
),
Icon(
Icons.notifications_active,
size: 30,
color: Colors.white,
),
SizedBox(
width: 5,
),
Text('Notifications(on/off)',
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 20))
],
),
),
Switch(
value: switchedOn,
onChanged: (bool value) {
setState(() {
switchedOn = value;
});
},
activeColor: Colors.white,
activeTrackColor: Colors.black,
)
],
),
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(context, 'LogOut', Icons.logout),
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
settingsItem(context, 'GitHub Repo Link',
Icons.verified_user_outlined),
Padding(
padding:
const EdgeInsets.only(left: 16.0, right: 16.0),
child: divider(),
),
],
),
),
],
),
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -37,6 +37,7 @@ dependencies:
geocoder: 0.2.1
flutter_svg: ^0.20.0-nullsafety.3
provider: ^5.0.0
advance_pdf_viewer: ^1.2.2

dev_dependencies:
flutter_test:

0 comments on commit 152c0d2

Please sign in to comment.