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
10652cad
Commit
10652cad
authored
Oct 13, 2022
by
ayodyabanuka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated
parent
7d209d0b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
185 additions
and
176 deletions
+185
-176
assets/images/bucket_bottom.png
assets/images/bucket_bottom.png
+0
-0
lib/Screens/AB/Food.dart
lib/Screens/AB/Food.dart
+0
-4
lib/Screens/AB/Navbar.dart
lib/Screens/AB/Navbar.dart
+11
-6
lib/Screens/AB/data.dart
lib/Screens/AB/data.dart
+167
-166
lib/functions/firebaseFunctions.dart
lib/functions/firebaseFunctions.dart
+7
-0
No files found.
assets/images/bucket_bottom.png
0 → 100644
View file @
10652cad
1.87 KB
lib/Screens/AB/Food.dart
View file @
10652cad
import
'dart:ffi'
;
import
'package:cloud_firestore/cloud_firestore.dart'
;
import
'package:cloud_firestore/cloud_firestore.dart'
;
import
'package:firebase_auth/firebase_auth.dart'
;
import
'package:firebase_auth/firebase_auth.dart'
;
import
'package:firebase_database/firebase_database.dart'
;
import
'package:firebase_database/firebase_database.dart'
;
import
'package:firebase_database/ui/firebase_animated_list.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter/services.dart'
;
import
'package:flutter_barcode_scanner/flutter_barcode_scanner.dart'
;
import
'package:flutter_barcode_scanner/flutter_barcode_scanner.dart'
;
import
'package:ifarm/Screens/AB/bucket.dart'
;
import
'package:ifarm/Screens/AB/data.dart'
;
import
'package:ifarm/Screens/AB/data.dart'
;
import
'package:ifarm/functions/firebaseFunctions.dart'
;
import
'package:ifarm/functions/firebaseFunctions.dart'
;
...
...
lib/Screens/AB/Navbar.dart
View file @
10652cad
import
'package:flutter/material.dart'
;
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/Home.dart'
;
import
'package:ifarm/Screens/AB/Profile.dart'
;
import
'package:ifarm/Screens/AB/Profile.dart'
;
...
@@ -20,7 +21,7 @@ class _NavbarState extends State<Navbar> {
...
@@ -20,7 +21,7 @@ class _NavbarState extends State<Navbar> {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
Scaffold
(
backgroundColor:
Color
(
0xff024F8E
),
backgroundColor:
const
Color
(
0xff024F8E
),
appBar:
AppBar
(
appBar:
AppBar
(
title:
const
SizedBox
(
title:
const
SizedBox
(
width:
100
,
width:
100
,
...
@@ -43,7 +44,7 @@ class _NavbarState extends State<Navbar> {
...
@@ -43,7 +44,7 @@ class _NavbarState extends State<Navbar> {
],
],
),
),
bottomNavigationBar:
BottomNavigationBar
(
bottomNavigationBar:
BottomNavigationBar
(
backgroundColor:
Color
.
fromARGB
(
150
,
6
,
91
,
161
),
backgroundColor:
const
Color
.
fromARGB
(
150
,
6
,
91
,
161
),
type:
BottomNavigationBarType
.
fixed
,
type:
BottomNavigationBarType
.
fixed
,
elevation:
1
,
elevation:
1
,
currentIndex:
_selectedIndex
,
currentIndex:
_selectedIndex
,
...
@@ -52,10 +53,14 @@ class _NavbarState extends State<Navbar> {
...
@@ -52,10 +53,14 @@ class _NavbarState extends State<Navbar> {
showSelectedLabels:
false
,
showSelectedLabels:
false
,
showUnselectedLabels:
false
,
showUnselectedLabels:
false
,
items:
const
[
items:
const
[
BottomNavigationBarItem
(
label:
'Home'
,
icon:
Icon
(
Icons
.
home
)),
BottomNavigationBarItem
(
BottomNavigationBarItem
(
label:
'Buy'
,
icon:
Icon
(
Icons
.
shopping_bag
)),
label:
'Home'
,
icon:
FaIcon
(
FontAwesomeIcons
.
house
)),
BottomNavigationBarItem
(
label:
'Profile'
,
icon:
Icon
(
Icons
.
person
)),
BottomNavigationBarItem
(
BottomNavigationBarItem
(
label:
'Settings'
,
icon:
Icon
(
Icons
.
settings
))
label:
'Statistic'
,
icon:
FaIcon
(
FontAwesomeIcons
.
chartLine
)),
BottomNavigationBarItem
(
label:
'Profile'
,
icon:
FaIcon
(
FontAwesomeIcons
.
user
)),
BottomNavigationBarItem
(
label:
'Settings'
,
icon:
FaIcon
(
FontAwesomeIcons
.
gear
))
],
],
onTap:
_onItemTapped
,
onTap:
_onItemTapped
,
),
),
...
...
lib/Screens/AB/data.dart
View file @
10652cad
import
'dart:async'
;
import
'dart:async'
;
import
'package:animated_toggle_switch/animated_toggle_switch.dart'
;
import
'package:firebase_database/firebase_database.dart'
;
import
'package:firebase_database/firebase_database.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:font_awesome_flutter/font_awesome_flutter.dart'
;
import
'package:liquid_progress_indicator/liquid_progress_indicator.dart'
;
import
'package:liquid_progress_indicator/liquid_progress_indicator.dart'
;
import
'package:switcher_button/switcher_button.dart'
;
import
'package:switcher_button/switcher_button.dart'
;
...
@@ -94,188 +92,182 @@ class _datafromfirebaseState extends State<datafromfirebase> {
...
@@ -94,188 +92,182 @@ class _datafromfirebaseState extends State<datafromfirebase> {
elevation:
0
,
elevation:
0
,
),
),
backgroundColor:
const
Color
(
0xff024F8E
),
backgroundColor:
const
Color
(
0xff024F8E
),
body:
Padding
(
body:
SingleChildScrollView
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
20
),
child:
Padding
(
child:
Column
(
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
20
),
crossAxisAlignment:
CrossAxisAlignment
.
start
,
child:
Column
(
children:
[
crossAxisAlignment:
CrossAxisAlignment
.
start
,
const
SizedBox
(
children:
[
height:
40
,
const
SizedBox
(
),
height:
20
,
const
Text
(
),
'Bucket'
,
const
Text
(
style:
TextStyle
(
'Bucket'
,
color:
Color
.
fromARGB
(
255
,
255
,
255
,
255
),
style:
TextStyle
(
fontSize:
30
,
color:
Color
.
fromARGB
(
255
,
255
,
255
,
255
),
fontSize:
30
,
fontFamily:
'poppins'
,
fontWeight:
FontWeight
.
bold
),
),
Text
(
widget
.
bucketId
,
style:
const
TextStyle
(
color:
Color
.
fromARGB
(
136
,
255
,
255
,
255
),
fontSize:
25
,
fontFamily:
'poppins'
,
fontFamily:
'poppins'
,
fontWeight:
FontWeight
.
bold
),
),
),
Text
(
widget
.
bucketId
,
style:
const
TextStyle
(
color:
Color
.
fromARGB
(
136
,
255
,
255
,
255
),
fontSize:
25
,
fontFamily:
'poppins'
,
),
),
),
const
SizedBox
(
const
SizedBox
(
height:
30
,
height:
30
,
),
),
Container
(
Container
(
padding:
padding:
const
EdgeInsets
.
symmetric
(
horizontal:
20
,
vertical:
20
),
const
EdgeInsets
.
symmetric
(
horizontal:
20
,
vertical:
20
),
child:
Column
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
children:
[
children:
[
SizedBox
(
Center
(
height:
100
,
child:
Column
(
width:
310
,
child:
LiquidLinearProgressIndicator
(
value:
double
.
parse
(
d
)
/
300
,
// Defaults to 0.5.
valueColor:
AlwaysStoppedAnimation
(
double
.
parse
(
d
)
>=
70.0
&&
double
.
parse
(
d
)
<=
90.0
?
Colors
.
green
:
Colors
.
red
,
),
backgroundColor:
const
Color
.
fromARGB
(
255
,
255
,
255
,
255
),
borderRadius:
20
,
direction:
Axis
.
vertical
,
center:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
children:
[
Row
(
LiquidCustomProgressIndicator
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
center:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
const
[
children:
[
FaIcon
(
Row
(
FontAwesomeIcons
.
fill
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
color:
Color
.
fromARGB
(
255
,
0
,
0
,
0
),
children:
[
),
Text
(
SizedBox
(
d
,
width:
10
,
style:
const
TextStyle
(
),
fontSize:
20
,
Text
(
color:
Color
.
fromARGB
(
255
,
0
,
0
,
0
),
'Food Presentage'
,
fontWeight:
FontWeight
.
bold
),
style:
TextStyle
(
),
fontSize:
20
,
const
Text
(
color:
Color
.
fromARGB
(
179
,
0
,
0
,
0
),
'%'
,
fontFamily:
'poppins'
,
style:
TextStyle
(
color:
Color
.
fromARGB
(
255
,
0
,
0
,
0
),
fontWeight:
FontWeight
.
bold
),
),
],
),
),
),
],
],
),
value:
double
.
parse
(
d
)
/
100
,
valueColor:
AlwaysStoppedAnimation
(
double
.
parse
(
d
)
>=
0.0
&&
double
.
parse
(
d
)
<=
20.0
?
Color
.
fromARGB
(
255
,
255
,
0
,
0
)
:
Colors
.
green
,
),
backgroundColor:
Color
.
fromARGB
(
255
,
255
,
255
,
255
),
direction:
Axis
.
vertical
,
shapePath:
_buildBoatPath
(),
),
),
Row
(
const
SizedBox
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
height:
5
,
children:
[
Text
(
d
,
style:
const
TextStyle
(
fontSize:
20
,
color:
Color
.
fromARGB
(
255
,
0
,
0
,
0
),
fontWeight:
FontWeight
.
bold
),
),
const
Text
(
'%'
,
style:
TextStyle
(
color:
Color
.
fromARGB
(
255
,
0
,
0
,
0
),
fontWeight:
FontWeight
.
bold
),
),
],
),
),
const
Image
(
image:
AssetImage
(
'assets/images/bucket_bottom.png'
),
color:
Color
.
fromARGB
(
255
,
255
,
145
,
0
),
width:
250
,
)
],
],
),
),
),
),
),
const
SizedBox
(
Card
(
height:
30
,
shape:
RoundedRectangleBorder
(
),
borderRadius:
BorderRadius
.
circular
(
15
)),
Card
(
elevation:
2
,
shape:
RoundedRectangleBorder
(
color:
double
.
parse
(
m
)
==
0
?
Colors
.
green
:
Colors
.
red
,
borderRadius:
BorderRadius
.
circular
(
15
)),
child:
Padding
(
elevation:
2
,
padding:
const
EdgeInsets
.
all
(
8.0
),
color:
double
.
parse
(
m
)
==
0
?
Colors
.
green
:
Colors
.
red
,
child:
Column
(
child:
Padding
(
children:
[
padding:
const
EdgeInsets
.
all
(
8.0
),
const
SizedBox
(
child:
Column
(
height:
10
,
children:
[
),
const
SizedBox
(
const
Text
(
height:
10
,
'Moisture'
,
style:
TextStyle
(
fontSize:
20
,
color:
Colors
.
white70
,
fontFamily:
'poppins'
,
),
),
),
const
Text
(
Row
(
'Moisture'
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
style:
TextStyle
(
children:
[
fontSize:
20
,
Text
(
color:
Colors
.
white70
,
m
,
fontFamily:
'poppins'
,
style:
const
TextStyle
(
color:
Colors
.
white
,
fontSize:
40
,
fontFamily:
'poppins'
,
),
),
),
],
),
),
Row
(
],
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
[
Text
(
m
,
style:
const
TextStyle
(
color:
Colors
.
white
,
fontSize:
40
,
fontFamily:
'poppins'
,
),
),
],
),
],
),
),
),
),
),
),
Card
(
Card
(
shape:
RoundedRectangleBorder
(
shape:
RoundedRectangleBorder
(
borderRadius:
BorderRadius
.
circular
(
15
)),
borderRadius:
BorderRadius
.
circular
(
15
)),
elevation:
2
,
elevation:
2
,
color:
svalue
?
Colors
.
green
:
Colors
.
red
,
color:
svalue
?
Colors
.
green
:
Colors
.
red
,
child:
Padding
(
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
8.0
),
padding:
const
EdgeInsets
.
all
(
8.0
),
child:
Column
(
child:
Column
(
children:
[
children:
[
const
SizedBox
(
const
SizedBox
(
height:
10
,
height:
10
,
),
const
Text
(
'Food'
,
style:
TextStyle
(
fontSize:
20
,
color:
Colors
.
white70
,
fontFamily:
'poppins'
,
),
),
),
const
Text
(
const
SizedBox
(
'Food'
,
height:
8
,
style:
TextStyle
(
),
fontSize:
20
,
Row
(
color:
Colors
.
white70
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
fontFamily:
'poppins'
,
children:
[
),
SwitcherButton
(
),
onColor:
Colors
.
white
,
const
SizedBox
(
offColor:
Colors
.
black
,
height:
8
,
value:
svalue
,
),
onChange:
(
value
)
{
Row
(
setState
(()
{
mainAxisAlignment:
MainAxisAlignment
.
center
,
svalue
=
value
;
children:
[
SwitcherButton
(
onColor:
Colors
.
white
,
offColor:
Colors
.
black
,
value:
svalue
,
onChange:
(
value
)
{
setState
(()
{
svalue
=
value
;
updateone
(
value
);
updateone
(
value
);
print
(
value
);
print
(
value
);
});
});
},
},
)
)
],
],
),
),
const
SizedBox
(
const
SizedBox
(
height:
10
,
height:
10
,
),
),
],
],
),
),
),
),
),
)
,
]
,
]
,
)
,
),
),
)
,
]
,
]
,
)
,
),
),
),
),
);
);
...
@@ -293,4 +285,13 @@ class _datafromfirebaseState extends State<datafromfirebase> {
...
@@ -293,4 +285,13 @@ class _datafromfirebaseState extends State<datafromfirebase> {
});
});
}
}
}
}
Path
_buildBoatPath
()
{
return
Path
()
..
moveTo
(
0
,
170
)
..
lineTo
(
30
,
00
)
..
lineTo
(
150
,
00
)
..
lineTo
(
180
,
170
)
..
close
();
}
}
}
lib/functions/firebaseFunctions.dart
View file @
10652cad
...
@@ -14,4 +14,11 @@ class FirestoreServices {
...
@@ -14,4 +14,11 @@ class FirestoreServices {
.
doc
(
name
)
.
doc
(
name
)
.
set
({
'Buckets'
:
foodbucketID
});
.
set
({
'Buckets'
:
foodbucketID
});
}
}
static
removefoodbuckets
(
foodbucketID
,
name
)
async
{
await
FirebaseFirestore
.
instance
.
collection
(
'buckets'
)
.
doc
(
name
)
.
set
({
'Buckets'
:
foodbucketID
});
}
}
}
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