Skip to content

Commit 5c05f7c

Browse files
committed
2 parents 724caef + 95540f4 commit 5c05f7c

28 files changed

+5834
-64
lines changed

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SUPABASE_URL=https://your_supabase_url.supabase.co
2+
SUPABASE_ANON_KEY=your_supabase_anon_key_here
3+
OPENWEATHER_API_KEY=your_openweather_api_key_here
4+
API_URL=http://localhost:80

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,10 @@ app.*.map.json
4343
/android/app/debug
4444
/android/app/profile
4545
/android/app/release
46+
47+
# Environment variables
48+
.env
49+
.env.local
50+
.env.development
51+
.env.test
52+
.env.production

android/app/build.gradle.kts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ plugins {
66
}
77

88
android {
9-
namespace = "com.example.myapp"
9+
namespace = "com.example.myapp" // Replace with your actual package name
1010
compileSdk = flutter.compileSdkVersion
1111
ndkVersion = flutter.ndkVersion
1212

1313
compileOptions {
14+
// Enable desugaring
15+
isCoreLibraryDesugaringEnabled = true
1416
sourceCompatibility = JavaVersion.VERSION_1_8
1517
targetCompatibility = JavaVersion.VERSION_1_8
1618
}
@@ -20,10 +22,7 @@ android {
2022
}
2123

2224
defaultConfig {
23-
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
24-
applicationId = "com.example.myapp"
25-
// You can update the following values to match your application needs.
26-
// For more information, see: https://flutter.dev/to/review-gradle-config.
25+
applicationId = "com.example.myapp" // Replace with your actual package name
2726
minSdk = flutter.minSdkVersion
2827
targetSdk = flutter.targetSdkVersion
2928
versionCode = flutter.versionCode
@@ -42,3 +41,8 @@ android {
4241
flutter {
4342
source = "../.."
4443
}
44+
45+
dependencies {
46+
// Updated to the required version 2.0.3 (which is above the minimum required 2.1.4)
47+
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.4")
48+
}
Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
<!-- Internet Permission -->
3+
<uses-permission android:name="android.permission.INTERNET" />
4+
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
5+
<!-- Location Permissions -->
6+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
7+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
28
<!-- The INTERNET permission is required for development. Specifically,
39
the Flutter tool needs it to communicate with the running application
410
to allow setting breakpoints, to provide hot reload, etc.
511
-->
6-
<uses-permission android:name="android.permission.INTERNET"/>
12+
<queries>
13+
<intent>
14+
<action android:name="android.intent.action.TTS_SERVICE" />
15+
</intent>
16+
<intent>
17+
<action android:name="android.speech.RecognitionService" />
18+
</intent>
19+
</queries>
720
</manifest>

android/app/src/main/AndroidManifest.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
2+
<uses-permission android:name="android.permission.INTERNET"/>
3+
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
4+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
5+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
26
<application
37
android:label="myapp"
48
android:name="${applicationName}"
@@ -41,5 +45,11 @@
4145
<action android:name="android.intent.action.PROCESS_TEXT"/>
4246
<data android:mimeType="text/plain"/>
4347
</intent>
48+
<intent>
49+
<action android:name="android.intent.action.TTS_SERVICE" />
50+
</intent>
51+
<intent>
52+
<action android:name="android.speech.RecognitionService" />
53+
</intent>
4454
</queries>
4555
</manifest>

android/app/src/profile/AndroidManifest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
to allow setting breakpoints, to provide hot reload, etc.
55
-->
66
<uses-permission android:name="android.permission.INTERNET"/>
7+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
8+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
79
</manifest>

assets/logos/splash_logo.svg

Lines changed: 3 additions & 0 deletions
Loading

backend

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 5420d421f3484ee82ae1069bf3995e6c6865f39e

lib/main.dart

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
import 'package:flutter/material.dart';
22
import 'package:supabase_auth_ui/supabase_auth_ui.dart';
3+
import 'package:flutter_dotenv/flutter_dotenv.dart';
34

45
import 'util.dart';
56
import 'theme.dart';
6-
import 'screens/auth_screen.dart';
7+
import 'screens/splash_screen.dart';
78

89
void main() async {
10+
WidgetsFlutterBinding.ensureInitialized();
11+
12+
await dotenv.load();
13+
914
await Supabase.initialize(
10-
url: 'https://jbpeszoljhnymgqhufmd.supabase.co',
11-
anonKey:
12-
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImpicGVzem9samhueW1ncWh1Zm1kIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDMyNTAzMDIsImV4cCI6MjA1ODgyNjMwMn0.NX3h_DpXqnpabbla3wR-RHQTuZskM3aJeX2qU1HNUe0',
15+
url: dotenv.env['SUPABASE_URL'] ?? '',
16+
anonKey: dotenv.env['SUPABASE_ANON_KEY'] ?? '',
1317
);
18+
1419
runApp(const MyApp());
1520
}
1621

@@ -30,9 +35,9 @@ class MyApp extends StatelessWidget {
3035
MaterialTheme theme = MaterialTheme(textTheme);
3136
return MaterialApp(
3237
debugShowCheckedModeBanner: false,
33-
title: 'Flutter Demo',
38+
title: 'Celesta',
3439
theme: brightness == Brightness.light ? theme.light() : theme.dark(),
35-
home: const AuthScreen(),
40+
home: const SplashScreen(),
3641
);
3742
}
3843
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
class WateringHistoryModel {
2+
final int? id;
3+
final int plantId;
4+
final DateTime wateredAt;
5+
6+
WateringHistoryModel({
7+
this.id,
8+
required this.plantId,
9+
required this.wateredAt,
10+
});
11+
12+
/// Creates a WateringHistoryModel from a JSON object.
13+
factory WateringHistoryModel.fromJson(Map<String, dynamic> json) {
14+
return WateringHistoryModel(
15+
id: json['id'],
16+
plantId: json['plant_id'],
17+
wateredAt:
18+
json['watered_at'] is String
19+
? DateTime.parse(json['watered_at'])
20+
: json['watered_at'],
21+
);
22+
}
23+
24+
Map<String, dynamic> toJson() {
25+
return {
26+
'id': id,
27+
'plant_id': plantId,
28+
'watered_at': wateredAt.toIso8601String(),
29+
};
30+
}
31+
32+
WateringHistoryModel copyWith({int? id, int? plantId, DateTime? wateredAt}) {
33+
return WateringHistoryModel(
34+
id: id ?? this.id,
35+
plantId: plantId ?? this.plantId,
36+
wateredAt: wateredAt ?? this.wateredAt,
37+
);
38+
}
39+
40+
@override
41+
bool operator ==(Object other) {
42+
if (identical(this, other)) return true;
43+
44+
return other is WateringHistoryModel &&
45+
other.id == id &&
46+
other.plantId == plantId &&
47+
other.wateredAt == wateredAt;
48+
}
49+
50+
@override
51+
int get hashCode => id.hashCode ^ plantId.hashCode ^ wateredAt.hashCode;
52+
53+
@override
54+
String toString() =>
55+
'WateringHistoryModel(id: $id, plantId: $plantId, wateredAt: $wateredAt)';
56+
}

0 commit comments

Comments
 (0)