Skip to content

Commit

Permalink
Merge pull request #3 from BlockchainResearchLab/authBranch <-- Auth …
Browse files Browse the repository at this point in the history
…branch merging & Worked on UI -->

Auth branch merging & Worked on UI
  • Loading branch information
beingadish authored Oct 28, 2022
2 parents 564f907 + 55cae06 commit 16a5a2d
Show file tree
Hide file tree
Showing 13 changed files with 1,148 additions and 254 deletions.
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"editor.fontLigatures": false,
"editor.fontFamily": "Cascadia Code, 'Courier New', monospace",
"editor.fontSize": 14
}
Binary file added images/brl_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions lib/Modals/createEntry.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// To parse this JSON data, do
//
// final welcome = welcomeFromJson(jsonString);

import 'dart:convert';

EntryModel welcomeFromJson(String str) => EntryModel.fromJson(json.decode(str));
EntryModel welcomeFromJson(String str) => EntryModel.fromJson(
json.decode(str),
);

String welcomeToJson(EntryModel data) => json.encode(data.toJson());
String welcomeToJson(EntryModel data) => json.encode(
data.toJson(),
);

class EntryModel {
EntryModel({
Expand Down
27 changes: 27 additions & 0 deletions lib/Modals/login.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
class Login {
bool? success;
int? privilege;
String? token;

Login({required this.success, required this.privilege, required this.token});

Login.fromJson(Map<String, dynamic> json) {
success = json['success'];
privilege = json['privilege'];
token = json['token'];
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['success'] = success;
data['privilege'] = privilege;
data['token'] = token;
return data;
}
}

/* Failure response */
// {
// "success": false,
// "msg": "Authentication failed. Invalid User."
// }
87 changes: 87 additions & 0 deletions lib/Modals/studentData.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
class StudentData {
Result? result;

StudentData({this.result});

StudentData.fromJson(Map<String, dynamic> json) {
result =
json['result'] != null ? Result.fromJson(json['result']) : null;
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (result != null) {
data['result'] = result!.toJson();
}
return data;
}
}

class Result {
int? lateCount;
int? fineCount;
List<String>? entry;
String? sId;
String? name;
String? stdNo;
int? year;
String? branch;
String? email;
int? mobile;
String? img;
String? createdAt;
String? updatedAt;
int? iV;

Result(
{this.lateCount,
this.fineCount,
this.entry,
this.sId,
this.name,
this.stdNo,
this.year,
this.branch,
this.email,
this.mobile,
this.img,
this.createdAt,
this.updatedAt,
this.iV});

Result.fromJson(Map<String, dynamic> json) {
lateCount = json['lateCount'];
fineCount = json['fineCount'];
entry = json['entry'].cast<String>();
sId = json['_id'];
name = json['name'];
stdNo = json['stdNo'];
year = json['year'];
branch = json['branch'];
email = json['email'];
mobile = json['mobile'];
img = json['img'];
createdAt = json['createdAt'];
updatedAt = json['updatedAt'];
iV = json['__v'];
}

Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['lateCount'] = lateCount;
data['fineCount'] = fineCount;
data['entry'] = entry;
data['_id'] = sId;
data['name'] = name;
data['stdNo'] = stdNo;
data['year'] = year;
data['branch'] = branch;
data['email'] = email;
data['mobile'] = mobile;
data['img'] = img;
data['createdAt'] = createdAt;
data['updatedAt'] = updatedAt;
data['__v'] = iV;
return data;
}
}
27 changes: 20 additions & 7 deletions lib/barcodeScanner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
import 'package:punctuality_drive/result2.dart';
import 'package:punctuality_drive/services/api_services.dart';
import 'dart:math' as math;

Expand All @@ -22,10 +23,20 @@ class _ScannerState extends State<Scanner> {
try {
barcodeScanRes = await FlutterBarcodeScanner.scanBarcode(
'#ff6666', 'Cancel', true, ScanMode.BARCODE);
setState(() {
studentNumber = barcodeScanRes;
lateEntry();
});
setState(
() {
studentNumber = barcodeScanRes;
// lateEntry(); // moved to mark entry button.
show(studentNumber ?? "2012014");
Navigator.push(
context,
MaterialPageRoute(
builder: ((context) => const ScannedEntry()),
),
);
},
);

if (kDebugMode) {
print(barcodeScanRes);
}
Expand All @@ -37,9 +48,11 @@ class _ScannerState extends State<Scanner> {
@override
Widget build(BuildContext context) {
return FloatingActionButton.large(
onPressed: () => setState(() {
scanBarcodeNormal();
}),
onPressed: () => setState(
() {
scanBarcodeNormal();
},
),
elevation: 10.0,
backgroundColor: Colors.black,
foregroundColor: Colors.amberAccent,
Expand Down
Loading

0 comments on commit 16a5a2d

Please sign in to comment.