Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat questionare #2

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
201 changes: 201 additions & 0 deletions assets/questionnaires/satisfaction_with_life_scale.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
{
"name": "Satisfaction with Life Scale",
"instructions": "Please indicate your agreement or disagreement with the following statement. Please be open and honest in your responding.",
"questions": [
{
"text": "In most ways my life is close to my ideal.",
"answers": [
{
"text": "Strongly agree",
"score": 7
},
{
"text": "Agree",
"score": 6
},
{
"text": "Slightly agree",
"score": 5
},
{
"text": "Neither agree nor disagree",
"score": 4
},
{
"text": "Slightly disagree",
"score": 3
},
{
"text": "Disagree",
"score": 2
},
{
"text": "Strongly disagree",
"score": 1
}
]
},
{
"text": "The conditions of my life are excellent.",
"answers": [
{
"text": "Strongly agree",
"score": 7
},
{
"text": "Agree",
"score": 6
},
{
"text": "Slightly agree",
"score": 5
},
{
"text": "Neither agree nor disagree",
"score": 4
},
{
"text": "Slightly disagree",
"score": 3
},
{
"text": "Disagree",
"score": 2
},
{
"text": "Strongly disagree",
"score": 1
}
]
},
{
"text": "I am satisfied with my life.",
"answers": [
{
"text": "Strongly agree",
"score": 7
},
{
"text": "Agree",
"score": 6
},
{
"text": "Slightly agree",
"score": 5
},
{
"text": "Neither agree nor disagree",
"score": 4
},
{
"text": "Slightly disagree",
"score": 3
},
{
"text": "Disagree",
"score": 2
},
{
"text": "Strongly disagree",
"score": 1
}
]
},
{
"text": "So far I have gotten the important things I want in life.",
"answers": [
{
"text": "Strongly agree",
"score": 7
},
{
"text": "Agree",
"score": 6
},
{
"text": "Slightly agree",
"score": 5
},
{
"text": "Neither agree nor disagree",
"score": 4
},
{
"text": "Slightly disagree",
"score": 3
},
{
"text": "Disagree",
"score": 2
},
{
"text": "Strongly disagree",
"score": 1
}
]
},
{
"text": "If I could live my life over, I would change almost nothing.",
"answers": [
{
"text": "Strongly agree",
"score": 7
},
{
"text": "Agree",
"score": 6
},
{
"text": "Slightly agree",
"score": 5
},
{
"text": "Neither agree nor disagree",
"score": 4
},
{
"text": "Slightly disagree",
"score": 3
},
{
"text": "Disagree",
"score": 2
},
{
"text": "Strongly disagree",
"score": 1
}
]
}
],
"interpretations": [
{
"score": 31,
"text": "Extremely satisfied"
},
{
"score": 26,
"text": "Satisfied"
},
{
"score": 21,
"text": "Slightly satisfied"
},
{
"score": 20,
"text": "Neutral"
},
{
"score": 15,
"text": "Slightly dissatisfied"
},
{
"score": 10,
"text": "Dissatisfied"
},
{
"score": 5,
"text": "Extremely dissatisfied"
}
]
}
8 changes: 8 additions & 0 deletions lib/CustomIcons.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import 'package:flutter/material.dart';

class CustomIcons {
static const IconData twitter = IconData(0xe900, fontFamily: 'CustomIcons');
static const IconData facebook = IconData(0xe901, fontFamily: 'CustomIcons');
static const IconData googlePlus = IconData(0xe902, fontFamily: 'CustomIcons');
static const IconData linkedin = IconData(0xe903, fontFamily: 'CustomIcons');
}
2 changes: 1 addition & 1 deletion lib/design_course/home_design_course.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:navft/design_course/popular_course_list_view.dart';
import 'package:navft/screens/popular_course_list_view.dart';
import '../main.dart';
import 'design_course_app_theme.dart';

Expand Down
42 changes: 38 additions & 4 deletions lib/design_course/popular_course_list_view.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:navft/enums/questionnaire_type.dart';
import 'package:navft/models/answer.dart';
import 'package:navft/models/interpretation.dart';
import 'package:navft/models/question.dart';
import 'package:navft/models/questionnaire.dart';
import 'package:navft/screens/questionnaire_screen.dart';
import 'package:navft/services/questionnaire_service.dart';

