Commit 10652cad authored by ayodyabanuka's avatar ayodyabanuka

updated

parent 7d209d0b
import 'dart:ffi';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.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/services.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/functions/firebaseFunctions.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/Profile.dart';
......@@ -20,7 +21,7 @@ class _NavbarState extends State<Navbar> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xff024F8E),
backgroundColor: const Color(0xff024F8E),
appBar: AppBar(
title: const SizedBox(
width: 100,
......@@ -43,7 +44,7 @@ class _NavbarState extends State<Navbar> {
],
),
bottomNavigationBar: BottomNavigationBar(
backgroundColor: Color.fromARGB(150, 6, 91, 161),
backgroundColor: const Color.fromARGB(150, 6, 91, 161),
type: BottomNavigationBarType.fixed,
elevation: 1,
currentIndex: _selectedIndex,
......@@ -52,10 +53,14 @@ class _NavbarState extends State<Navbar> {
showSelectedLabels: false,
showUnselectedLabels: false,
items: const [
BottomNavigationBarItem(label: 'Home', icon: Icon(Icons.home)),
BottomNavigationBarItem(label: 'Buy', icon: Icon(Icons.shopping_bag)),
BottomNavigationBarItem(label: 'Profile', icon: Icon(Icons.person)),
BottomNavigationBarItem(label: 'Settings', icon: Icon(Icons.settings))
BottomNavigationBarItem(
label: 'Home', icon: FaIcon(FontAwesomeIcons.house)),
BottomNavigationBarItem(
label: 'Statistic', icon: FaIcon(FontAwesomeIcons.chartLine)),
BottomNavigationBarItem(
label: 'Profile', icon: FaIcon(FontAwesomeIcons.user)),
BottomNavigationBarItem(
label: 'Settings', icon: FaIcon(FontAwesomeIcons.gear))
],
onTap: _onItemTapped,
),
......
import 'dart:async';
import 'package:animated_toggle_switch/animated_toggle_switch.dart';
import 'package:firebase_database/firebase_database.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:switcher_button/switcher_button.dart';
......@@ -94,188 +92,182 @@ class _datafromfirebaseState extends State<datafromfirebase> {
elevation: 0,
),
backgroundColor: const Color(0xff024F8E),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
height: 40,
),
const Text(
'Bucket',
style: TextStyle(
color: Color.fromARGB(255, 255, 255, 255),
fontSize: 30,
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(
height: 20,
),
const Text(
'Bucket',
style: TextStyle(
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',
fontWeight: FontWeight.bold),
),
Text(
widget.bucketId,
style: const TextStyle(
color: Color.fromARGB(136, 255, 255, 255),
fontSize: 25,
fontFamily: 'poppins',
),
),
),
const SizedBox(
height: 30,
),
Container(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 100,
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,
const SizedBox(
height: 30,
),
Container(
padding:
const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: const [
FaIcon(
FontAwesomeIcons.fill,
color: Color.fromARGB(255, 0, 0, 0),
),
SizedBox(
width: 10,
),
Text(
'Food Presentage',
style: TextStyle(
fontSize: 20,
color: Color.fromARGB(179, 0, 0, 0),
fontFamily: 'poppins',
LiquidCustomProgressIndicator(
center: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
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),
),
],
),
),
],
],
),
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(
mainAxisAlignment: MainAxisAlignment.center,
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 SizedBox(
height: 5,
),
const Image(
image:
AssetImage('assets/images/bucket_bottom.png'),
color: Color.fromARGB(255, 255, 145, 0),
width: 250,
)
],
),
),
),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)),
elevation: 2,
color: double.parse(m) == 0 ? Colors.green : Colors.red,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
const SizedBox(
height: 10,
),
const Text(
'Moisture',
style: TextStyle(
fontSize: 20,
color: Colors.white70,
fontFamily: 'poppins',
const SizedBox(
height: 30,
),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)),
elevation: 2,
color: double.parse(m) == 0 ? Colors.green : Colors.red,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
const SizedBox(
height: 10,
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
m,
style: const TextStyle(
color: Colors.white,
fontSize: 40,
fontFamily: 'poppins',
),
const Text(
'Moisture',
style: TextStyle(
fontSize: 20,
color: Colors.white70,
fontFamily: 'poppins',
),
],
),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
m,
style: const TextStyle(
color: Colors.white,
fontSize: 40,
fontFamily: 'poppins',
),
),
],
),
],
),
),
),
),
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)),
elevation: 2,
color: svalue ? Colors.green : Colors.red,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
const SizedBox(
height: 10,
),
const Text(
'Food',
style: TextStyle(
fontSize: 20,
color: Colors.white70,
fontFamily: 'poppins',
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15)),
elevation: 2,
color: svalue ? Colors.green : Colors.red,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
const SizedBox(
height: 10,
),
),
const SizedBox(
height: 8,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SwitcherButton(
onColor: Colors.white,
offColor: Colors.black,
value: svalue,
onChange: (value) {
setState(() {
svalue = value;
const Text(
'Food',
style: TextStyle(
fontSize: 20,
color: Colors.white70,
fontFamily: 'poppins',
),
),
const SizedBox(
height: 8,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SwitcherButton(
onColor: Colors.white,
offColor: Colors.black,
value: svalue,
onChange: (value) {
setState(() {
svalue = value;
updateone(value);
print(value);
});
},
)
],
),
const SizedBox(
height: 10,
),
],
updateone(value);
print(value);
});
},
)
],
),
const SizedBox(
height: 10,
),
],
),
),
),
),
],
],
),
),
),
],
],
),
),
),
);
......@@ -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();
}
}
......@@ -14,4 +14,11 @@ class FirestoreServices {
.doc(name)
.set({'Buckets': foodbucketID});
}
static removefoodbuckets(foodbucketID, name) async {
await FirebaseFirestore.instance
.collection('buckets')
.doc(name)
.set({'Buckets': foodbucketID});
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment