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

update dependencies and made shared appbar #19

Merged
merged 2 commits into from Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion android/build.gradle
@@ -1,5 +1,6 @@
buildscript {
ext.kotlin_version = '1.8.0'

ext.kotlin_version = '1.9.10'
repositories {
google()
mavenCentral()
Expand Down
173 changes: 81 additions & 92 deletions lib/AskOperator.dart
Expand Up @@ -3,7 +3,7 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'PDF/PdfGeneratonScreen.dart';
import 'Quiz/QuizQuestionScreen.dart';
import 'customWidget/ButtonIcon.dart';
import 'customWidget/customWidgetMethods.dart';
import 'customWidget/shared_appbar.dart';

class AskOperator extends StatelessWidget {
const AskOperator({super.key, required this.isQuiz});
Expand All @@ -14,98 +14,87 @@ class AskOperator extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: PreferredSize(
preferredSize: const Size.fromHeight(60.0),
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
),
child: const CustomAppBar(),
),
),
appBar: sharedAppBar(),
body: SafeArea(
child: SizedBox(
height: double.infinity,
child: Center(
child: SingleChildScrollView(
physics: const ScrollPhysics(parent: ScrollPhysics()),
child: Column(
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ButtonIcon(
icon: FontAwesomeIcons.plus,
function: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => isQuiz
? const QuizQuestionScreen(
icon: FontAwesomeIcons.plus,
)
: const PdfGenerationScreen(
icon: FontAwesomeIcons.plus,
operator: 'sum',
),
)),
),
ButtonIcon(
icon: FontAwesomeIcons.minus,
function: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => isQuiz
? const QuizQuestionScreen(
icon: FontAwesomeIcons.minus,
operator: 'minus',
)
: const PdfGenerationScreen(
icon: FontAwesomeIcons.minus,
operator: 'minus',
),
)),
),
],
),
const SizedBox(height: 60),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ButtonIcon(
icon: FontAwesomeIcons.xmark,
function: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => isQuiz
? const QuizQuestionScreen(
icon: FontAwesomeIcons.xmark,
operator: 'multiplication')
: const PdfGenerationScreen(
icon: FontAwesomeIcons.xmark,
operator: 'multiplication'),
)),
),
ButtonIcon(
icon: FontAwesomeIcons.divide,
function: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => isQuiz
? const QuizQuestionScreen(
icon: FontAwesomeIcons.divide,
operator: 'division',
)
: const PdfGenerationScreen(
icon: FontAwesomeIcons.divide,
operator: 'division',
),
)),
),
],
),
],
),
child: Center(
child: SingleChildScrollView(
physics: const ScrollPhysics(parent: ScrollPhysics()),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
ButtonIcon(
icon: FontAwesomeIcons.plus,
function: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => isQuiz
? const QuizQuestionScreen(
icon: FontAwesomeIcons.plus,
)
: const PdfGenerationScreen(
icon: FontAwesomeIcons.plus,
operator: 'sum',
),
)),
),
ButtonIcon(
icon: FontAwesomeIcons.minus,
function: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => isQuiz
? const QuizQuestionScreen(
icon: FontAwesomeIcons.minus,
operator: 'minus',
)
: const PdfGenerationScreen(
icon: FontAwesomeIcons.minus,
operator: 'minus',
),
)),
),
],
),
const SizedBox(height: 30),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
ButtonIcon(
icon: FontAwesomeIcons.xmark,
function: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => isQuiz
? const QuizQuestionScreen(
icon: FontAwesomeIcons.xmark,
operator: 'multiplication')
: const PdfGenerationScreen(
icon: FontAwesomeIcons.xmark,
operator: 'multiplication'),
)),
),
ButtonIcon(
icon: FontAwesomeIcons.divide,
function: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => isQuiz
? const QuizQuestionScreen(
icon: FontAwesomeIcons.divide,
operator: 'division',
)
: const PdfGenerationScreen(
icon: FontAwesomeIcons.divide,
operator: 'division',
),
)),
),
],
),
],
),
),
),
Expand Down
77 changes: 33 additions & 44 deletions lib/HomeScreen.dart
@@ -1,9 +1,13 @@
import 'package:flutter/material.dart';
import 'AskOperator.dart';
import 'customWidget/DisplayButton.dart';

import 'customWidget/shared_appbar.dart';

import 'customWidget/customWidgetMethods.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';


