Skip to content

Commit 3a58132

Browse files
committed
Added Comments for flutter app
1 parent e9de8c5 commit 3a58132

14 files changed

+49
-50
lines changed

Flutter/lib/Connection.dart

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import 'dart:typed_data';
66
import 'package:flutter/material.dart';
77
// ignore: import_of_legacy_library_into_null_safe
88
import 'package:flutter_bluetooth_serial/flutter_bluetooth_serial.dart';
9-
//import 'package:foodaayush/mainnavbar.dart';
109

1110
class ConnectPage extends StatefulWidget {
1211
final BluetoothDevice? server;

Flutter/lib/aboutus.dart

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
//This is a page that has been added for the users to gain additional information about the app and its developers.
2+
//A simple Container widget has been used to create a box, containing information entered in simple Text widgets.
3+
//These Text widgets are arranged vertically in a column within the Container, by declaring them as the children widgets of a Column widget.
4+
//The page also has two buttons (outside the Container widget), one which redirects the user to the Customer Care page and another which takes the user to the F.A.Qs page.
5+
//The buttons are created using the MaterialButton widget.
6+
//A splashcolor attribute is also added to the buttons.
7+
18
import 'package:flutter/material.dart';
29
import 'package:foodaayush/faq.dart';
310
import 'package:foodaayush/mainnavbar.dart';

Flutter/lib/classify.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
//This is the page where image is captured and the InceptionV3 model classifies the food item by identifying which food it is and Into stale or fresh
2+
13
import 'dart:io';
24

35
import 'package:flutter/material.dart';
46
import 'package:tflite/tflite.dart';
57
import 'package:image_picker/image_picker.dart';
6-
78
import 'mainnavbar.dart';
89

910
class Classifier extends StatefulWidget {
@@ -38,7 +39,7 @@ class _ClassifierState extends State<Classifier> {
3839
//labels: "assets/labels.txt",
3940
model: "assets/float16_optimised_model_Inceptionv3.tflite",
4041
labels: "assets/ImageLabels.txt",
41-
numThreads: 1,
42+
numThreads: 4,
4243
);
4344
}
4445

Flutter/lib/faq.dart

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
//This is a page that has been added for the users to gain additional information about the app and its developers.
2+
//A simple Container widget has been used to create a box, containing information entered in simple Text widgets.
3+
//These Text widgets are arranged vertically in a column within the Container, by declaring them as the children widgets of a Column widget.
4+
//The page also has two buttons (outside the Container widget), one which redirects the user to the Customer Care page and another which takes the user to the F.A.Qs page.
5+
//The buttons are created using the MaterialButton widget. A splashcolor attribute is also added to the buttons.
6+
17
import 'package:flutter/material.dart';
28
import 'package:foodaayush/mainnavbar.dart';
39

Flutter/lib/firstsreen.dart

-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import 'dart:async';
2-
32
import 'package:flutter/material.dart';
43

54
class Welcomescreen extends StatefulWidget {
@@ -36,8 +35,6 @@ class StartState extends State<Welcomescreen> {
3635
mainAxisAlignment: MainAxisAlignment.center,
3736
children: [
3837
new Center(
39-
// alignment: Alignment(0.0, 0.0),
40-
// height: 700,
4138
child: new Text(
4239
'Food Aayush',
4340
textAlign: TextAlign.center,

Flutter/lib/home.dart

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
//import 'package:camera/camera.dart';
21
import 'package:firebase_auth/firebase_auth.dart';
32
import 'package:flutter/material.dart';
43
import 'package:url_launcher/url_launcher.dart';
5-
//import 'package:foodaayush/fresh.dart';
64

75
class HomeClass extends StatefulWidget {
86
final User user;
@@ -27,7 +25,6 @@ class _HomeState extends State<HomeClass> {
2725
),
2826
),
2927
body: Container(
30-
// width: 500,
3128
child: Column(
3229
mainAxisAlignment: MainAxisAlignment.center,
3330
crossAxisAlignment: CrossAxisAlignment.stretch,

Flutter/lib/login.dart

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
// The login screen for the application has been designed here. A Container widget is used to create a small box with text fields for entering the Email ID and Password in order to log in to the application. The labelText attribute has been used in both text fields, which indicates to the user that the text field is for entering the Email ID or the password. When the user clicks on a particular text field, e.g. the Email ID field, they are given a hint which instructs them on what to enter in the field. This is achieved using the hintText attribute. For security purposes, the password must not be visible while the user types it. So, the obscureText attribute is set to true in order for the password to be invisible. The Login button is created using a MaterialButton widget. A splashcolor attribute is added to the button, so that when the button is clicked, it creates an effect like an ink splash over the button and makes it more clearly visible that the button has been clicked. After successfully logging in, the user can access the features of the application.
1+
//The login screen for the application has been designed here.
2+
//The labelText attribute has been used in both text fields, which indicates to the user that the text field is for entering the Email ID or the password.
3+
//When the user clicks on a particular text field, e.g. the Email ID field, they are given a hint which instructs them on what to enter in the field.
4+
//This is achieved using the hintText attribute. For security purposes, the password must not be visible while the user types it.
5+
//So, the obscureText attribute is set to true in order for the password to be invisible.
6+
//The Login button is created using a MaterialButton widget.
7+
//After successfully logging in, the user can access the features of the application.
28

39
//import 'package:firebase_core/firebase_core.dart';
410
import 'package:flutter/material.dart';
511
import 'package:firebase_auth/firebase_auth.dart';
6-
//import 'package:foodaayush/constants.dart';
712
import 'package:foodaayush/home.dart';
813

914
class LoginClass extends StatefulWidget {

Flutter/lib/main.dart

-7
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
//import 'dart:io';
22

3-
//import 'package:camera/new/src/support_android/camera.dart';
43
//import 'package:firebase_auth/firebase_auth.dart';
54
import 'package:firebase_core/firebase_core.dart';
65
import 'package:flutter/material.dart';
76
import 'package:foodaayush/aboutus.dart';
8-
//import 'package:foodaayush/addindividualingredients.dart';
97

108
import 'package:foodaayush/firstsreen.dart';
11-
//import 'package:foodaayush/fresh.dart';
12-
//import 'package:foodaayush/home.dart';
139
import 'package:foodaayush/mainnutriscreen.dart';
1410
import 'package:foodaayush/rancidity_check.dart';
15-
//import 'package:foodaayush/rancidity_check.dart';
1611
import 'package:foodaayush/signup.dart';
1712

1813
import 'package:foodaayush/classify.dart';
1914
import 'login.dart';
20-
//import 'widgets.dart';
21-
//import 'package:camera/camera.dart';
2215

2316
Future<Null> main() async {
2417
WidgetsFlutterBinding.ensureInitialized();

Flutter/lib/mainnavbar.dart

+14-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1+
//Here, the navigation bar for the application has been designed.
2+
//It is a side navigation bar, which is called as a drawer menu or a navigation drawer in Flutter.
3+
//It is created using the Drawer widget.
4+
//Then a ListView widget is used to add create a list of items in the navigation drawer.
5+
//Each item in the navigation drawer is created using a ListTile widget.
6+
//The dart files for all screens have to be imported into this dart file, so that all screens can be accessed from the navigation bar.
7+
//Also, the dart file for the navigation bar has been imported into every other dart file, in order for the navigation bar to be accessible from each screen.
8+
//A separate MaterialPageRoute is used to navigate to each screen from the navigation bar.
9+
//This MaterialPageRoute has to be added in the OnTap attribute of the ListTile widget for navigation to a particular screen along with the path to the desired screen.
10+
//Additionally, one of the ListTile widgets in the navigation drawer is used along with the url_launcher package to link the Flutter app to the Streamlit web app.
11+
//The URL of the Streamlit web app is given.
12+
//The url_launcher dependency has to be added to the pubspec.yaml file and the package needs to be imported.
13+
114
//Import dart files for all screens
215
import 'package:flutter/material.dart';
316
import 'package:foodaayush/classify.dart';
417
import 'package:foodaayush/faq.dart';
518
import 'package:foodaayush/aboutus.dart';
6-
//import 'package:foodaayush/home.dart';
7-
//import 'package:foodaayush/main.dart';
819
import 'package:foodaayush/rancidity_check.dart';
9-
//import 'package:foodaayush/mainnutriscreen.dart';
1020
import 'package:url_launcher/url_launcher.dart';
1121

1222
class MainNavbar extends StatelessWidget {
@@ -33,6 +43,7 @@ class MainNavbar extends StatelessWidget {
3343
color: Color(0xff196F3D),
3444
),
3545
),
46+
//Each ListTile widget creates one item in the navigation drawer
3647
ListTile(
3748
title: Text(
3849
'Identify the Freshness',

Flutter/lib/rancidity_check.dart

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//The Rancidity of the given oil is checked on this page.
2+
//A hardware device which is integrated to mobile application via bluetooth sends the pH on this page.
3+
//Based on the pH values obtained, the system determines whether the oil is rancid or edible.
4+
15
import 'dart:async';
26
import 'package:flutter/material.dart';
37
// ignore: import_of_legacy_library_into_null_safe
@@ -98,13 +102,6 @@ class _MainPage extends State<Rancidity> {
98102
child: ListView(
99103
children: <Widget>[
100104
Divider(),
101-
// ListTile(
102-
// title: const Text('General',
103-
// style: TextStyle(
104-
// color: Color(0xff196F3D),
105-
// fontFamily: 'Comfortaa',
106-
// fontSize: 15.0,
107-
// ))),
108105
SwitchListTile(
109106
title: const Text('Enable Bluetooth',
110107
style: TextStyle(

Flutter/lib/signup.dart

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
//The new users of the application first need to sign up.
2+
//This page allows the new users to sign up by entering their Email ID and creating a password.
3+
//The Form widget is used to create this page.
4+
//The Email and Password fields are created by using the TextFormField widget inside the Form widget.
5+
//There is also a Confirm Password Field, also created using the TextFormField widget.
6+
//Form validation is added, in order to make sure that all information is entered correctly by the user.
7+
//After successfully signing up, the user will be directed to the login page.
8+
19
import 'package:firebase_auth/firebase_auth.dart';
210
//import 'package:firebase_core/firebase_core.dart';
311
import 'package:flutter/material.dart';

Flutter/lib/widgets.dart

-16
This file was deleted.

Flutter/pubspec.yaml

-6
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,13 @@ dependencies:
3030
firebase_core: ^1.0.2
3131
flutter_bluetooth_serial: ^0.2.2
3232
scoped_model: ^1.0.1
33-
#flutter_ble: ^0.5.3
34-
#flutter_blue: ^0.8.0
3533

36-
3734
# The following adds the Cupertino Icons font to your application.
3835
# Use with the CupertinoIcons class for iOS style icons.
3936
cupertino_icons: ^1.0.2
4037
camera: ^0.8.0
4138
path_provider: ^2.0.1
4239
path: ^1.8.0
43-
#easy_flutter_share:
4440

4541
dev_dependencies:
4642
flutter_test:
@@ -63,8 +59,6 @@ flutter:
6359
# - images/a_dot_ham.jpeg
6460
assets:
6561
#- assets/Opening.JPG
66-
#- assets/model_unquant.tflite
67-
#- assets/labels.txt
6862
- assets/float16_optimised_model_Inceptionv3.tflite
6963
- assets/ImageLabels.txt
7064
# An image asset can refer to one or more resolution-specific "variants", see

Images/Gist.png

438 KB
Loading

0 commit comments

Comments
 (0)