Skip to content

Commit

Permalink
Merge pull request #2 from BakaOtaku/app
Browse files Browse the repository at this point in the history
Cosmetic changes
  • Loading branch information
AmanRaj1608 authored Sep 6, 2020
2 parents fb0db3e + 94b3af1 commit 4b79b39
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 22 deletions.
1 change: 1 addition & 0 deletions app/android/settings_aar.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include ':app'
15 changes: 15 additions & 0 deletions app/lib/decryptHandler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class _DecrypthandlerState extends State<Decrypthandler> {
TextEditingController _password = TextEditingController();
var platformChannel = MethodChannel("exam");
File file;
bool _fileVisibility = false;
@override
void initState() {
super.initState();
Expand All @@ -30,19 +31,33 @@ class _DecrypthandlerState extends State<Decrypthandler> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Visibility(
visible: _fileVisibility,
child: Text(file?.path?.split("/")?.last ?? ''),
),
SizedBox(height: 30),
RaisedButton(
child: Text("Choose File"),
onPressed: () async {
file = await FilePicker.getFile(type: FileType.any);
print("File path: ${file.absolute}");
setState(() {
if (file != null) {
_fileVisibility = true;
} else {
_fileVisibility = false;
}
});
},
),
SizedBox(height: 30),
TextFormField(
controller: _password,
decoration: InputDecoration(
labelText: "Password",
),
),
SizedBox(height: 20),
RaisedButton(
child: Text("Decrypt"),
onPressed: () async {
Expand Down
66 changes: 44 additions & 22 deletions app/lib/downloadHandler.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
import 'package:app/pathHandler.dart';
import 'package:flutter/material.dart';
import 'package:flutter_downloader/flutter_downloader.dart';
import 'package:fluttertoast/fluttertoast.dart';

class DownloadHandler extends StatelessWidget {
class DownloadHandler extends StatefulWidget {
@override
_DownloadHandlerState createState() => _DownloadHandlerState();
}

class _DownloadHandlerState extends State<DownloadHandler> {
final TextEditingController _downloadLink = TextEditingController();

@override
Expand All @@ -11,28 +17,44 @@ class DownloadHandler extends StatelessWidget {
appBar: AppBar(
title: Text("Download Question"),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextFormField(
controller: _downloadLink,
decoration: InputDecoration(
labelText: "Link",
body: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextFormField(
controller: _downloadLink,
decoration: InputDecoration(
labelText: "Link",
),
),
SizedBox(height: 20),
RaisedButton(
child: Text("Download"),
onPressed: () async {
final taskId = await FlutterDownloader.enqueue(
url: _downloadLink.text,
savedDir: await PathHandler.getPath(),
showNotification: true,
openFileFromNotification: true,
);
print("Task - Downloading file task ID: $taskId");
setState(() {
_downloadLink.clear();
});
Fluttertoast.showToast(
msg: "Check notification for download status",
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.grey,
textColor: Colors.white,
fontSize: 16.0,
);
},
),
),
RaisedButton(
child: Text("Download"),
onPressed: () async {
final taskId = await FlutterDownloader.enqueue(
url: _downloadLink.text,
savedDir: await PathHandler.getPath(),
showNotification: true,
openFileFromNotification: true,
);
print("Task - Downloading file task ID: $taskId");
},
),
],
],
),
),
);
}
Expand Down
1 change: 1 addition & 0 deletions app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: "Exam App",
home: HomePage(),
theme: ThemeData.dark(),
Expand Down
15 changes: 15 additions & 0 deletions app/lib/submissionHandler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class SubmissionHandler extends StatefulWidget {
class _SubmissionHandlerState extends State<SubmissionHandler> {
final TextEditingController _subController = TextEditingController();

bool _fileVisibility = false;
File file;
String data = '';
bool visible = false;
Expand All @@ -30,19 +31,33 @@ class _SubmissionHandlerState extends State<SubmissionHandler> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Visibility(
visible: _fileVisibility,
child: Text(file?.path?.split("/")?.last ?? ''),
),
SizedBox(height: 30),
RaisedButton(
child: Text("Choose File"),
onPressed: () async {
file = await FilePicker.getFile(type: FileType.any);
print("File path: ${file.absolute}");
setState(() {
if (file != null) {
_fileVisibility = true;
} else {
_fileVisibility = false;
}
});
},
),
SizedBox(height: 30),
TextFormField(
controller: _subController,
decoration: InputDecoration(
labelText: "Subject ID",
),
),
SizedBox(height: 20),
RaisedButton(
child: Text("Generate"),
onPressed: () async {
Expand Down
14 changes: 14 additions & 0 deletions app/lib/uploadHandler.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class UploadHandler extends StatefulWidget {

class _UploadHandlerState extends State<UploadHandler> {
File file;
bool _fileVisibility = false;

@override
Widget build(BuildContext context) {
Expand All @@ -25,13 +26,26 @@ class _UploadHandlerState extends State<UploadHandler> {
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Visibility(
visible: _fileVisibility,
child: Text(file?.path?.split("/")?.last ?? ''),
),
SizedBox(height: 30),
RaisedButton(
child: Text("Choose File"),
onPressed: () async {
file = await FilePicker.getFile(type: FileType.any);
print("File path: ${file.absolute}");
setState(() {
if (file != null) {
_fileVisibility = true;
} else {
_fileVisibility = false;
}
});
},
),
SizedBox(height: 20),
RaisedButton(
child: Text("Upload"),
onPressed: () async {
Expand Down

1 comment on commit 4b79b39

@vercel
Copy link

@vercel vercel bot commented on 4b79b39 Sep 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.