Commit 406e76f6 authored by ayodyabanuka's avatar ayodyabanuka

updated Files

parent 089c3954
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
android:exported="true" android:exported="true"
android:launchMode="singleTop" android:launchMode="singleTop"
android:theme="@style/LaunchTheme" android:theme="@style/LaunchTheme"
android:showWhenLocked="true"
android:turnScreenOn="true"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"> android:windowSoftInputMode="adjustResize">
......
...@@ -10,4 +10,7 @@ import Flutter ...@@ -10,4 +10,7 @@ import Flutter
GeneratedPluginRegistrant.register(with: self) GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions) return super.application(application, didFinishLaunchingWithOptions: launchOptions)
} }
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
}
} }
import 'dart:io';
import 'dart:ui'; import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.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/functions/authFunctions.dart';
import 'package:ifarm/widget/customizedTextField.dart';
class Login extends StatefulWidget { class Login extends StatefulWidget {
Login({Key? key}) : super(key: key); Login({Key key}) : super(key: key);
@override @override
State<Login> createState() => _LoginState(); State<Login> createState() => _LoginState();
...@@ -36,7 +36,7 @@ class _LoginState extends State<Login> { ...@@ -36,7 +36,7 @@ class _LoginState extends State<Login> {
Size size = MediaQuery.of(context).size; Size size = MediaQuery.of(context).size;
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
backgroundColor: const Color(0xff024F8E), backgroundColor: backgroundColor,
elevation: 0, elevation: 0,
toolbarHeight: 0, toolbarHeight: 0,
), ),
...@@ -46,7 +46,7 @@ class _LoginState extends State<Login> { ...@@ -46,7 +46,7 @@ class _LoginState extends State<Login> {
Container( Container(
height: size.height, height: size.height,
width: size.width, width: size.width,
color: const Color(0xff024F8E), color: backgroundColor,
child: Transform.translate( child: Transform.translate(
offset: const Offset(0, -190), offset: const Offset(0, -190),
child: Image.asset( child: Image.asset(
...@@ -72,7 +72,7 @@ class _LoginState extends State<Login> { ...@@ -72,7 +72,7 @@ class _LoginState extends State<Login> {
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
color: const Color.fromARGB(255, 241, 246, 255)), color: const Color.fromARGB(255, 241, 246, 255)),
color: const Color(0xff06375F).withOpacity(0.37), color: backgroundColor.withOpacity(0.37),
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
), ),
child: Column( child: Column(
...@@ -133,9 +133,9 @@ class _LoginState extends State<Login> { ...@@ -133,9 +133,9 @@ class _LoginState extends State<Login> {
Checkbox( Checkbox(
checkColor: Colors.white, checkColor: Colors.white,
value: isChecked, value: isChecked,
onChanged: (bool? value) { onChanged: (bool value) {
setState(() { setState(() {
isChecked = value!; isChecked = value;
}); });
}), }),
const Text( const Text(
...@@ -165,8 +165,7 @@ class _LoginState extends State<Login> { ...@@ -165,8 +165,7 @@ class _LoginState extends State<Login> {
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 20, vertical: 10), horizontal: 20, vertical: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(color: yellowButton),
color: const Color(0xffFEC427)),
borderRadius: borderRadius:
BorderRadius.circular(10)), BorderRadius.circular(10)),
child: const Padding( child: const Padding(
...@@ -180,6 +179,9 @@ class _LoginState extends State<Login> { ...@@ -180,6 +179,9 @@ class _LoginState extends State<Login> {
), ),
), ),
)), )),
const SizedBox(
width: 10,
),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
print(emailController.text); print(emailController.text);
...@@ -203,7 +205,7 @@ class _LoginState extends State<Login> { ...@@ -203,7 +205,7 @@ class _LoginState extends State<Login> {
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 20, vertical: 10), horizontal: 20, vertical: 10),
decoration: BoxDecoration( decoration: BoxDecoration(
color: const Color(0xffFEC427), color: yellowButton,
borderRadius: borderRadius:
BorderRadius.circular(10)), BorderRadius.circular(10)),
child: const Padding( child: const Padding(
...@@ -211,7 +213,9 @@ class _LoginState extends State<Login> { ...@@ -211,7 +213,9 @@ class _LoginState extends State<Login> {
horizontal: 5, vertical: 1), horizontal: 5, vertical: 1),
child: Text( child: Text(
'Login', 'Login',
style: TextStyle(fontFamily: 'poppins'), style: TextStyle(
fontFamily: 'poppins',
color: blacktxtColor),
), ),
), ),
)), )),
......
import 'dart:ui';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.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/functions/authFunctions.dart';
import 'package:ifarm/widget/customizedTextField.dart'; import 'package:ifarm/AB/widget/customizedTextField.dart';
class register extends StatefulWidget { class register extends StatefulWidget {
register({Key? key}) : super(key: key); register({Key key}) : super(key: key);
@override @override
State<register> createState() => _registerState(); State<register> createState() => _registerState();
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:ifarm/Screens/AB/SplashScreen.dart';
import 'SplashScreen.dart';
class networkError extends StatefulWidget { class networkError extends StatefulWidget {
networkError({Key? key}) : super(key: key); networkError({Key key}) : super(key: key);
@override @override
State<networkError> createState() => _networkErrorState(); State<networkError> createState() => _networkErrorState();
......
import 'dart:async'; import 'dart:async';
import 'dart:io';
import 'package:connectivity_plus/connectivity_plus.dart'; import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:ifarm/Screens/AB/Login.dart'; import 'package:ifarm/AB/Screens/Common/Auth/Login.dart';
import 'package:ifarm/Screens/AB/Navbar.dart'; import 'package:ifarm/AB/Screens/NavBar/Navbar.dart';
import 'package:ifarm/Screens/AB/NetworkErrorPage.dart';
import 'package:ifarm/functions/Network.dart'; import 'package:ifarm/functions/Network.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
class splashScreen extends StatefulWidget { class splashScreen extends StatefulWidget {
splashScreen({Key? key}) : super(key: key); splashScreen({Key key}) : super(key: key);
@override @override
State<splashScreen> createState() => _splashScreenState(); State<splashScreen> createState() => _splashScreenState();
} }
int? logged; int logged;
class _splashScreenState extends State<splashScreen> class _splashScreenState extends State<splashScreen>
with TickerProviderStateMixin { with TickerProviderStateMixin {
bool isoffline = false; bool isoffline = false;
Map _source = {ConnectivityResult.none: false}; final Map _source = {ConnectivityResult.none: false};
final NetworkConnectivity _networkConnectivity = NetworkConnectivity.instance; final NetworkConnectivity _networkConnectivity = NetworkConnectivity.instance;
String string = ''; String string = '';
late AnimationController _controller;
void initState() { void initState() {
getdata(); getdata();
savedata(); savedata();
super.initState(); 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 @override
......
...@@ -4,11 +4,12 @@ import 'package:firebase_database/firebase_database.dart'; ...@@ -4,11 +4,12 @@ import 'package:firebase_database/firebase_database.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/data.dart'; import 'package:ifarm/AB/Screens/FoodBucket/SingleFoodBucketData.dart';
import 'package:ifarm/AB/Utils/Colors.dart';
import 'package:ifarm/functions/firebaseFunctions.dart'; import 'package:ifarm/functions/firebaseFunctions.dart';
class foodbuckets extends StatefulWidget { class foodbuckets extends StatefulWidget {
foodbuckets({Key? key}) : super(key: key); foodbuckets({Key key}) : super(key: key);
@override @override
State<foodbuckets> createState() => _foodbucketsState(); State<foodbuckets> createState() => _foodbucketsState();
...@@ -65,7 +66,7 @@ class _foodbucketsState extends State<foodbuckets> { ...@@ -65,7 +66,7 @@ class _foodbucketsState extends State<foodbuckets> {
return const Center(child: CircularProgressIndicator()); return const Center(child: CircularProgressIndicator());
} }
final storedata = []; final storedata = [];
snapshot.data!.docs.map((DocumentSnapshot document) { snapshot.data.docs.map((DocumentSnapshot document) {
Map a = document.data() as Map<String, dynamic>; Map a = document.data() as Map<String, dynamic>;
storedata.add(a); storedata.add(a);
}).toList(); }).toList();
...@@ -87,14 +88,15 @@ class _foodbucketsState extends State<foodbuckets> { ...@@ -87,14 +88,15 @@ class _foodbucketsState extends State<foodbuckets> {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => datafromfirebase( builder: (context) =>
SingleFoodBucketData(
bucketId: storedata[0]['Buckets'] bucketId: storedata[0]['Buckets']
[index], [index],
))); )));
}, },
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: cardColor,
borderRadius: BorderRadius.circular(15)), borderRadius: BorderRadius.circular(15)),
margin: const EdgeInsets.symmetric(vertical: 5), margin: const EdgeInsets.symmetric(vertical: 5),
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
......
...@@ -4,12 +4,12 @@ import 'package:flutter/material.dart'; ...@@ -4,12 +4,12 @@ import 'package:flutter/material.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';
class datafromfirebase extends StatefulWidget { class SingleFoodBucketData extends StatefulWidget {
String bucketId; String bucketId;
datafromfirebase({Key? key, required this.bucketId}) : super(key: key); SingleFoodBucketData({Key key, this.bucketId}) : super(key: key);
@override @override
State<datafromfirebase> createState() => _datafromfirebaseState(); State<SingleFoodBucketData> createState() => _SingleFoodBucketDataState();
} }
String d = '100'; String d = '100';
...@@ -17,7 +17,7 @@ String m = '250'; ...@@ -17,7 +17,7 @@ String m = '250';
int s = 0; int s = 0;
bool svalue = false; bool svalue = false;
class _datafromfirebaseState extends State<datafromfirebase> { class _SingleFoodBucketDataState extends State<SingleFoodBucketData> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
...@@ -27,7 +27,7 @@ class _datafromfirebaseState extends State<datafromfirebase> { ...@@ -27,7 +27,7 @@ class _datafromfirebaseState extends State<datafromfirebase> {
servovalueinbool(); servovalueinbool();
} }
Timer? timer; Timer timer;
void runTimer() { void runTimer() {
timer = Timer.periodic(const Duration(seconds: 2), (_) { timer = Timer.periodic(const Duration(seconds: 2), (_) {
getData(); getData();
...@@ -85,7 +85,7 @@ class _datafromfirebaseState extends State<datafromfirebase> { ...@@ -85,7 +85,7 @@ class _datafromfirebaseState extends State<datafromfirebase> {
icon: const Icon(Icons.arrow_back, color: Colors.white), icon: const Icon(Icons.arrow_back, color: Colors.white),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
timer!.cancel(); timer.cancel();
}, },
), ),
backgroundColor: const Color(0xff024F8E), backgroundColor: const Color(0xff024F8E),
......
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();
}
}
import 'dart:async';
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: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'; import 'package:shared_preferences/shared_preferences.dart';
class Home extends StatefulWidget { class Home extends StatefulWidget {
Home({Key? key}) : super(key: key); Home({Key key}) : super(key: key);
@override @override
State<Home> createState() => _HomeState(); State<Home> createState() => _HomeState();
...@@ -25,6 +29,18 @@ class _HomeState extends State<Home> { ...@@ -25,6 +29,18 @@ class _HomeState extends State<Home> {
super.initState(); super.initState();
} }
gettemp() {
FirebaseDatabase.instance
.ref()
.child('sensor_data/temperature')
.onValue
.listen((event) {
setState(() {
t = event.snapshot.value.toString();
});
});
}
getdata() async { getdata() async {
print('login'); print('login');
SharedPreferences localStorage = await SharedPreferences.getInstance(); SharedPreferences localStorage = await SharedPreferences.getInstance();
...@@ -45,21 +61,16 @@ class _HomeState extends State<Home> { ...@@ -45,21 +61,16 @@ class _HomeState extends State<Home> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: const Color(0xff024F8E), backgroundColor: backgroundColor,
body: Container( body: Container(
margin: const EdgeInsets.symmetric(horizontal: 15), margin: const EdgeInsets.symmetric(horizontal: 15),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
const SizedBox(
height: 50,
),
Container( Container(
width: 150, padding: const EdgeInsets.all(25),
padding: const EdgeInsets.all(15),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white12, color: cardColor, borderRadius: BorderRadius.circular(20)),
borderRadius: BorderRadius.circular(20)),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
...@@ -121,10 +132,10 @@ class _HomeState extends State<Home> { ...@@ -121,10 +132,10 @@ class _HomeState extends State<Home> {
} }
: null, : null,
child: Container( child: Container(
height: 100, padding: const EdgeInsets.symmetric(
padding: const EdgeInsets.all(15), horizontal: 15, vertical: 40),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white24, color: cardColor,
borderRadius: BorderRadius.circular(20)), borderRadius: BorderRadius.circular(20)),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
...@@ -153,10 +164,10 @@ class _HomeState extends State<Home> { ...@@ -153,10 +164,10 @@ class _HomeState extends State<Home> {
child: GestureDetector( child: GestureDetector(
onTap: () {}, onTap: () {},
child: Container( child: Container(
height: 100, padding: const EdgeInsets.symmetric(
padding: const EdgeInsets.all(15), horizontal: 15, vertical: 40),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white24, color: cardColor,
borderRadius: BorderRadius.circular(20)), borderRadius: BorderRadius.circular(20)),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
...@@ -192,10 +203,10 @@ class _HomeState extends State<Home> { ...@@ -192,10 +203,10 @@ class _HomeState extends State<Home> {
child: GestureDetector( child: GestureDetector(
onTap: () {}, onTap: () {},
child: Container( child: Container(
height: 100, padding: const EdgeInsets.symmetric(
padding: const EdgeInsets.all(15), horizontal: 15, vertical: 40),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white24, color: cardColor,
borderRadius: BorderRadius.circular(20)), borderRadius: BorderRadius.circular(20)),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
...@@ -226,10 +237,10 @@ class _HomeState extends State<Home> { ...@@ -226,10 +237,10 @@ class _HomeState extends State<Home> {
print('water'); print('water');
}, },
child: Container( child: Container(
height: 100, padding: const EdgeInsets.symmetric(
padding: const EdgeInsets.all(15), horizontal: 15, vertical: 40),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white24, color: cardColor,
borderRadius: BorderRadius.circular(20)), borderRadius: BorderRadius.circular(20)),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:ifarm/AB/Screens/NavBar/FoodBucketSchedule.dart';
import 'package:ifarm/Screens/AB/Home.dart'; import 'package:ifarm/AB/Screens/NavBar/Home.dart';
import 'package:ifarm/Screens/AB/Profile.dart'; import 'package:ifarm/AB/Screens/NavBar/Profile.dart';
import 'package:ifarm/Screens/AB/settings.dart'; import 'package:ifarm/AB/Screens/NavBar/settings.dart';
import 'package:ifarm/Screens/AB/shop.dart'; import 'package:ifarm/AB/Utils/Colors.dart';
class Navbar extends StatefulWidget { class Navbar extends StatefulWidget {
Navbar({ Navbar({
Key? key, Key key,
}) : super(key: key); }) : super(key: key);
@override @override
...@@ -21,7 +21,7 @@ class _NavbarState extends State<Navbar> { ...@@ -21,7 +21,7 @@ class _NavbarState extends State<Navbar> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: const Color(0xff024F8E), backgroundColor: backgroundColor,
appBar: AppBar( appBar: AppBar(
title: const SizedBox( title: const SizedBox(
width: 100, width: 100,
...@@ -70,7 +70,7 @@ class _NavbarState extends State<Navbar> { ...@@ -70,7 +70,7 @@ class _NavbarState extends State<Navbar> {
Widget buildPages() { Widget buildPages() {
switch (_selectedIndex) { switch (_selectedIndex) {
case 1: case 1:
return shop(); return FoodBucketSchedule();
case 2: case 2:
return profile(); return profile();
case 3: case 3:
......
...@@ -2,7 +2,7 @@ import 'package:firebase_auth/firebase_auth.dart'; ...@@ -2,7 +2,7 @@ import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class profile extends StatefulWidget { class profile extends StatefulWidget {
profile({Key? key}) : super(key: key); profile({Key key}) : super(key: key);
@override @override
State<profile> createState() => _profileState(); State<profile> createState() => _profileState();
......
import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:ifarm/Screens/AB/Login.dart'; import 'package:ifarm/AB/Utils/ThemeProvider.dart';
import 'package:ifarm/Screens/AB/SplashScreen.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:switcher_button/switcher_button.dart'; import 'package:switcher_button/switcher_button.dart';
import '../Common/SplashScreen.dart';
class settings extends StatefulWidget { class settings extends StatefulWidget {
settings({ settings({
Key? key, Key key,
}) : super(key: key); }) : super(key: key);
@override @override
...@@ -28,22 +29,6 @@ class _settingsState extends State<settings> { ...@@ -28,22 +29,6 @@ class _settingsState extends State<settings> {
super.initState(); 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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
...@@ -60,7 +45,25 @@ class _settingsState extends State<settings> { ...@@ -60,7 +45,25 @@ class _settingsState extends State<settings> {
color: Colors.white, fontSize: 30, fontWeight: FontWeight.bold), color: Colors.white, fontSize: 30, fontWeight: FontWeight.bold),
)), )),
const SizedBox( 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( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
...@@ -221,4 +224,20 @@ class _settingsState extends State<settings> { ...@@ -221,4 +224,20 @@ class _settingsState extends State<settings> {
localStorage.setBool('security', value); localStorage.setBool('security', value);
print('save'); 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;
});
}
} }
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);
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,
));
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class shop extends StatefulWidget { class ChangeThemeButtonWidget extends StatelessWidget {
shop({Key? key}) : super(key: key); const ChangeThemeButtonWidget({Key key}) : super(key: key);
@override
State<shop> createState() => _shopState();
}
class _shopState extends State<shop> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container(); return Container();
......
...@@ -3,7 +3,7 @@ import 'package:flutter/services.dart'; ...@@ -3,7 +3,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart'; import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
class QRScanner extends StatefulWidget { class QRScanner extends StatefulWidget {
QRScanner({Key? key}) : super(key: key); QRScanner({Key key}) : super(key: key);
@override @override
State<QRScanner> createState() => _QRScannerState(); State<QRScanner> createState() => _QRScannerState();
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class customizedTextField extends StatefulWidget { class customizedTextField extends StatefulWidget {
final TextEditingController? mycontroller; final TextEditingController mycontroller;
final String? lableText, empty; final String lableText, empty;
final bool? isPassword; final bool isPassword;
customizedTextField( customizedTextField(
{Key? key, {Key key, this.mycontroller, this.lableText, this.isPassword, this.empty})
this.mycontroller,
this.lableText,
this.isPassword,
this.empty})
: super(key: key); : super(key: key);
@override @override
...@@ -36,7 +32,7 @@ class _customizedTextFieldState extends State<customizedTextField> { ...@@ -36,7 +32,7 @@ class _customizedTextFieldState extends State<customizedTextField> {
padding: const EdgeInsets.symmetric(horizontal: 20), padding: const EdgeInsets.symmetric(horizontal: 20),
child: TextFormField( child: TextFormField(
validator: (value) { validator: (value) {
if (value!.isEmpty) { if (value.isEmpty) {
return widget.empty; return widget.empty;
} }
}, },
...@@ -45,7 +41,7 @@ class _customizedTextFieldState extends State<customizedTextField> { ...@@ -45,7 +41,7 @@ class _customizedTextFieldState extends State<customizedTextField> {
style: const TextStyle(color: Color.fromARGB(255, 0, 0, 0)), style: const TextStyle(color: Color.fromARGB(255, 0, 0, 0)),
cursorColor: const Color.fromARGB(255, 0, 0, 0), cursorColor: const Color.fromARGB(255, 0, 0, 0),
decoration: InputDecoration( decoration: InputDecoration(
suffixIcon: widget.isPassword! suffixIcon: widget.isPassword
? GestureDetector( ? GestureDetector(
onTap: () { onTap: () {
_toggle(); _toggle();
......
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);
}
}
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,
),
),
),
),
),
);
}));
}
}
import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart'; import 'package:fluttertoast/fluttertoast.dart';
import 'package:ifarm/Screens/AB/Navbar.dart'; import 'package:ifarm/AB/Screens/NavBar/Navbar.dart';
import 'package:ifarm/Screens/AB/SplashScreen.dart';
import 'package:ifarm/functions/firebaseFunctions.dart'; import 'package:ifarm/functions/firebaseFunctions.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
...@@ -13,8 +12,8 @@ class AuthServices { ...@@ -13,8 +12,8 @@ class AuthServices {
UserCredential userCredential = await FirebaseAuth.instance UserCredential userCredential = await FirebaseAuth.instance
.createUserWithEmailAndPassword(email: email, password: password); .createUserWithEmailAndPassword(email: email, password: password);
await FirebaseAuth.instance.currentUser!.updateDisplayName(name); await FirebaseAuth.instance.currentUser.updateDisplayName(name);
await FirebaseAuth.instance.currentUser!.updateEmail(email); await FirebaseAuth.instance.currentUser.updateEmail(email);
await FirestoreServices.saveUser(name, email); await FirestoreServices.saveUser(name, email);
Fluttertoast.showToast( Fluttertoast.showToast(
msg: 'Registration Successful', msg: 'Registration Successful',
......
...@@ -2,8 +2,9 @@ import 'dart:io'; ...@@ -2,8 +2,9 @@ import 'dart:io';
import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.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 { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
...@@ -13,16 +14,16 @@ void main() async { ...@@ -13,16 +14,16 @@ void main() async {
} }
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key); const MyApp({Key key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
title: 'IFarm', title: 'IFarm',
theme: ThemeData( theme: lightTheme,
primarySwatch: Colors.blue, darkTheme: darkTheme,
), themeMode: ThemeMode.system,
home: splashScreen(), home: splashScreen(),
); );
} }
......
...@@ -7,7 +7,7 @@ publish_to: 'none' ...@@ -7,7 +7,7 @@ publish_to: 'none'
version: 1.0.0+1 version: 1.0.0+1
environment: environment:
sdk: ">=2.16.2 <3.0.0" sdk: ">=2.7.2 <3.0.0"
dependencies: dependencies:
flutter: flutter:
......
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