Commit de6eccf5 authored by Boteju W.J.M.'s avatar Boteju W.J.M.

flutter app

parent 173ae855
Pipeline #2035 failed with stages
...@@ -9,7 +9,8 @@ import 'package:image_picker/image_picker.dart'; ...@@ -9,7 +9,8 @@ import 'package:image_picker/image_picker.dart';
import 'package:video_player/video_player.dart'; import 'package:video_player/video_player.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:path_provider/path_provider.dart'; import 'package:path_provider/path_provider.dart';
import 'package:fitnessapp/globals.dart' as globals;
import 'package:fitnessapp/Screens/WalkingPatternRecognition/service.dart';
import '../../constants.dart'; import '../../constants.dart';
import 'dog_details_screen.dart'; import 'dog_details_screen.dart';
import 'Dog.dart'; import 'Dog.dart';
...@@ -37,6 +38,13 @@ class _DogBreedIdentificationState extends State<DogBreedIdentification> { ...@@ -37,6 +38,13 @@ class _DogBreedIdentificationState extends State<DogBreedIdentification> {
final TextEditingController maxHeightController = TextEditingController(); final TextEditingController maxHeightController = TextEditingController();
final TextEditingController qualityController = TextEditingController(); final TextEditingController qualityController = TextEditingController();
@override
void initState() {
super.initState();
print(globals.username);
print((globals.password2).runtimeType);
}
Future<void> _showAlert(BuildContext context) { Future<void> _showAlert(BuildContext context) {
return showDialog( return showDialog(
context: context, context: context,
...@@ -293,7 +301,6 @@ class _DogBreedIdentificationState extends State<DogBreedIdentification> { ...@@ -293,7 +301,6 @@ class _DogBreedIdentificationState extends State<DogBreedIdentification> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
print("Heree");
return Scaffold( return Scaffold(
body: Center( body: Center(
child: Column( child: Column(
......
...@@ -68,10 +68,12 @@ class _ProfilePageState extends State<ProfilePage> { ...@@ -68,10 +68,12 @@ class _ProfilePageState extends State<ProfilePage> {
} }
getTotalWalkingMinutes(day, dog) async { getTotalWalkingMinutes(day, dog) async {
print("Came heree");
SearchService.getTotalWalkingMinutesPerDay(day, dog).then((responseBody) { SearchService.getTotalWalkingMinutesPerDay(day, dog).then((responseBody) {
dynamic data = jsonDecode(responseBody); dynamic data = jsonDecode(responseBody);
setState(() { setState(() {
value = data[0]['minutes per day']; value = data[0]['minutes per day'];
print(value);
if (value != 0) { if (value != 0) {
value = value.toInt(); value = value.toInt();
walkingHrs = value ~/ 60; walkingHrs = value ~/ 60;
...@@ -90,6 +92,7 @@ class _ProfilePageState extends State<ProfilePage> { ...@@ -90,6 +92,7 @@ class _ProfilePageState extends State<ProfilePage> {
} }
getTotalRunningMinutes(day, dog) async { getTotalRunningMinutes(day, dog) async {
print("Hereee in run");
SearchService.getTotalRunningMinutesPerDay(day, dog).then((responseBody) { SearchService.getTotalRunningMinutesPerDay(day, dog).then((responseBody) {
dynamic data = jsonDecode(responseBody); dynamic data = jsonDecode(responseBody);
setState(() { setState(() {
...@@ -257,7 +260,7 @@ class _ProfilePageState extends State<ProfilePage> { ...@@ -257,7 +260,7 @@ class _ProfilePageState extends State<ProfilePage> {
TableRow( TableRow(
children: [ children: [
ProfileInfoBigCard( ProfileInfoBigCard(
firstText: "1 hr 45 mins", firstText: "0 hrs 0 mins",
secondText: "Resting", secondText: "Resting",
activity: 3, activity: 3,
icon: Image.asset( icon: Image.asset(
...@@ -266,7 +269,7 @@ class _ProfilePageState extends State<ProfilePage> { ...@@ -266,7 +269,7 @@ class _ProfilePageState extends State<ProfilePage> {
), ),
), ),
ProfileInfoBigCard( ProfileInfoBigCard(
firstText: "1 hr 40 mins", firstText: "0 hrs 0 mins",
activity: 4, activity: 4,
secondText: "Barking", secondText: "Barking",
icon: Image.asset( icon: Image.asset(
......
...@@ -35,12 +35,15 @@ class _BodyState extends State<Body> { ...@@ -35,12 +35,15 @@ class _BodyState extends State<Body> {
SearchService.login(username, password).then((responseBody) { SearchService.login(username, password).then((responseBody) {
print(username); print(username);
dynamic data = jsonDecode(responseBody); dynamic data = jsonDecode(responseBody);
setState(() { setState(() {
loading = true; loading = true;
globals.userId = data['user_id']; globals.userId = data['user_id'];
globals.token = data['token']; globals.token = data['token'];
globals.email = data['email']; globals.email = data['email'];
print(globals.userId);
this.getDogsBasedOnUser(globals.userId); this.getDogsBasedOnUser(globals.userId);
loading = false; loading = false;
}); });
......
...@@ -10,6 +10,8 @@ import 'package:fitnessapp/components/rounded_input_field.dart'; ...@@ -10,6 +10,8 @@ import 'package:fitnessapp/components/rounded_input_field.dart';
import 'package:fitnessapp/components/rounded_password_field.dart'; import 'package:fitnessapp/components/rounded_password_field.dart';
import '../../../constants.dart'; import '../../../constants.dart';
import '../../../loading.dart'; import '../../../loading.dart';
import 'package:fitnessapp/globals.dart' as globals;
class Body extends StatefulWidget { class Body extends StatefulWidget {
@override @override
...@@ -27,13 +29,14 @@ class _BodyState extends State<Body> { ...@@ -27,13 +29,14 @@ class _BodyState extends State<Body> {
SearchService.register(username, password, email).then((responseBody) { SearchService.register(username, password, email).then((responseBody) {
dynamic data = jsonDecode(responseBody); dynamic data = jsonDecode(responseBody);
print(data); print(data);
print(data['error']);
setState(() { setState(() {
loading = false; loading = false;
if ((data['username'] != '' || data['username'] != null) && if ((data['user']['username'] != '' || data['user']['password'] != null) &&
data['error'] == 'No') { data['error'] == 'No error') {
globals.username= data['user']['username'];
globals.password = data['user']['password'];
globals.password2 = password;
userExists = false; userExists = false;
print("New User");
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
......
...@@ -85,7 +85,9 @@ class SearchService { ...@@ -85,7 +85,9 @@ class SearchService {
body: body) body: body)
.then((http.Response response) { .then((http.Response response) {
return response; return response;
}); });
return response.body; return response.body;
} }
......
...@@ -4,9 +4,7 @@ import 'package:fitnessapp/Screens/Signup/signup_screen.dart'; ...@@ -4,9 +4,7 @@ import 'package:fitnessapp/Screens/Signup/signup_screen.dart';
import 'package:fitnessapp/Screens/Welcome/components/background.dart'; import 'package:fitnessapp/Screens/Welcome/components/background.dart';
import 'package:fitnessapp/constants.dart'; import 'package:fitnessapp/constants.dart';
import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:timezone/data/latest.dart' as tz;
import 'package:timezone/timezone.dart' as tz;
import 'package:flutter_native_timezone/flutter_native_timezone.dart';
class Body extends StatefulWidget { class Body extends StatefulWidget {
@override @override
...@@ -19,38 +17,10 @@ class _BodyState extends State<Body> { ...@@ -19,38 +17,10 @@ class _BodyState extends State<Body> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
// var androidInitilize = new AndroidInitializationSettings('download');
// var iOSinitilize = new IOSInitializationSettings();
// var initilizationsSettings = new InitializationSettings(
// android: androidInitilize, iOS: iOSinitilize);
// fltrNotification = new FlutterLocalNotificationsPlugin();
// fltrNotification.initialize(initilizationsSettings,
// onSelectNotification: notificationSelected);
// _showNotification();
} }
// Future _showNotification() async {
// final String currentTimeZone =
// await FlutterNativeTimezone.getLocalTimezone();
// tz.initializeTimeZones();
// tz.setLocalLocation(tz.getLocation(currentTimeZone));
// var androidDetails = new AndroidNotificationDetails(
// "Channel ID", "Desi programmer", "This is my channel",
// importance: Importance.max);
// var iSODetails = new IOSNotificationDetails();
// var generalNotificationDetails =
// new NotificationDetails(android: androidDetails, iOS: iSODetails);
// await fltrNotification.periodicallyShow(
// 1,
// 'Times Uppp',
// 'Scheduled Notification',
// RepeatInterval.everyMinute,
// generalNotificationDetails,
// androidAllowWhileIdle: true);
// }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -108,36 +78,10 @@ class _BodyState extends State<Body> { ...@@ -108,36 +78,10 @@ class _BodyState extends State<Body> {
borderRadius: BorderRadius.circular(30)), borderRadius: BorderRadius.circular(30)),
), ),
), ),
// ButtonTheme(
// buttonColor: Colors.white,
// minWidth: 320,
// height: 55,
// child: OutlineButton(
// onPressed: () {
// _showNotification();
// },
// child: Text(
// "Notification",
// style: TextStyle(
// color: kPrimaryColor, fontWeight: FontWeight.bold),
// ),
// borderSide: BorderSide(color: kPrimaryColor, width: 2),
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(30)),
// ),
// )
], ],
), ),
), ),
); );
} }
// Future notificationSelected(String payload) async {
// showDialog(
// context: context,
// builder: (context) => AlertDialog(
// content: Text("Notification : $payload"),
// ),
// );
// }
} }
...@@ -10,7 +10,9 @@ const kPrimaryColor3 = Color(0xFF8ED3B2); ...@@ -10,7 +10,9 @@ const kPrimaryColor3 = Color(0xFF8ED3B2);
// const kPrimaryColor = Color(0xFF388E3C); // const kPrimaryColor = Color(0xFF388E3C);
const kBackgroundColor = Color(0xFFFCFCFC); const kBackgroundColor = Color(0xFFFCFCFC);
const kInactiveChartColor = Color(0xFFEAECEF); const kInactiveChartColor = Color(0xFFEAECEF);
const kPrimaryGreenColor = Color(0xFF388E3C); // const kPrimaryGreenColor = Color(0xFF388E3C);
const kPrimaryGreenColor = Color(0xFF55BD8B);
const kRedColour = Color(0xFFD75050); const kRedColour = Color(0xFFD75050);
const kPurpleColour = Color(0xFF6E6CDF); const kPurpleColour = Color(0xFF6E6CDF);
const kOrangeColour = Color(0xFFD75050); const kOrangeColour = Color(0xFFD75050);
......
...@@ -4,6 +4,9 @@ library my_prj.globals; ...@@ -4,6 +4,9 @@ library my_prj.globals;
int userId; int userId;
String email = ''; String email = '';
String token = ''; String token = '';
String username='';
String password='';
String password2='';
//dog //dog
int dogId; int dogId;
......
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