class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
static const routeName = '/home';
Expand All @@ -13,54 +17,39 @@ class HomeScreen extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: PreferredSize(
preferredSize: const Size.fromHeight(60.0),
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
),
child: const CustomAppBar(),
),
),
body: Container(
height: double.infinity,
appBar: sharedAppBar(),
body: SingleChildScrollView(
physics: const ScrollPhysics(parent: ScrollPhysics()),
padding: const EdgeInsets.fromLTRB(20, 10, 30, 10),
child: SingleChildScrollView(
physics: const ScrollPhysics(parent: ScrollPhysics()),
child: Center(
child: Column(
children: [
SizedBox(
height: MediaQuery.of(context).size.height * 0.6,
child: Image.asset('assets/HomeScreen.jpg')),
const SizedBox(
height: 50,
),
DisplayButton(
text: AppLocalizations.of(context)?.generatePdf ?? 'Generate PDF',
function: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const AskOperator(isQuiz: false),
),
),
),
SizedBox(
height: (MediaQuery.of(context).size.height * 20) / 816,
child: Column(
children: [
SizedBox(
height: MediaQuery.of(context).size.height * 0.6,
child: Image.asset('assets/HomeScreen.jpg'),
),
const SizedBox(height: 50),
DisplayButton(
text: 'Generate PDF',
function: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const AskOperator(isQuiz: false),
),
DisplayButton(
text: AppLocalizations.of(context)?.quiz ?? 'Quiz',
function: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const AskOperator(isQuiz: true),
),
),
),
),
SizedBox(
height: (MediaQuery.of(context).size.height * 20) / 816,
),
DisplayButton(
text: 'Quiz',
function: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const AskOperator(isQuiz: true),
),
],
),
),
),
],
),
),
);
Expand Down
6 changes: 6 additions & 0 deletions lib/PDF/PdfGeneratonScreen.dart
Expand Up @@ -181,7 +181,9 @@ class _PdfGenerationScreenState extends State<PdfGenerationScreen> {
pdf.addPage(
pw.MultiPage(
build: (pw.Context context) => <pw.Widget>[

pw.Header(level: 0, text: translator(1)),

pw.TableHelper.fromTextArray(
context: context, data: questionBank),
pw.Padding(padding: const pw.EdgeInsets.all(10))
Expand All @@ -192,7 +194,9 @@ class _PdfGenerationScreenState extends State<PdfGenerationScreen> {
pw.MultiPage(
build: (pw.Context context) => <pw.Widget>[
pw.Padding(padding: const pw.EdgeInsets.all(10)),

pw.Header(text: translator(2)),

pw.TableHelper.fromTextArray(
context: context, data: answerBank)
],
Expand Down Expand Up @@ -438,7 +442,9 @@ class _PdfGenerationScreenState extends State<PdfGenerationScreen> {
pw.MultiPage(
build: (pw.Context context) => <pw.Widget>[
pw.Padding(padding: const pw.EdgeInsets.all(5)),

pw.Header(text: translator(2)),

pw.TableHelper.fromTextArray(
context: context, data: finalMcqAnswerPrint)
],
Expand Down
13 changes: 2 additions & 11 deletions lib/Quiz/AnswerScreen.dart
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../HomeScreen.dart';
import '../customWidget/customWidgetMethods.dart';
import '../customWidget/shared_appbar.dart';
import '../utils/colorConst.dart';
import 'UserAnswerScreen.dart';

Expand All @@ -24,16 +24,7 @@ class AnswerScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: PreferredSize(
preferredSize: const Size.fromHeight(60.0),
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
),
child: const CustomAppBar(),
),
),
appBar: sharedAppBar(),
backgroundColor: Colors.white,
body: Center(
child: Column(
Expand Down
13 changes: 2 additions & 11 deletions lib/Quiz/QuizQuestionScreen.dart
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import '../customWidget/MainScreenCard.dart';
import '../customWidget/customWidgetMethods.dart';
import '../customWidget/shared_appbar.dart';
import '../utils/colorConst.dart';
import 'QuizScreen.dart';

Expand Down Expand Up @@ -33,16 +33,7 @@ class _QuizQuestionScreenState extends State<QuizQuestionScreen> {
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: PreferredSize(
preferredSize: const Size.fromHeight(60.0),
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
),
child: const CustomAppBar(),
),
),
appBar:sharedAppBar(),
body: Center(
child: Container(
height: double.infinity,
Expand Down