Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ifarm
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TMP-2022-009
ifarm
Commits
406e76f6
Commit
406e76f6
authored
2 years ago
by
ayodyabanuka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated Files
parent
089c3954
Changes
25
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
201 additions
and
214 deletions
+201
-214
android/app/src/main/AndroidManifest.xml
android/app/src/main/AndroidManifest.xml
+2
-0
ios/Runner/AppDelegate.swift
ios/Runner/AppDelegate.swift
+3
-0
lib/AB/Arduino Project/Project.ino
lib/AB/Arduino Project/Project.ino
+0
-0
lib/AB/Screens/Common/Auth/Login.dart
lib/AB/Screens/Common/Auth/Login.dart
+17
-13
lib/AB/Screens/Common/Auth/register.dart
lib/AB/Screens/Common/Auth/register.dart
+3
-7
lib/AB/Screens/Common/NetworkErrorPage.dart
lib/AB/Screens/Common/NetworkErrorPage.dart
+3
-2
lib/AB/Screens/Common/SplashScreen.dart
lib/AB/Screens/Common/SplashScreen.dart
+5
-22
lib/AB/Screens/FoodBucket/FoodBucketList.dart
lib/AB/Screens/FoodBucket/FoodBucketList.dart
+7
-5
lib/AB/Screens/FoodBucket/SingleFoodBucketData.dart
lib/AB/Screens/FoodBucket/SingleFoodBucketData.dart
+6
-6
lib/AB/Screens/NavBar/FoodBucketSchedule.dart
lib/AB/Screens/NavBar/FoodBucketSchedule.dart
+15
-0
lib/AB/Screens/NavBar/Home.dart
lib/AB/Screens/NavBar/Home.dart
+33
-22
lib/AB/Screens/NavBar/Navbar.dart
lib/AB/Screens/NavBar/Navbar.dart
+8
-8
lib/AB/Screens/NavBar/Profile.dart
lib/AB/Screens/NavBar/Profile.dart
+1
-1
lib/AB/Screens/NavBar/settings.dart
lib/AB/Screens/NavBar/settings.dart
+39
-20
lib/AB/Utils/Colors.dart
lib/AB/Utils/Colors.dart
+11
-0
lib/AB/Utils/ThemeProvider.dart
lib/AB/Utils/ThemeProvider.dart
+21
-0
lib/AB/generated_plugin_registrant.dart
lib/AB/generated_plugin_registrant.dart
+0
-0
lib/AB/widget/ChangeThemeButtonWidget.dart
lib/AB/widget/ChangeThemeButtonWidget.dart
+10
-0
lib/AB/widget/QRCodeScanner.dart
lib/AB/widget/QRCodeScanner.dart
+1
-1
lib/AB/widget/customizedTextField.dart
lib/AB/widget/customizedTextField.dart
+6
-10
lib/Screens/AB/Bucket.dart
lib/Screens/AB/Bucket.dart
+0
-15
lib/Screens/AB/Firebaselist.dart
lib/Screens/AB/Firebaselist.dart
+0
-72
lib/functions/authFunctions.dart
lib/functions/authFunctions.dart
+3
-4
lib/main.dart
lib/main.dart
+6
-5
pubspec.yaml
pubspec.yaml
+1
-1
No files found.
android/app/src/main/AndroidManifest.xml
View file @
406e76f6
...
...
@@ -10,6 +10,8 @@
android:exported=
"true"
android:launchMode=
"singleTop"
android:theme=
"@style/LaunchTheme"
android:showWhenLocked=
"true"
android:turnScreenOn=
"true"
android:configChanges=
"orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated=
"true"
android:windowSoftInputMode=
"adjustResize"
>
...
...
This diff is collapsed.
Click to expand it.
ios/Runner/AppDelegate.swift
View file @
406e76f6
...
...
@@ -10,4 +10,7 @@ import Flutter
GeneratedPluginRegistrant
.
register
(
with
:
self
)
return
super
.
application
(
application
,
didFinishLaunchingWithOptions
:
launchOptions
)
}
if
#available(iOS 10.0, *)
{
UNUserNotificationCenter
.
current
()
.
delegate
=
self
as?
UNUserNotificationCenterDelegate
}
}
This diff is collapsed.
Click to expand it.
lib/
Screens/
AB/Arduino Project/Project.ino
→
lib/AB/Arduino Project/Project.ino
View file @
406e76f6
File moved
This diff is collapsed.
Click to expand it.
lib/
Screens/AB
/Login.dart
→
lib/
AB/Screens/Common/Auth
/Login.dart
View file @
406e76f6
import
'dart:io'
;
import
'dart:ui'
;
import
'package:flutter/material.dart'
;
import
'package:fluttertoast/fluttertoast.dart'
;
import
'package:ifarm/Screens/AB/register.dart'
;
import
'package:ifarm/AB/Screens/Common/Auth/register.dart'
;
import
'package:ifarm/AB/Utils/Colors.dart'
;
import
'package:ifarm/AB/widget/customizedTextField.dart'
;
import
'package:ifarm/functions/authFunctions.dart'
;
import
'package:ifarm/widget/customizedTextField.dart'
;
class
Login
extends
StatefulWidget
{
Login
({
Key
?
key
})
:
super
(
key:
key
);
Login
({
Key
key
})
:
super
(
key:
key
);
@override
State
<
Login
>
createState
()
=>
_LoginState
();
...
...
@@ -36,7 +36,7 @@ class _LoginState extends State<Login> {
Size
size
=
MediaQuery
.
of
(
context
).
size
;
return
Scaffold
(
appBar:
AppBar
(
backgroundColor:
const
Color
(
0xff024F8E
)
,
backgroundColor:
backgroundColor
,
elevation:
0
,
toolbarHeight:
0
,
),
...
...
@@ -46,7 +46,7 @@ class _LoginState extends State<Login> {
Container
(
height:
size
.
height
,
width:
size
.
width
,
color:
const
Color
(
0xff024F8E
)
,
color:
backgroundColor
,
child:
Transform
.
translate
(
offset:
const
Offset
(
0
,
-
190
),
child:
Image
.
asset
(
...
...
@@ -72,7 +72,7 @@ class _LoginState extends State<Login> {
decoration:
BoxDecoration
(
border:
Border
.
all
(
color:
const
Color
.
fromARGB
(
255
,
241
,
246
,
255
)),
color:
const
Color
(
0xff06375F
)
.
withOpacity
(
0.37
),
color:
backgroundColor
.
withOpacity
(
0.37
),
borderRadius:
BorderRadius
.
circular
(
20
),
),
child:
Column
(
...
...
@@ -133,9 +133,9 @@ class _LoginState extends State<Login> {
Checkbox
(
checkColor:
Colors
.
white
,
value:
isChecked
,
onChanged:
(
bool
?
value
)
{
onChanged:
(
bool
value
)
{
setState
(()
{
isChecked
=
value
!
;
isChecked
=
value
;
});
}),
const
Text
(
...
...
@@ -165,8 +165,7 @@ class _LoginState extends State<Login> {
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
20
,
vertical:
10
),
decoration:
BoxDecoration
(
border:
Border
.
all
(
color:
const
Color
(
0xffFEC427
)),
border:
Border
.
all
(
color:
yellowButton
),
borderRadius:
BorderRadius
.
circular
(
10
)),
child:
const
Padding
(
...
...
@@ -180,6 +179,9 @@ class _LoginState extends State<Login> {
),
),
)),
const
SizedBox
(
width:
10
,
),
GestureDetector
(
onTap:
()
{
print
(
emailController
.
text
);
...
...
@@ -203,7 +205,7 @@ class _LoginState extends State<Login> {
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
20
,
vertical:
10
),
decoration:
BoxDecoration
(
color:
const
Color
(
0xffFEC427
)
,
color:
yellowButton
,
borderRadius:
BorderRadius
.
circular
(
10
)),
child:
const
Padding
(
...
...
@@ -211,7 +213,9 @@ class _LoginState extends State<Login> {
horizontal:
5
,
vertical:
1
),
child:
Text
(
'Login'
,
style:
TextStyle
(
fontFamily:
'poppins'
),
style:
TextStyle
(
fontFamily:
'poppins'
,
color:
blacktxtColor
),
),
),
)),
...
...
This diff is collapsed.
Click to expand it.
lib/
Screens/AB
/register.dart
→
lib/
AB/Screens/Common/Auth
/register.dart
View file @
406e76f6
import
'dart:ui'
;
import
'package:firebase_auth/firebase_auth.dart'
;
import
'package:flutter/material.dart'
;
import
'package:fluttertoast/fluttertoast.dart'
;
import
'package:ifarm/Screens/AB/Login.dart'
;
import
'package:ifarm/AB/Screens/Common/Auth/Login.dart'
;
import
'package:ifarm/functions/authFunctions.dart'
;
import
'package:ifarm/widget/customizedTextField.dart'
;
import
'package:ifarm/
AB/
widget/customizedTextField.dart'
;
class
register
extends
StatefulWidget
{
register
({
Key
?
key
})
:
super
(
key:
key
);
register
({
Key
key
})
:
super
(
key:
key
);
@override
State
<
register
>
createState
()
=>
_registerState
();
...
...
This diff is collapsed.
Click to expand it.
lib/
Screens/AB
/NetworkErrorPage.dart
→
lib/
AB/Screens/Common
/NetworkErrorPage.dart
View file @
406e76f6
import
'package:flutter/material.dart'
;
import
'package:ifarm/Screens/AB/SplashScreen.dart'
;
import
'SplashScreen.dart'
;
class
networkError
extends
StatefulWidget
{
networkError
({
Key
?
key
})
:
super
(
key:
key
);
networkError
({
Key
key
})
:
super
(
key:
key
);
@override
State
<
networkError
>
createState
()
=>
_networkErrorState
();
...
...
This diff is collapsed.
Click to expand it.
lib/
Screens/AB
/SplashScreen.dart
→
lib/
AB/Screens/Common
/SplashScreen.dart
View file @
406e76f6
import
'dart:async'
;
import
'dart:io'
;
import
'package:connectivity_plus/connectivity_plus.dart'
;
import
'package:flutter/material.dart'
;
import
'package:ifarm/Screens/AB/Login.dart'
;
import
'package:ifarm/Screens/AB/Navbar.dart'
;
import
'package:ifarm/Screens/AB/NetworkErrorPage.dart'
;
import
'package:ifarm/AB/Screens/Common/Auth/Login.dart'
;
import
'package:ifarm/AB/Screens/NavBar/Navbar.dart'
;
import
'package:ifarm/functions/Network.dart'
;
import
'package:provider/provider.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
class
splashScreen
extends
StatefulWidget
{
splashScreen
({
Key
?
key
})
:
super
(
key:
key
);
splashScreen
({
Key
key
})
:
super
(
key:
key
);
@override
State
<
splashScreen
>
createState
()
=>
_splashScreenState
();
}
int
?
logged
;
int
logged
;
class
_splashScreenState
extends
State
<
splashScreen
>
with
TickerProviderStateMixin
{
bool
isoffline
=
false
;
Map
_source
=
{
ConnectivityResult
.
none
:
false
};
final
Map
_source
=
{
ConnectivityResult
.
none
:
false
};
final
NetworkConnectivity
_networkConnectivity
=
NetworkConnectivity
.
instance
;
String
string
=
''
;
late
AnimationController
_controller
;
void
initState
()
{
getdata
();
savedata
();
super
.
initState
();
_controller
=
AnimationController
(
vsync:
this
);
_controller
.
addListener
(()
{
print
(
_controller
.
value
);
// if the full duration of the animation is 8 secs then 0.5 is 4 secs
if
(
_controller
.
value
>
1
)
{
// When it gets there hold it there.
_controller
.
value
=
1
;
}
});
//set time to load the new page
super
.
initState
();
}
@override
...
...
This diff is collapsed.
Click to expand it.
lib/
Screens/AB/Food
.dart
→
lib/
AB/Screens/FoodBucket/FoodBucketList
.dart
View file @
406e76f6
...
...
@@ -4,11 +4,12 @@ import 'package:firebase_database/firebase_database.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_barcode_scanner/flutter_barcode_scanner.dart'
;
import
'package:ifarm/Screens/AB/data.dart'
;
import
'package:ifarm/AB/Screens/FoodBucket/SingleFoodBucketData.dart'
;
import
'package:ifarm/AB/Utils/Colors.dart'
;
import
'package:ifarm/functions/firebaseFunctions.dart'
;
class
foodbuckets
extends
StatefulWidget
{
foodbuckets
({
Key
?
key
})
:
super
(
key:
key
);
foodbuckets
({
Key
key
})
:
super
(
key:
key
);
@override
State
<
foodbuckets
>
createState
()
=>
_foodbucketsState
();
...
...
@@ -65,7 +66,7 @@ class _foodbucketsState extends State<foodbuckets> {
return
const
Center
(
child:
CircularProgressIndicator
());
}
final
storedata
=
[];
snapshot
.
data
!
.
docs
.
map
((
DocumentSnapshot
document
)
{
snapshot
.
data
.
docs
.
map
((
DocumentSnapshot
document
)
{
Map
a
=
document
.
data
()
as
Map
<
String
,
dynamic
>;
storedata
.
add
(
a
);
}).
toList
();
...
...
@@ -87,14 +88,15 @@ class _foodbucketsState extends State<foodbuckets> {
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
datafromfirebase
(
builder:
(
context
)
=>
SingleFoodBucketData
(
bucketId:
storedata
[
0
][
'Buckets'
]
[
index
],
)));
},
child:
Container
(
decoration:
BoxDecoration
(
color:
Colors
.
white
,
color:
cardColor
,
borderRadius:
BorderRadius
.
circular
(
15
)),
margin:
const
EdgeInsets
.
symmetric
(
vertical:
5
),
padding:
const
EdgeInsets
.
symmetric
(
...
...
This diff is collapsed.
Click to expand it.
lib/
Screens/AB/d
ata.dart
→
lib/
AB/Screens/FoodBucket/SingleFoodBucketD
ata.dart
View file @
406e76f6
...
...
@@ -4,12 +4,12 @@ import 'package:flutter/material.dart';
import
'package:liquid_progress_indicator/liquid_progress_indicator.dart'
;
import
'package:switcher_button/switcher_button.dart'
;
class
datafromfirebase
extends
StatefulWidget
{
class
SingleFoodBucketData
extends
StatefulWidget
{
String
bucketId
;
datafromfirebase
({
Key
?
key
,
required
this
.
bucketId
})
:
super
(
key:
key
);
SingleFoodBucketData
({
Key
key
,
this
.
bucketId
})
:
super
(
key:
key
);
@override
State
<
datafromfirebase
>
createState
()
=>
_datafromfirebase
State
();
State
<
SingleFoodBucketData
>
createState
()
=>
_SingleFoodBucketData
State
();
}
String
d
=
'100'
;
...
...
@@ -17,7 +17,7 @@ String m = '250';
int
s
=
0
;
bool
svalue
=
false
;
class
_
datafromfirebaseState
extends
State
<
datafromfirebase
>
{
class
_
SingleFoodBucketDataState
extends
State
<
SingleFoodBucketData
>
{
@override
void
initState
()
{
super
.
initState
();
...
...
@@ -27,7 +27,7 @@ class _datafromfirebaseState extends State<datafromfirebase> {
servovalueinbool
();
}
Timer
?
timer
;
Timer
timer
;
void
runTimer
()
{
timer
=
Timer
.
periodic
(
const
Duration
(
seconds:
2
),
(
_
)
{
getData
();
...
...
@@ -85,7 +85,7 @@ class _datafromfirebaseState extends State<datafromfirebase> {
icon:
const
Icon
(
Icons
.
arrow_back
,
color:
Colors
.
white
),
onPressed:
()
{
Navigator
.
pop
(
context
);
timer
!
.
cancel
();
timer
.
cancel
();
},
),
backgroundColor:
const
Color
(
0xff024F8E
),
...
...
This diff is collapsed.
Click to expand it.
lib/AB/Screens/NavBar/FoodBucketSchedule.dart
0 → 100644
View file @
406e76f6
import
'package:flutter/material.dart'
;
class
FoodBucketSchedule
extends
StatefulWidget
{
FoodBucketSchedule
({
Key
key
})
:
super
(
key:
key
);
@override
State
<
FoodBucketSchedule
>
createState
()
=>
_FoodBucketScheduleState
();
}
class
_FoodBucketScheduleState
extends
State
<
FoodBucketSchedule
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
Container
();
}
}
This diff is collapsed.
Click to expand it.
lib/
Screens/AB
/Home.dart
→
lib/
AB/Screens/NavBar
/Home.dart
View file @
406e76f6
import
'dart:async'
;
import
'package:firebase_database/firebase_database.dart'
;
import
'package:flutter/material.dart'
;
import
'package:font_awesome_flutter/font_awesome_flutter.dart'
;
import
'package:ifarm/Screens/AB/Food.dart'
;
import
'package:ifarm/AB/Screens/FoodBucket/FoodBucketList.dart'
;
import
'package:ifarm/AB/Utils/Colors.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
class
Home
extends
StatefulWidget
{
Home
({
Key
?
key
})
:
super
(
key:
key
);
Home
({
Key
key
})
:
super
(
key:
key
);
@override
State
<
Home
>
createState
()
=>
_HomeState
();
...
...
@@ -25,6 +29,18 @@ class _HomeState extends State<Home> {
super
.
initState
();
}
gettemp
()
{
FirebaseDatabase
.
instance
.
ref
()
.
child
(
'sensor_data/temperature'
)
.
onValue
.
listen
((
event
)
{
setState
(()
{
t
=
event
.
snapshot
.
value
.
toString
();
});
});
}
getdata
()
async
{
print
(
'login'
);
SharedPreferences
localStorage
=
await
SharedPreferences
.
getInstance
();
...
...
@@ -45,21 +61,16 @@ class _HomeState extends State<Home> {
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
backgroundColor:
const
Color
(
0xff024F8E
)
,
backgroundColor:
backgroundColor
,
body:
Container
(
margin:
const
EdgeInsets
.
symmetric
(
horizontal:
15
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
const
SizedBox
(
height:
50
,
),
Container
(
width:
150
,
padding:
const
EdgeInsets
.
all
(
15
),
padding:
const
EdgeInsets
.
all
(
25
),
decoration:
BoxDecoration
(
color:
Colors
.
white12
,
borderRadius:
BorderRadius
.
circular
(
20
)),
color:
cardColor
,
borderRadius:
BorderRadius
.
circular
(
20
)),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
...
...
@@ -121,10 +132,10 @@ class _HomeState extends State<Home> {
}
:
null
,
child:
Container
(
height:
100
,
padding:
const
EdgeInsets
.
all
(
15
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
40
),
decoration:
BoxDecoration
(
color:
Colors
.
white24
,
color:
cardColor
,
borderRadius:
BorderRadius
.
circular
(
20
)),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
...
...
@@ -153,10 +164,10 @@ class _HomeState extends State<Home> {
child:
GestureDetector
(
onTap:
()
{},
child:
Container
(
height:
100
,
padding:
const
EdgeInsets
.
all
(
15
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
40
),
decoration:
BoxDecoration
(
color:
Colors
.
white24
,
color:
cardColor
,
borderRadius:
BorderRadius
.
circular
(
20
)),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
...
...
@@ -192,10 +203,10 @@ class _HomeState extends State<Home> {
child:
GestureDetector
(
onTap:
()
{},
child:
Container
(
height:
100
,
padding:
const
EdgeInsets
.
all
(
15
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
40
),
decoration:
BoxDecoration
(
color:
Colors
.
white24
,
color:
cardColor
,
borderRadius:
BorderRadius
.
circular
(
20
)),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
...
...
@@ -226,10 +237,10 @@ class _HomeState extends State<Home> {
print
(
'water'
);
},
child:
Container
(
height:
100
,
padding:
const
EdgeInsets
.
all
(
15
),
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
15
,
vertical:
40
),
decoration:
BoxDecoration
(
color:
Colors
.
white24
,
color:
cardColor
,
borderRadius:
BorderRadius
.
circular
(
20
)),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
...
...
This diff is collapsed.
Click to expand it.
lib/
Screens/AB
/Navbar.dart
→
lib/
AB/Screens/NavBar
/Navbar.dart
View file @
406e76f6
import
'package:flutter/material.dart'
;
import
'package:font_awesome_flutter/font_awesome_flutter.dart'
;
import
'package:ifarm/
Screens/AB
/Home.dart'
;
import
'package:ifarm/
Screens/AB
/Profile.dart'
;
import
'package:ifarm/
Screens/AB
/settings.dart'
;
import
'package:ifarm/
Screens/AB/shop
.dart'
;
import
'package:ifarm/AB/Screens/NavBar/FoodBucketSchedule.dart'
;
import
'package:ifarm/
AB/Screens/NavBar
/Home.dart'
;
import
'package:ifarm/
AB/Screens/NavBar
/Profile.dart'
;
import
'package:ifarm/
AB/Screens/NavBar
/settings.dart'
;
import
'package:ifarm/
AB/Utils/Colors
.dart'
;
class
Navbar
extends
StatefulWidget
{
Navbar
({
Key
?
key
,
Key
key
,
})
:
super
(
key:
key
);
@override
...
...
@@ -21,7 +21,7 @@ class _NavbarState extends State<Navbar> {
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
backgroundColor:
const
Color
(
0xff024F8E
)
,
backgroundColor:
backgroundColor
,
appBar:
AppBar
(
title:
const
SizedBox
(
width:
100
,
...
...
@@ -70,7 +70,7 @@ class _NavbarState extends State<Navbar> {
Widget
buildPages
()
{
switch
(
_selectedIndex
)
{
case
1
:
return
shop
();
return
FoodBucketSchedule
();
case
2
:
return
profile
();
case
3
:
...
...
This diff is collapsed.
Click to expand it.
lib/
Screens/AB
/Profile.dart
→
lib/
AB/Screens/NavBar
/Profile.dart
View file @
406e76f6
...
...
@@ -2,7 +2,7 @@ import 'package:firebase_auth/firebase_auth.dart';
import
'package:flutter/material.dart'
;
class
profile
extends
StatefulWidget
{
profile
({
Key
?
key
})
:
super
(
key:
key
);
profile
({
Key
key
})
:
super
(
key:
key
);
@override
State
<
profile
>
createState
()
=>
_profileState
();
...
...
This diff is collapsed.
Click to expand it.
lib/
Screens/AB
/settings.dart
→
lib/
AB/Screens/NavBar
/settings.dart
View file @
406e76f6
import
'package:firebase_auth/firebase_auth.dart'
;
import
'package:flutter/material.dart'
;
import
'package:ifarm/Screens/AB/Login.dart'
;
import
'package:ifarm/Screens/AB/SplashScreen.dart'
;
import
'package:ifarm/AB/Utils/ThemeProvider.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
import
'package:switcher_button/switcher_button.dart'
;
import
'../Common/SplashScreen.dart'
;
class
settings
extends
StatefulWidget
{
settings
({
Key
?
key
,
Key
key
,
})
:
super
(
key:
key
);
@override
...
...
@@ -28,22 +29,6 @@ class _settingsState extends State<settings> {
super
.
initState
();
}
getdata
()
async
{
print
(
'login'
);
SharedPreferences
localStorage
=
await
SharedPreferences
.
getInstance
();
var
foodswitch1
=
localStorage
.
getBool
(
'food'
)
as
bool
;
var
waterswitch1
=
localStorage
.
getBool
(
'water'
)
as
bool
;
var
environmentswitch1
=
localStorage
.
getBool
(
'env'
)
as
bool
;
var
securityswitch1
=
localStorage
.
getBool
(
'security'
)
as
bool
;
setState
(()
{
foodswitch
=
foodswitch1
;
waterswitch1
=
waterswitch1
;
environmentswitch
=
environmentswitch1
;
securityswitch
=
securityswitch1
;
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Container
(
...
...
@@ -60,7 +45,25 @@ class _settingsState extends State<settings> {
color:
Colors
.
white
,
fontSize:
30
,
fontWeight:
FontWeight
.
bold
),
)),
const
SizedBox
(
height:
70
,
height:
10
,
),
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
[
const
Expanded
(
child:
Text
(
'Theme'
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
17
),
)),
// Switch(
// value: _themeManager.themeMode == ThemeMode.dark,
// onChanged: (value) {
// _themeManager.toggleTheme(value);
// })
],
),
const
SizedBox
(
height:
40
,
),
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
...
...
@@ -221,4 +224,20 @@ class _settingsState extends State<settings> {
localStorage
.
setBool
(
'security'
,
value
);
print
(
'save'
);
}
getdata
()
async
{
print
(
'login'
);
SharedPreferences
localStorage
=
await
SharedPreferences
.
getInstance
();
var
foodswitch1
=
localStorage
.
getBool
(
'food'
)
as
bool
;
var
waterswitch1
=
localStorage
.
getBool
(
'water'
)
as
bool
;
var
environmentswitch1
=
localStorage
.
getBool
(
'env'
)
as
bool
;
var
securityswitch1
=
localStorage
.
getBool
(
'security'
)
as
bool
;
setState
(()
{
foodswitch
=
foodswitch1
;
waterswitch1
=
waterswitch1
;
environmentswitch
=
environmentswitch1
;
securityswitch
=
securityswitch1
;
});
}
}
This diff is collapsed.
Click to expand it.
lib/AB/Utils/Colors.dart
0 → 100644
View file @
406e76f6
import
'package:flutter/material.dart'
;
const
backgroundColor
=
Color
(
0xff024F8E
);
const
backgroundColorDark
=
Color
.
fromARGB
(
255
,
27
,
27
,
27
);
const
cardColor
=
Color
.
fromARGB
(
54
,
255
,
255
,
255
);
const
textColor
=
Color
.
fromARGB
(
255
,
255
,
255
,
255
);
const
subtextColor
=
Color
.
fromARGB
(
255
,
223
,
223
,
223
);
const
naviconSelectedColor
=
Color
.
fromARGB
(
255
,
255
,
255
,
255
);
const
naviconUnselectedColor
=
Color
.
fromARGB
(
255
,
170
,
170
,
170
);
const
yellowButton
=
Color
(
0xffFEC427
);
const
blacktxtColor
=
Color
.
fromARGB
(
255
,
0
,
0
,
0
);
This diff is collapsed.
Click to expand it.
lib/AB/Utils/ThemeProvider.dart
0 → 100644
View file @
406e76f6
import
'package:flutter/material.dart'
;
import
'package:ifarm/AB/Utils/Colors.dart'
;
class
ThemeProvider
with
ChangeNotifier
{
ThemeMode
_themeMode
=
ThemeMode
.
light
;
bool
get
themeMode
=>
_themeMode
==
ThemeMode
.
light
;
}
ThemeData
lightTheme
=
ThemeData
(
scaffoldBackgroundColor:
backgroundColor
,
colorScheme:
const
ColorScheme
.
light
(
primary:
backgroundColor
,
brightness:
Brightness
.
light
,
));
ThemeData
darkTheme
=
ThemeData
(
scaffoldBackgroundColor:
backgroundColorDark
,
colorScheme:
const
ColorScheme
.
dark
(
primary:
backgroundColorDark
,
brightness:
Brightness
.
dark
,
));
This diff is collapsed.
Click to expand it.
lib/
Screens/
AB/generated_plugin_registrant.dart
→
lib/AB/generated_plugin_registrant.dart
View file @
406e76f6
File moved
This diff is collapsed.
Click to expand it.
lib/
Screens/AB/shop
.dart
→
lib/
AB/widget/ChangeThemeButtonWidget
.dart
View file @
406e76f6
import
'package:flutter/material.dart'
;
class
shop
extends
Stateful
Widget
{
shop
({
Key
?
key
})
:
super
(
key:
key
);
class
ChangeThemeButtonWidget
extends
Stateless
Widget
{
const
ChangeThemeButtonWidget
({
Key
key
})
:
super
(
key:
key
);
@override
State
<
shop
>
createState
()
=>
_shopState
();
}
class
_shopState
extends
State
<
shop
>
{
@override
Widget
build
(
BuildContext
context
)
{
return
Container
();
...
...
This diff is collapsed.
Click to expand it.
lib/
Screens/AB
/QRCodeScanner.dart
→
lib/
AB/widget
/QRCodeScanner.dart
View file @
406e76f6
...
...
@@ -3,7 +3,7 @@ import 'package:flutter/services.dart';
import
'package:flutter_barcode_scanner/flutter_barcode_scanner.dart'
;
class
QRScanner
extends
StatefulWidget
{
QRScanner
({
Key
?
key
})
:
super
(
key:
key
);
QRScanner
({
Key
key
})
:
super
(
key:
key
);
@override
State
<
QRScanner
>
createState
()
=>
_QRScannerState
();
...
...
This diff is collapsed.
Click to expand it.
lib/widget/customizedTextField.dart
→
lib/
AB/
widget/customizedTextField.dart
View file @
406e76f6
import
'package:flutter/material.dart'
;
class
customizedTextField
extends
StatefulWidget
{
final
TextEditingController
?
mycontroller
;
final
String
?
lableText
,
empty
;
final
bool
?
isPassword
;
final
TextEditingController
mycontroller
;
final
String
lableText
,
empty
;
final
bool
isPassword
;
customizedTextField
(
{
Key
?
key
,
this
.
mycontroller
,
this
.
lableText
,
this
.
isPassword
,
this
.
empty
})
{
Key
key
,
this
.
mycontroller
,
this
.
lableText
,
this
.
isPassword
,
this
.
empty
})
:
super
(
key:
key
);
@override
...
...
@@ -36,7 +32,7 @@ class _customizedTextFieldState extends State<customizedTextField> {
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
20
),
child:
TextFormField
(
validator:
(
value
)
{
if
(
value
!
.
isEmpty
)
{
if
(
value
.
isEmpty
)
{
return
widget
.
empty
;
}
},
...
...
@@ -45,7 +41,7 @@ class _customizedTextFieldState extends State<customizedTextField> {
style:
const
TextStyle
(
color:
Color
.
fromARGB
(
255
,
0
,
0
,
0
)),
cursorColor:
const
Color
.
fromARGB
(
255
,
0
,
0
,
0
),
decoration:
InputDecoration
(
suffixIcon:
widget
.
isPassword
!
suffixIcon:
widget
.
isPassword
?
GestureDetector
(
onTap:
()
{
_toggle
();
...
...
This diff is collapsed.
Click to expand it.
lib/Screens/AB/Bucket.dart
deleted
100644 → 0
View file @
089c3954
import
'package:cloud_firestore/cloud_firestore.dart'
;
class
Bucket
{
final
List
<
String
>?
bucketId
;
Bucket
({
this
.
bucketId
});
factory
Bucket
.
fromFirestore
(
DocumentSnapshot
<
Map
<
String
,
dynamic
>>
snapshot
,
)
{
final
data
=
snapshot
.
data
();
return
Bucket
(
bucketId:
data
?[
'Buckets'
]
is
Iterable
?
List
.
from
(
data
?[
'regions'
])
:
null
);
}
}
This diff is collapsed.
Click to expand it.
lib/Screens/AB/Firebaselist.dart
deleted
100644 → 0
View file @
089c3954
import
'package:firebase_database/firebase_database.dart'
;
import
'package:firebase_database/ui/firebase_animated_list.dart'
;
import
'package:flutter/material.dart'
;
class
firebaselist
extends
StatefulWidget
{
firebaselist
({
Key
?
key
})
:
super
(
key:
key
);
@override
State
<
firebaselist
>
createState
()
=>
_firebaselistState
();
}
class
_firebaselistState
extends
State
<
firebaselist
>
{
final
firebasedatalist
=
FirebaseDatabase
.
instance
;
@override
Widget
build
(
BuildContext
context
)
{
Query
ref
=
firebasedatalist
.
ref
().
child
(
'Food'
);
return
Scaffold
(
appBar:
AppBar
(
centerTitle:
true
,
title:
const
Text
(
'Device'
,
style:
TextStyle
(
fontSize:
30
,
),
),
backgroundColor:
Colors
.
indigo
[
900
],
),
body:
FirebaseAnimatedList
(
query:
ref
,
itemBuilder:
(
context
,
snapshot
,
animation
,
index
)
{
return
GestureDetector
(
onTap:
()
{},
child:
Container
(
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
ListTile
(
shape:
RoundedRectangleBorder
(
side:
const
BorderSide
(
color:
Colors
.
white
,
),
borderRadius:
BorderRadius
.
circular
(
10
),
),
tileColor:
Colors
.
indigo
[
100
],
trailing:
IconButton
(
icon:
Icon
(
Icons
.
delete
,
color:
Colors
.
red
[
900
],
),
onPressed:
()
{
firebasedatalist
.
ref
()
.
child
(
'Food'
)
.
child
(
snapshot
.
key
!)
.
remove
();
},
),
title:
Text
(
snapshot
.
key
.
toString
(),
style:
const
TextStyle
(
fontSize:
25
,
fontWeight:
FontWeight
.
bold
,
),
),
),
),
),
);
}));
}
}
This diff is collapsed.
Click to expand it.
lib/functions/authFunctions.dart
View file @
406e76f6
import
'package:firebase_auth/firebase_auth.dart'
;
import
'package:flutter/material.dart'
;
import
'package:fluttertoast/fluttertoast.dart'
;
import
'package:ifarm/Screens/AB/Navbar.dart'
;
import
'package:ifarm/Screens/AB/SplashScreen.dart'
;
import
'package:ifarm/AB/Screens/NavBar/Navbar.dart'
;
import
'package:ifarm/functions/firebaseFunctions.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
...
...
@@ -13,8 +12,8 @@ class AuthServices {
UserCredential
userCredential
=
await
FirebaseAuth
.
instance
.
createUserWithEmailAndPassword
(
email:
email
,
password:
password
);
await
FirebaseAuth
.
instance
.
currentUser
!
.
updateDisplayName
(
name
);
await
FirebaseAuth
.
instance
.
currentUser
!
.
updateEmail
(
email
);
await
FirebaseAuth
.
instance
.
currentUser
.
updateDisplayName
(
name
);
await
FirebaseAuth
.
instance
.
currentUser
.
updateEmail
(
email
);
await
FirestoreServices
.
saveUser
(
name
,
email
);
Fluttertoast
.
showToast
(
msg:
'Registration Successful'
,
...
...
This diff is collapsed.
Click to expand it.
lib/main.dart
View file @
406e76f6
...
...
@@ -2,8 +2,9 @@ import 'dart:io';
import
'package:firebase_core/firebase_core.dart'
;
import
'package:flutter/material.dart'
;
import
'package:ifarm/AB/Utils/ThemeProvider.dart'
;
import
'
Screens/AB
/SplashScreen.dart'
;
import
'
AB/Screens/Common
/SplashScreen.dart'
;
void
main
(
)
async
{
WidgetsFlutterBinding
.
ensureInitialized
();
...
...
@@ -13,16 +14,16 @@ void main() async {
}
class
MyApp
extends
StatelessWidget
{
const
MyApp
({
Key
?
key
})
:
super
(
key:
key
);
const
MyApp
({
Key
key
})
:
super
(
key:
key
);
@override
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
debugShowCheckedModeBanner:
false
,
title:
'IFarm'
,
theme:
ThemeData
(
primarySwatch:
Colors
.
blu
e
,
)
,
theme:
lightTheme
,
darkTheme:
darkThem
e
,
themeMode:
ThemeMode
.
system
,
home:
splashScreen
(),
);
}
...
...
This diff is collapsed.
Click to expand it.
pubspec.yaml
View file @
406e76f6
...
...
@@ -7,7 +7,7 @@ publish_to: 'none'
version
:
1.0.0+1
environment
:
sdk
:
"
>=2.
16
.2
<3.0.0"
sdk
:
"
>=2.
7
.2
<3.0.0"
dependencies
:
flutter
:
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment