Skip to content

Commit

Permalink
Merge pull request #22 from RoyARG02/ver2
Browse files Browse the repository at this point in the history
Migrate version 2 to master
  • Loading branch information
royarg02 authored Apr 6, 2020
2 parents 522d2b3 + 8762b83 commit 5063cab
Show file tree
Hide file tree
Showing 58 changed files with 1,717 additions and 1,127 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ flutter_export_environment.sh
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages

local.properties
.flutter-
.flutter-
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This is a Flutter project, which will serve as the dashboard for the **Soil Mois

Color Theme: [Material.io](https://material.io/resources/color/#!/?view.left=0&view.right=0&primary.color=E6EE9C&secondary.color=827717)

Font: [OCRB](https://github.com/opensourcedesign/fonts/tree/master/OCR)
Font: [JetBrains Mono](https://github.com/JetBrains/JetBrainsMono)

### Screenshots

Expand Down
6 changes: 3 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 28
compileSdkVersion 29

lintOptions {
disable 'InvalidPackage'
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.soil_moisture_app"
minSdkVersion 16
applicationId "com.isocode.soif"
minSdkVersion 23
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.soil_moisture_app">
package="com.isocode.soif">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.soil_moisture_app">
package="com.isocode.soif">

<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.soil_moisture_app;
package com.isocode.soif;

import android.os.Bundle;
import io.flutter.app.FlutterActivity;
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/profile/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.soil_moisture_app">
package="com.isocode.soif">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed assets/fonts/Ocrb.ttf
Binary file not shown.
62 changes: 8 additions & 54 deletions lib/data/all_data.dart
Original file line number Diff line number Diff line change
@@ -1,58 +1,12 @@
// * Import all Data Classes
import 'package:soil_moisture_app/data/plant_class.dart';
import 'package:soil_moisture_app/data/temp_class.dart';
import 'package:soil_moisture_app/data/humidity_class.dart';
import 'package:soil_moisture_app/data/light_class.dart';
import 'package:soil_moisture_app/data/threshold_class.dart';
import 'package:soif/data/plant_data.dart';
import 'package:soif/data/threshold_class.dart';

// * Define Data Objects to be used throughout the app
List<Plant> plantList = [];
Light dayLight;
Temp dayTemp;
Humidity dayHumid;
// * Data Object to be used throughout the app
AllData allData;

// * Latest Data objects to be used in Overview
List<Plant> nowPlantList = [];
Light nowLight;
Temp nowTemp;
Humidity nowHumid;
// * Data object to be used in Overview
NowData nowData;

// * for threshold
List<Threshold> pumpList = [];

// * base url for application get/post
final baseUrl = "https://soif.herokuapp.com";

// * Url for github repo
final repoUrl = 'https://github.com/RoyARG02/soil_moisture_app';

// * Uri for API
final apiUrl = 'https://github.com/forkbomb-666/drip_irrigation_server';

// * Developer Details
final List<Map<String, dynamic>> devDetails = [
{
'Name': 'ANURAG ROY',
'Github': 'RoyARG02',
'Bio': 'Programming language nomad, and a Flutter developer.',
'Twitter': '_royarg'
},
{
'Name': 'AYUSH THAKUR',
'Github': 'ayulockin',
'Bio': 'Deep Learning for Computer Vision | Computer Vision for Robotics',
'Twitter': 'ayushthakur0'
},
{
'Name': 'SNEHANGSHU BHATTACHARYA',
'Github': 'forkbomb-666',
'Bio': 'Linux | Bigdata(Hadoop) | DIY Electronics | Robotics',
'Twitter': 'snehangshu_'
},
{
'Name': 'ARITRA ROY GOSTHIPATY',
'Github': 'ariG23498',
'Bio': '| Flutter | Android | Algorithms | Digital Signal Processing |',
'Twitter': 'ariG23498'
}
];
// * For threshold
List<Threshold> pumpList;
70 changes: 70 additions & 0 deletions lib/data/environment_data.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
abstract class EnvironmentData {
static const INVALID_VALUE = -999; //for data fields not consisting of lists
List<num> _values;
num _latest;
String _unit;

set setAllValues(List<num> values) {
this._values = values;
this._latest = values.isEmpty ? INVALID_VALUE : values.last;
}

set setLatestValue(num value) {
this._latest = value ?? INVALID_VALUE;
}

set setUnit(String unit) => this._unit = unit;

List<num> get allValues => this._values;
num get lastValue => this._latest;
String get unit => this._unit;

@override
String toString() {
return '${this._latest}${this._unit}: ${this._values}';
}
}

class Moisture extends EnvironmentData {
Moisture() {
this._unit = '%';
}

Moisture.latest() {
this._unit = '%';
this._values = null;
}
}

class Humidity extends EnvironmentData {
Humidity() {
this._unit = '%';
}

Humidity.latest() {
this._unit = '%';
this._values = null;
}
}

class Temp extends EnvironmentData {
Temp() {
this._unit = '°C';
}

Temp.latest() {
this._unit = '°C';
this._values = null;
}
}

class Light extends EnvironmentData {
Light() {
this._unit = 'Lx';
}

Light.latest() {
this._unit = 'Lx';
this._values = null;
}
}
33 changes: 0 additions & 33 deletions lib/data/humidity_class.dart

This file was deleted.

34 changes: 0 additions & 34 deletions lib/data/light_class.dart

This file was deleted.

54 changes: 23 additions & 31 deletions lib/data/plant_class.dart
Original file line number Diff line number Diff line change
@@ -1,47 +1,39 @@
import 'package:soif/data/environment_data.dart';

/*
* Plant Class
* This class contains the 24 hr values of moisture of a plant in any day
*/
class Plant {
// * Plant name
String _label = 'Plant';

// * List containing the values of moisture for every hour
List<num> _values;

// * Moisture of last hour/ latest hour
num _latestVal;

// * Unit to be displayed alongside the value
final String _unit = '%';
class Plant {
static const double _moreThanNormal = 0.75;
static const double _critMoisture = 0.35;
String _name;
Moisture _moisture;
Plant(this._name, List<dynamic> values) {
this._moisture = Moisture()
..setAllValues =
values.map<num>((v) => double.parse(v.toString())).toList();
}
Plant.latest(this._name, num value) {
this._moisture = Moisture.latest()..setLatestValue = value;
}

// * Moisture percentage above which the plant is assumed to have sufficient moisture
final double _moreThanNormal = 0.75;
// * Moisture percentage below which the plant is assumed to have low moisture
final double _critMoisture = 0.35;
String get name => this._name;
Moisture get moisture => this._moisture;

// * Determines if 'this' plant (or any given moisture value) is low or not
bool isCritical([double check]) {
check = check ?? this.getLastValue;
check = check ?? this._moisture.lastValue;
return (check <= _critMoisture);
}

// * Determines if 'this' plant (or any given moisture value) is sufficient or not
bool isMoreThanNormal([double check]) {
check = check ?? this.getLastValue;
check = check ?? this._moisture.lastValue;
return (check >= _moreThanNormal);
}

Plant(this._values);

// * Creates object with all values given(used in fetching total data)
Plant.createElement(this._label, this._values);

// * Creates object with only the latest value given(used in fetching current data)
Plant.createLatest(this._label, this._latestVal);

String get getLabel => _label;
List<num> get getAllValues => _values;
num get getLastValue => (this._values == null) ? _latestVal : _values.last;
String get getUnit => this._unit;
@override
String toString() {
return '${this._name} => ${this._moisture}';
}
}
Loading

0 comments on commit 5063cab

Please sign in to comment.