import '../main.dart';
import 'design_course_app_theme.dart';
import 'models/category.dart';

import "package:navft/models/category.dart";
class PopularCourseListView extends StatefulWidget {
const PopularCourseListView({Key key, this.callBack}) : super(key: key);

Expand All @@ -27,6 +36,7 @@ class _PopularCourseListViewState extends State<PopularCourseListView>
return true;
}


@override
Widget build(BuildContext context) {
return Padding(
Expand All @@ -48,9 +58,11 @@ class _PopularCourseListViewState extends State<PopularCourseListView>
final Animation<double> animation =
Tween<double>(begin: 0.0, end: 1.0).animate(
CurvedAnimation(

parent: animationController,
curve: Interval((1 / count) * index, 1.0,
curve: Curves.fastOutSlowIn),

),
);
animationController.forward();
Expand All @@ -62,8 +74,11 @@ class _PopularCourseListViewState extends State<PopularCourseListView>
animation: animation,
animationController: animationController,
);

},

),

gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 32.0,
Expand All @@ -84,14 +99,15 @@ class CategoryView extends StatelessWidget {
this.category,
this.animationController,
this.animation,
this.callback})
this.callback,})
: super(key: key);

final VoidCallback callback;
final Category category;
final AnimationController animationController;
final Animation<dynamic> animation;


@override
Widget build(BuildContext context) {
return AnimatedBuilder(
Expand All @@ -105,7 +121,25 @@ class CategoryView extends StatelessWidget {
child: InkWell(
splashColor: Colors.transparent,
onTap: () {
callback();
if(this.category.title=="Pending Inspections List")
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) =>
QuestionnaireScreen(
questionnaire: Questionnaire(
name: "Pending Test", interpretations: [
Interpretation(score: 1, text: "Test Passed")
], questions: [
Question(text: "Is the test done properly", answers: [Answer(score: 0 ,text: "No"),Answer(score: 1 ,text: "Yes")]),
Question(text: "Is the test done properly", answers: [Answer(score: 0 ,text: "No"),Answer(score: 1 ,text: "Yes")]),
Question(text: "Is the test done properly", answers: [Answer(score: 0 ,text: "No"),Answer(score: 1 ,text: "Yes")]),
Question(text: "Is the test done properly", answers: [Answer(score: 0 ,text: "No"),Answer(score: 1 ,text: "Yes")]),
Question(text: "Is the test done properly", answers: [Answer(score: 0 ,text: "No"),Answer(score: 1 ,text: "Yes")]),
], instructions: "Please select the right options"
)
),
),
);
},
child: SizedBox(
height: 280,
Expand Down
3 changes: 3 additions & 0 deletions lib/enums/questionnaire_type.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
enum QuestionnaireType {
satisfaction,
}
4 changes: 2 additions & 2 deletions lib/login/login.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../design_course/home_design_course.dart';
import './Widgets/FormCard.dart';
import 'package:navft/screens/home_design_course.dart';
import '../widgets/FormCard.dart';

class Login extends StatefulWidget {
@override
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'app_theme.dart';
import 'login/login.dart';
import 'screens/login.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand Down
24 changes: 24 additions & 0 deletions lib/models/answer.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import 'package:meta/meta.dart';

class Answer {
final int score;
final String text;

Answer({
@required this.score,
@required this.text,
});

factory Answer.fromJson(Map<String, dynamic> json) => Answer(
score: json['score'],
text: json['text'],
);

Map<String, dynamic> toJson() => {
'score': score,
'text': text,
};

@override
String toString() => toJson().toString();
}
29 changes: 29 additions & 0 deletions lib/models/category.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
class Category {
Category({
this.title = '',
this.imagePath = '',
});

String title;
int lessonCount;
String imagePath;

static List<Category> popularCourseList = <Category>[
Category(
imagePath: 'assets/design_course/interFace3.png',
title: 'Register new Vehicle Manually',
),
Category(
imagePath: 'assets/design_course/interFace4.png',
title: 'Register New Vehicle Via Image',
),
Category(
imagePath: 'assets/design_course/interFace3.png',
title: 'Pending Inspections List',
),
Category(
imagePath: 'assets/design_course/interFace4.png',
title: 'Completed Inspections List',
),
];
}
Loading