commit 7f119ba4a5ccb98862b222e483bf68caae592e17 Author: developer Date: Tue Aug 26 15:06:27 2025 +0700 first commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..79c113f --- /dev/null +++ b/.gitignore @@ -0,0 +1,45 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.build/ +.buildlog/ +.history +.svn/ +.swiftpm/ +migrate_working_dir/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.pub-cache/ +.pub/ +/build/ + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/.metadata b/.metadata new file mode 100644 index 0000000..5b39692 --- /dev/null +++ b/.metadata @@ -0,0 +1,45 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: "d8a9f9a52e5af486f80d932e838ee93861ffd863" + channel: "stable" + +project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 + base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 + - platform: android + create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 + base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 + - platform: ios + create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 + base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 + - platform: linux + create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 + base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 + - platform: macos + create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 + base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 + - platform: web + create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 + base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 + - platform: windows + create_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 + base_revision: d8a9f9a52e5af486f80d932e838ee93861ffd863 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/README.md b/README.md new file mode 100644 index 0000000..d7322f5 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# antispy + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) + +For help getting started with Flutter development, view the +[online documentation](https://docs.flutter.dev/), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/analysis_options.yaml b/analysis_options.yaml new file mode 100644 index 0000000..0d29021 --- /dev/null +++ b/analysis_options.yaml @@ -0,0 +1,28 @@ +# This file configures the analyzer, which statically analyzes Dart code to +# check for errors, warnings, and lints. +# +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be +# invoked from the command line by running `flutter analyze`. + +# The following line activates a set of recommended lints for Flutter apps, +# packages, and plugins designed to encourage good coding practices. +include: package:flutter_lints/flutter.yaml + +linter: + # The lint rules applied to this project can be customized in the + # section below to disable rules from the `package:flutter_lints/flutter.yaml` + # included above or to enable additional rules. A list of all available lints + # and their documentation is published at https://dart.dev/lints. + # + # Instead of disabling a lint rule for the entire project in the + # section below, it can also be suppressed for a single line of code + # or a specific dart file by using the `// ignore: name_of_lint` and + # `// ignore_for_file: name_of_lint` syntax on the line or in the file + # producing the lint. + rules: + # avoid_print: false # Uncomment to disable the `avoid_print` rule + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule + +# Additional information about this file can be found at +# https://dart.dev/guides/language/analysis-options diff --git a/android/.gitignore b/android/.gitignore new file mode 100644 index 0000000..55afd91 --- /dev/null +++ b/android/.gitignore @@ -0,0 +1,13 @@ +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat +/local.properties +GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/to/reference-keystore +key.properties +**/*.keystore +**/*.jks diff --git a/android/app/build.gradle b/android/app/build.gradle new file mode 100644 index 0000000..24a539a --- /dev/null +++ b/android/app/build.gradle @@ -0,0 +1,47 @@ +plugins { + id "com.android.application" + // START: FlutterFire Configuration + id 'com.google.gms.google-services' + // END: FlutterFire Configuration + id "kotlin-android" + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id "dev.flutter.flutter-gradle-plugin" +} + +android { + namespace = "com.example.antispy" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8 + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.example.antispy" + // You can update the following values to match your application needs. + // For more information, see: https://flutter.dev/to/review-gradle-config. + minSdk = 23 + targetSdk = flutter.targetSdkVersion + versionCode = flutter.versionCode + versionName = flutter.versionName + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig = signingConfigs.debug + } + } +} + +flutter { + source = "../.." +} diff --git a/android/app/google-services.json b/android/app/google-services.json new file mode 100644 index 0000000..b4b9d63 --- /dev/null +++ b/android/app/google-services.json @@ -0,0 +1,29 @@ +{ + "project_info": { + "project_number": "543959947783", + "project_id": "antispy-5f8a4", + "storage_bucket": "antispy-5f8a4.firebasestorage.app" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:543959947783:android:7be5fc39b1b8474732a8a2", + "android_client_info": { + "package_name": "com.example.antispy" + } + }, + "oauth_client": [], + "api_key": [ + { + "current_key": "AIzaSyCBrqkGjkELRWQ8zBozTeM87jSEhGSZOYA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..b5db57c --- /dev/null +++ b/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/android/app/src/main/kotlin/com/example/antispy/MainActivity.kt b/android/app/src/main/kotlin/com/example/antispy/MainActivity.kt new file mode 100644 index 0000000..a59e120 --- /dev/null +++ b/android/app/src/main/kotlin/com/example/antispy/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.antispy + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/android/app/src/main/res/drawable-v21/launch_background.xml b/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 0000000..f74085f --- /dev/null +++ b/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/drawable/launch_background.xml b/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..304732f --- /dev/null +++ b/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..db77bb4 Binary files /dev/null and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..17987b7 Binary files /dev/null and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..09d4391 Binary files /dev/null and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..d5f1c8d Binary files /dev/null and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..4d6372e Binary files /dev/null and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/values-night/styles.xml b/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..06952be --- /dev/null +++ b/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/main/res/values/styles.xml b/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..cb1ef88 --- /dev/null +++ b/android/app/src/main/res/values/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 0000000..399f698 --- /dev/null +++ b/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/android/build.gradle b/android/build.gradle new file mode 100644 index 0000000..d2ffbff --- /dev/null +++ b/android/build.gradle @@ -0,0 +1,18 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = "../build" +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/android/gradle.properties b/android/gradle.properties new file mode 100644 index 0000000..2597170 --- /dev/null +++ b/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError +android.useAndroidX=true +android.enableJetifier=true diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..7bb2df6 --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip diff --git a/android/settings.gradle b/android/settings.gradle new file mode 100644 index 0000000..9759a22 --- /dev/null +++ b/android/settings.gradle @@ -0,0 +1,28 @@ +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "8.1.0" apply false + // START: FlutterFire Configuration + id "com.google.gms.google-services" version "4.3.15" apply false + // END: FlutterFire Configuration + id "org.jetbrains.kotlin.android" version "1.8.22" apply false +} + +include ":app" diff --git a/assets/images/logo.png b/assets/images/logo.png new file mode 100644 index 0000000..19113a2 Binary files /dev/null and b/assets/images/logo.png differ diff --git a/firebase.json b/firebase.json new file mode 100644 index 0000000..7348e80 --- /dev/null +++ b/firebase.json @@ -0,0 +1 @@ +{"flutter":{"platforms":{"android":{"default":{"projectId":"antispy-5f8a4","appId":"1:543959947783:android:7be5fc39b1b8474732a8a2","fileOutput":"android/app/google-services.json"}},"dart":{"lib/firebase_options.dart":{"projectId":"antispy-5f8a4","configurations":{"android":"1:543959947783:android:7be5fc39b1b8474732a8a2"}}}}}} \ No newline at end of file diff --git a/lib/app.dart b/lib/app.dart new file mode 100644 index 0000000..4196302 --- /dev/null +++ b/lib/app.dart @@ -0,0 +1,17 @@ +import 'package:flutter/material.dart'; +import 'routes/app_routes.dart'; + +class MyApp extends StatelessWidget { + const MyApp({super.key}); + + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'AntiSpy Camera', + debugShowCheckedModeBanner: false, + // theme: ThemeData.dark(), // atau custom ThemeData sesuai kebutuhan + initialRoute: '/', // route awal (SplashScreen) + routes: AppRoutes.routes, // gunakan AppRoutes versi bawaan MaterialApp + ); + } +} diff --git a/lib/firebase_options.dart b/lib/firebase_options.dart new file mode 100644 index 0000000..b37528a --- /dev/null +++ b/lib/firebase_options.dart @@ -0,0 +1,62 @@ +// File generated by FlutterFire CLI. +// ignore_for_file: type=lint +import 'package:firebase_core/firebase_core.dart' show FirebaseOptions; +import 'package:flutter/foundation.dart' + show defaultTargetPlatform, kIsWeb, TargetPlatform; + +/// Default [FirebaseOptions] for use with your Firebase apps. +/// +/// Example: +/// ```dart +/// import 'firebase_options.dart'; +/// // ... +/// await Firebase.initializeApp( +/// options: DefaultFirebaseOptions.currentPlatform, +/// ); +/// ``` +class DefaultFirebaseOptions { + static FirebaseOptions get currentPlatform { + if (kIsWeb) { + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for web - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + } + switch (defaultTargetPlatform) { + case TargetPlatform.android: + return android; + case TargetPlatform.iOS: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for ios - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.macOS: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for macos - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.windows: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for windows - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + case TargetPlatform.linux: + throw UnsupportedError( + 'DefaultFirebaseOptions have not been configured for linux - ' + 'you can reconfigure this by running the FlutterFire CLI again.', + ); + default: + throw UnsupportedError( + 'DefaultFirebaseOptions are not supported for this platform.', + ); + } + } + + static const FirebaseOptions android = FirebaseOptions( + apiKey: 'AIzaSyCBrqkGjkELRWQ8zBozTeM87jSEhGSZOYA', + appId: '1:543959947783:android:7be5fc39b1b8474732a8a2', + messagingSenderId: '543959947783', + projectId: 'antispy-5f8a4', + storageBucket: 'antispy-5f8a4.firebasestorage.app', + ); +} diff --git a/lib/main.dart b/lib/main.dart new file mode 100644 index 0000000..fe71e0e --- /dev/null +++ b/lib/main.dart @@ -0,0 +1,12 @@ +import 'package:flutter/material.dart'; +import 'firebase_options.dart'; +import 'package:firebase_core/firebase_core.dart'; +import 'app.dart'; + +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + await Firebase.initializeApp( + options: DefaultFirebaseOptions.currentPlatform, + ); + runApp(const MyApp()); +} diff --git a/lib/routes/app_routes.dart b/lib/routes/app_routes.dart new file mode 100644 index 0000000..aab8b25 --- /dev/null +++ b/lib/routes/app_routes.dart @@ -0,0 +1,31 @@ +import 'package:flutter/material.dart'; + +// Halaman tanpa bottom nav +import '../screens/splash_screen.dart'; +import '../screens/auth/login_page.dart'; +import '../screens/auth/register_page.dart'; + +// Halaman dengan bottom nav (dibungkus MainScreen) +import '../screens/main_screen.dart'; + +import '../screens/history/history_page.dart'; +import '../screens/settings/settings_page.dart'; +import '../screens/notifications/notifications_page.dart'; +import '../screens/live_stream/live_camera_page.dart'; + +class AppRoutes { + static Map routes = { + '/': (context) => const SplashScreen(), + '/login': (context) => const LoginPage(), + '/register': (context) => const RegisterPage(), + + // Pembungkus Bottom Navigation + '/main': (context) => const MainScreen(), + + // Rute internal (dipakai oleh MainScreen untuk switch halaman) + '/history': (context) => const HistoryPage(), + '/control': (context) => const SettingsPage(), + '/notifications': (context) => const NotificationsPage(), + '/camera': (context) => const LiveCameraPage(), + }; +} diff --git a/lib/screens/auth/login_page.dart b/lib/screens/auth/login_page.dart new file mode 100644 index 0000000..d4c8f86 --- /dev/null +++ b/lib/screens/auth/login_page.dart @@ -0,0 +1,170 @@ +import 'package:flutter/material.dart'; +import '../../services/auth_service.dart'; + +class LoginPage extends StatefulWidget { + const LoginPage({super.key}); + + @override + State createState() => _LoginPageState(); +} + +class _LoginPageState extends State { + final TextEditingController _emailController = TextEditingController(); + final TextEditingController _passwordController = TextEditingController(); + final AuthService _authService = AuthService(); + + bool _isLoading = false; + String? _errorMessage; + + Future _handleLogin() async { + setState(() { + _isLoading = true; + _errorMessage = null; + }); + + try { + final user = await _authService.login( + _emailController.text.trim(), + _passwordController.text.trim(), + ); + if (user != null) { + Navigator.pushReplacementNamed(context, '/main'); + } + } catch (e) { + setState(() { + _errorMessage = e.toString().replaceAll('Exception:', '').trim(); + }); + } finally { + setState(() => _isLoading = false); + } + } + + @override + Widget build(BuildContext context) { + final screenWidth = MediaQuery.of(context).size.width; + + return Scaffold( + backgroundColor: Colors.white, + body: Stack( + children: [ + // Background ungu di atas + Container( + height: MediaQuery.of(context).size.height * 0.20, + decoration: const BoxDecoration( + color: Color(0xFF6B4EFF), + ), + ), + + SingleChildScrollView( + padding: const EdgeInsets.symmetric(horizontal: 32), + child: Column( + children: [ + const SizedBox(height: 80), + + // Kartu besar logo + teks horizontal + Container( + width: screenWidth * 0.8, + padding: const EdgeInsets.symmetric( + vertical: 60, + horizontal: 32, + ), + decoration: BoxDecoration( + color: const Color(0xFF8B70FF), + borderRadius: BorderRadius.circular(30), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.15), + blurRadius: 15, + offset: const Offset(0, 10), + ), + ], + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + 'assets/images/logo.png', + height: 40, + width: 40, + ), + const SizedBox(width: 12), + const Text( + 'AntiSpy', + style: TextStyle( + fontSize: 28, + fontWeight: FontWeight.bold, + color: Colors.white, + ), + ), + ], + ), + ), + + const SizedBox(height: 48), + + // Email + TextField( + controller: _emailController, + decoration: const InputDecoration( + hintText: 'Email', + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Colors.black), + ), + ), + ), + const SizedBox(height: 16), + + // Password + TextField( + controller: _passwordController, + obscureText: true, + decoration: const InputDecoration( + hintText: 'Password', + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide(color: Colors.black), + ), + ), + ), + const SizedBox(height: 24), + + // Error + if (_errorMessage != null) + Text( + _errorMessage!, + style: const TextStyle(color: Colors.red), + ), + + const SizedBox(height: 16), + + // Tombol Login + ElevatedButton( + onPressed: _isLoading ? null : _handleLogin, + style: ElevatedButton.styleFrom( + backgroundColor: const Color(0xFF6B4EFF), + padding: const EdgeInsets.symmetric( + horizontal: 40, vertical: 12), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(30), + ), + ), + child: _isLoading + ? const SizedBox( + height: 20, + width: 20, + child: CircularProgressIndicator( + color: Colors.white, + strokeWidth: 2, + ), + ) + : const Text('Login', + style: TextStyle(color: Colors.white)), + ), + const SizedBox(height: 40), + ], + ), + ), + ], + ), + ); + } +} diff --git a/lib/screens/auth/register_page.dart b/lib/screens/auth/register_page.dart new file mode 100644 index 0000000..0ef21e2 --- /dev/null +++ b/lib/screens/auth/register_page.dart @@ -0,0 +1,17 @@ +import 'package:flutter/material.dart'; + +class RegisterPage extends StatelessWidget { + const RegisterPage({super.key}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text('Login'), + ), + body: const Center( + child: Text('Ini halaman Login'), + ), + ); + } +} diff --git a/lib/screens/history/history_page.dart b/lib/screens/history/history_page.dart new file mode 100644 index 0000000..d918261 --- /dev/null +++ b/lib/screens/history/history_page.dart @@ -0,0 +1,206 @@ +import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:flutter/material.dart'; +import 'package:intl/intl.dart'; +import '../../widgets/costum_header.dart'; + +class HistoryPage extends StatefulWidget { + const HistoryPage({super.key}); + + @override + State createState() => _HistoryPageState(); +} + +class _HistoryPageState extends State { + DateTime? selectedDate; + + Stream getCaptureStream() { + final ref = FirebaseFirestore.instance.collection('captures'); + if (selectedDate != null) { + final start = DateTime( + selectedDate!.year, + selectedDate!.month, + selectedDate!.day, + ); + final end = start.add(const Duration(days: 1)); + return ref + .where('timestamp', isGreaterThanOrEqualTo: Timestamp.fromDate(start)) + .where('timestamp', isLessThan: Timestamp.fromDate(end)) + .orderBy('timestamp', descending: true) + .snapshots(); + } else { + return ref.orderBy('timestamp', descending: true).snapshots(); + } + } + + Future _pickDate() async { + final DateTime? date = await showDatePicker( + context: context, + initialDate: selectedDate ?? DateTime.now(), + firstDate: DateTime(2024), + lastDate: DateTime.now(), + ); + if (date != null) { + setState(() { + selectedDate = date; + }); + } + } + + @override + Widget build(BuildContext context) { + const primaryColor = Color(0xFF5F59A6); + + return Scaffold( + appBar: const CustomAppBar(title: 'Riwayat Deteksi'), + body: Column( + children: [ + // Filter tanggal + Padding( + padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12), + child: Row( + children: [ + Expanded( + child: ElevatedButton.icon( + onPressed: _pickDate, + icon: const Icon(Icons.date_range, color: Colors.white), + label: Text( + selectedDate != null + ? DateFormat('dd MMM yyyy').format(selectedDate!) + : 'Pilih Tanggal', + ), + style: ElevatedButton.styleFrom( + backgroundColor: primaryColor, + foregroundColor: Colors.white, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + ), + ), + ), + if (selectedDate != null) + IconButton( + icon: const Icon(Icons.close, color: primaryColor), + onPressed: () { + setState(() { + selectedDate = null; + }); + }, + ), + ], + ), + ), + + // StreamBuilder ambil data dari Firestore + Expanded( + child: StreamBuilder( + stream: getCaptureStream(), + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const Center(child: CircularProgressIndicator()); + } + if (!snapshot.hasData || snapshot.data!.docs.isEmpty) { + return const Center(child: Text("Belum ada riwayat deteksi.")); + } + + final items = snapshot.data!.docs; + + return Padding( + padding: const EdgeInsets.symmetric(horizontal: 16), + child: GridView.builder( + itemCount: items.length, + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2, + crossAxisSpacing: 12, + mainAxisSpacing: 12, + childAspectRatio: 0.84, // proporsi ideal + ), + itemBuilder: (context, index) { + final data = items[index].data() as Map; + final imageUrl = data['imageUrl'] ?? ''; + final timestamp = (data['timestamp'] as Timestamp).toDate(); + final timeText = DateFormat('yyyy-MM-dd • HH:mm').format(timestamp); + + return GestureDetector( + onTap: () { + showDialog( + context: context, + builder: (_) => Dialog( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)), + child: ClipRRect( + borderRadius: BorderRadius.circular(16), + child: Image.network(imageUrl, fit: BoxFit.contain), + ), + ), + ); + }, + child: Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(20), + boxShadow: const [ + BoxShadow( + color: Colors.black12, + blurRadius: 6, + offset: Offset(0, 4), + ) + ], + border: Border.all(color: primaryColor.withOpacity(0.1)), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + ClipRRect( + borderRadius: const BorderRadius.vertical(top: Radius.circular(20)), + child: AspectRatio( + aspectRatio: 1.2, + child: Image.network( + imageUrl, + width: double.infinity, + fit: BoxFit.cover, + loadingBuilder: (context, child, loadingProgress) { + if (loadingProgress == null) return child; + return Container( + color: Colors.black12, + child: const Center(child: CircularProgressIndicator()), + ); + }, + errorBuilder: (context, error, stackTrace) => Container( + color: Colors.black12, + child: const Icon(Icons.broken_image, size: 40, color: Colors.grey), + ), + ), + ), + ), + const SizedBox(height: 8), + const Icon(Icons.visibility, size: 22, color: primaryColor), + const SizedBox(height: 4), + Padding( + padding: const EdgeInsets.only(bottom: 2), // jarak ke bawah lebih sempit + child: Text( + timeText, + textAlign: TextAlign.center, + style: const TextStyle( + fontSize: 12, + fontWeight: FontWeight.w600, + color: primaryColor, + ), + ), + ), + ], +), + + ), + ); + }, + ), +); + + + }, + ), + ), + ], + ), + ); + } +} diff --git a/lib/screens/live_stream/live_camera_page.dart b/lib/screens/live_stream/live_camera_page.dart new file mode 100644 index 0000000..049db93 --- /dev/null +++ b/lib/screens/live_stream/live_camera_page.dart @@ -0,0 +1,398 @@ +import 'dart:convert'; +import 'package:flutter/material.dart'; +import 'package:flutter_mjpeg/flutter_mjpeg.dart'; +import 'package:http/http.dart' as http; +import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:firebase_database/firebase_database.dart'; +import '../../widgets/costum_header.dart'; + +class LiveCameraPage extends StatefulWidget { + const LiveCameraPage({super.key}); + + @override + State createState() => _LiveCameraPageState(); +} + +class _LiveCameraPageState extends State { + String? _ipAddress; + bool _isStreamLoading = true; + bool _hasStreamError = false; + bool _isMotionSensorActive = false; + bool _hasCapturedRecently = false; + bool _isCapturingManually = false; + + @override + void initState() { + super.initState(); + _fetchIpAddress(); + _listenToMotionSensor(); + } + + void _listenToMotionSensor() { + final statusRef = FirebaseDatabase.instance.ref('sensorPIR/status'); + + statusRef.onValue.listen((event) async { + final status = event.snapshot.value; + + print("📥 Status PIR: $status"); + + if (status == 1 || status == '1' || status == true) { + setState(() => _isMotionSensorActive = true); + + if (!_hasCapturedRecently && _ipAddress != null) { + print("📸 Mulai capture otomatis..."); + _hasCapturedRecently = true; + await _captureAndUploadImage(); + + Future.delayed(const Duration(seconds: 10), () { + _hasCapturedRecently = false; + print("🔁 Reset capture flag."); + }); + } else { + print("⚠️ Sudah capture, tunggu delay."); + } + } else { + setState(() => _isMotionSensorActive = false); + } + }); + } + + Future _fetchIpAddress() async { + final ref = FirebaseDatabase.instance.ref('esp32cam/ip'); + final snapshot = await ref.get(); + if (snapshot.exists) { + setState(() { + _ipAddress = snapshot.value.toString(); + }); + print("📡 IP ESP32 ditemukan: $_ipAddress"); + } else { + setState(() => _ipAddress = null); + print("❌ IP ESP32 tidak ditemukan."); + } + } + + Future _captureAndUploadImage() async { + if (_ipAddress == null) return; + + final captureUrl = 'http://$_ipAddress/capture'; + const cloudinaryUrl = 'https://api.cloudinary.com/v1_1/dd2elgipw/image/upload'; + const uploadPreset = 'cam_upload'; + + try { + print("📷 Mengambil gambar dari $_ipAddress..."); + + // Coba capture maksimal 2 kali + http.Response? response; + for (int attempt = 1; attempt <= 2; attempt++) { + try { + response = await http + .get(Uri.parse(captureUrl)) + .timeout(const Duration(seconds: 10)); + if (response.statusCode == 200 && response.bodyBytes.isNotEmpty) { + print("✅ Capture berhasil pada attempt ke-$attempt"); + break; + } else { + print("⚠️ Capture gagal (status: ${response.statusCode}), mencoba ulang..."); + } + } catch (e) { + print("⚠️ Error saat capture ke-$attempt: $e"); + if (attempt == 2) rethrow; + await Future.delayed(const Duration(seconds: 2)); + } + } + + if (response == null || response.bodyBytes.isEmpty) { + throw Exception('Gambar kosong atau tidak valid'); + } + + // Upload ke Cloudinary + final uploadRequest = http.MultipartRequest('POST', Uri.parse(cloudinaryUrl)); + uploadRequest.fields['upload_preset'] = uploadPreset; + uploadRequest.files.add( + http.MultipartFile.fromBytes('file', response.bodyBytes, filename: 'snapshot.jpg'), + ); + + print("☁️ Upload ke Cloudinary..."); + final uploadResponse = await uploadRequest.send(); + final result = await http.Response.fromStream(uploadResponse); + + if (uploadResponse.statusCode != 200) throw Exception('Upload gagal'); + + final data = jsonDecode(result.body); + final imageUrl = data['secure_url']; + + // Simpan gambar dan log ke Firestore + await FirebaseFirestore.instance.collection('captures').add({ + 'imageUrl': imageUrl, + 'timestamp': Timestamp.now(), + }); + + await FirebaseFirestore.instance.collection('History').add({ + 'motion': 'Mencurigakan', + 'timestamp': DateTime.now().toIso8601String(), + }); + + if (context.mounted) { + ScaffoldMessenger.of(context).showSnackBar( + const SnackBar(content: Text('✅ Gambar berhasil diunggah')), + ); + } + } catch (e) { + print("❌ Error saat capture: $e"); + if (context.mounted) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar(content: Text('❌ Terjadi kesalahan saat capture: $e')), + ); + } + } + } + + @override + Widget build(BuildContext context) { + const primaryColor = Color(0xFF5F59A6); + + return Scaffold( + appBar: const CustomAppBar(title: 'AntiSpy Cam'), + body: _ipAddress == null + ? const Center(child: CircularProgressIndicator()) + : ListView( + padding: const EdgeInsets.all(16), + children: [ + _buildStreamSection(primaryColor), + const SizedBox(height: 20), + _buildMotionSensorSection(primaryColor), + _buildDetectionHistorySection(primaryColor), + ], + ), + ); + } + + Widget _buildStreamSection(Color primaryColor) { + final streamUrl = 'http://$_ipAddress/stream'; + + return Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const Text( + 'Live Camera Feed', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Colors.black87), + ), + const SizedBox(height: 12), + ClipRRect( + borderRadius: BorderRadius.circular(16), + child: Container( + height: 200, + color: Colors.black, + child: Stack( + children: [ + Mjpeg( + stream: streamUrl, + isLive: true, + fit: BoxFit.cover, + loading: (context) { + WidgetsBinding.instance.addPostFrameCallback((_) { + if (_isStreamLoading) { + setState(() => _isStreamLoading = false); + } + }); + return const Center(child: CircularProgressIndicator(color: Colors.white)); + }, + error: (context, error, stack) { + WidgetsBinding.instance.addPostFrameCallback((_) { + if (!_hasStreamError) { + setState(() { + _hasStreamError = true; + _isStreamLoading = false; + }); + } + }); + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Icon(Icons.error_outline, color: Colors.red, size: 48), + const SizedBox(height: 8), + Text('Gagal memuat stream', style: TextStyle(color: Colors.red[300])), + Text('Periksa koneksi kamera', style: TextStyle(color: Colors.red[300])), + ], + ), + ); + }, + ), + if (_isStreamLoading) + const Center(child: CircularProgressIndicator(color: Colors.white)), + ], + ), + ), + ), + const SizedBox(height: 16), + ElevatedButton.icon( + onPressed: _isCapturingManually + ? null + : () async { + if (_ipAddress == null) return; + setState(() => _isCapturingManually = true); + await _captureAndUploadImage(); + if (mounted) setState(() => _isCapturingManually = false); + }, + icon: const Icon(Icons.camera_alt), + label: Text(_isCapturingManually ? 'Mengambil...' : 'Ambil Gambar'), + style: ElevatedButton.styleFrom( + foregroundColor: Colors.white, + backgroundColor: primaryColor, + padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + ), + ), + ], + ); + } + + Widget _buildMotionSensorSection(Color primaryColor) { + return _SensorStatusCard( + icon: Icons.motion_photos_on, + label: 'Sensor Gerak', + value: _isMotionSensorActive ? "Mencurigakan" : "Aktivitas Normal", + active: _isMotionSensorActive, + primaryColor: primaryColor, + ); + } + + Widget _buildDetectionHistorySection(Color primaryColor) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const SizedBox(height: 16), + const Text( + 'Riwayat Deteksi', + style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color: Colors.black87), + ), + const SizedBox(height: 12), + SizedBox( + height: 250, + child: StreamBuilder( + stream: FirebaseFirestore.instance + .collection('History') + .orderBy('timestamp', descending: true) + .snapshots(), + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const Center(child: CircularProgressIndicator()); + } + + if (snapshot.hasError) { + return const Text('Gagal memuat data riwayat.'); + } + + if (!snapshot.hasData || snapshot.data!.docs.isEmpty) { + return const Padding( + padding: EdgeInsets.all(8.0), + child: Text('Tidak ada riwayat deteksi', style: TextStyle(color: Colors.grey)), + ); + } + + final logs = snapshot.data!.docs.map((doc) { + final data = doc.data() as Map; + final motionType = data['motion'] ?? 'Tidak diketahui'; + final timestampStr = data['timestamp'] ?? ''; + String formattedTime = 'Tidak diketahui'; + + try { + final dt = DateTime.parse(timestampStr); + formattedTime = TimeOfDay.fromDateTime(dt).format(context); + } catch (_) {} + + return DetectionLog( + time: formattedTime, + type: motionType, + ); + }).toList(); + + return ListView.builder( + itemCount: logs.length, + itemBuilder: (context, index) => + _buildDetectionLogItem(logs[index], primaryColor), + ); + }, + ), + ), + ], + ); + } + + Widget _buildDetectionLogItem(DetectionLog log, Color primaryColor) { + return Card( + elevation: 2, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)), + margin: const EdgeInsets.only(bottom: 12), + child: ListTile( + leading: Container( + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + color: primaryColor.withOpacity(0.1), + shape: BoxShape.circle, + ), + child: Icon(Icons.notifications_active, color: primaryColor), + ), + title: Text(log.type, style: const TextStyle(fontWeight: FontWeight.w500)), + subtitle: Text("Waktu: ${log.time}"), + trailing: Icon(Icons.chevron_right, color: primaryColor), + ), + ); + } +} + +class DetectionLog { + final String time; + final String type; + + DetectionLog({required this.time, required this.type}); +} + +class _SensorStatusCard extends StatelessWidget { + final IconData icon; + final String label; + final String value; + final bool active; + final Color primaryColor; + + const _SensorStatusCard({ + required this.icon, + required this.label, + required this.value, + required this.active, + required this.primaryColor, + }); + + @override + Widget build(BuildContext context) { + return AnimatedContainer( + duration: const Duration(milliseconds: 300), + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: active ? primaryColor.withOpacity(0.2) : primaryColor.withOpacity(0.1), + borderRadius: BorderRadius.circular(16), + border: Border.all( + color: active ? primaryColor : primaryColor.withOpacity(0.7), + width: 1.5, + ), + ), + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(icon, size: 36, color: active ? primaryColor : primaryColor.withOpacity(0.8)), + const SizedBox(height: 8), + Text(label, style: const TextStyle(fontSize: 14, fontWeight: FontWeight.bold)), + const SizedBox(height: 4), + Text( + value, + style: TextStyle( + fontSize: 13, + color: active ? primaryColor : Colors.black54, + ), + ), + ], + ), + ); + } +} diff --git a/lib/screens/main_screen.dart b/lib/screens/main_screen.dart new file mode 100644 index 0000000..e877697 --- /dev/null +++ b/lib/screens/main_screen.dart @@ -0,0 +1,107 @@ +import 'package:antispy/screens/history/history_page.dart'; +import 'package:antispy/screens/live_stream/live_camera_page.dart'; +import 'package:antispy/screens/settings/settings_page.dart'; +import 'package:flutter/material.dart'; + +class MainScreen extends StatefulWidget { + const MainScreen({super.key}); + + @override + State createState() => _MainScreenState(); +} + +class _MainScreenState extends State { + int _currentIndex = 1; // camera FAB default di tengah + + final List _screens = const [ + HistoryPage(), + LiveCameraPage(), + SettingsPage(), + ]; + + void _onTap(int index) { + setState(() => _currentIndex = index); + } + + void _onMiddleTap() { + _onTap(1); // live camera + } + + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.grey[100], + extendBody: true, + resizeToAvoidBottomInset: false, + body: _screens[_currentIndex], + floatingActionButton: FloatingActionButton( + onPressed: _onMiddleTap, + backgroundColor: const Color(0xFF5F59A6), + elevation: 8, + shape: const CircleBorder(), + child: Icon( + _currentIndex == 1 ? Icons.camera_alt : Icons.camera_alt_outlined, + size: 30, + color: Colors.white, + ), + ), + floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, + bottomNavigationBar: BottomAppBar( + shape: const CircularNotchedRectangle(), + notchMargin: 10, + elevation: 10, + color: const Color(0xFF5F59A6), // UNGU gelap + child: SizedBox( + height: 70, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + _buildNavItem( + Icons.history_outlined, + Icons.history, + "History", + 0, + ), // Spacer tengah untuk FAB + const SizedBox(width: 48), + + _buildNavItem( + Icons.settings_outlined, + Icons.settings, + "Settings", + 2, + ), + ], + ), + ), + ), + ); + } + + Widget _buildNavItem( + IconData icon, IconData activeIcon, String label, int index) { + final isSelected = _currentIndex == index; + + return GestureDetector( + onTap: () => _onTap(index), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Icon( + isSelected ? activeIcon : icon, + color: isSelected ? Colors.white : Colors.white60, + ), + const SizedBox(height: 4), + Text( + label, + style: TextStyle( + fontSize: 12, + color: isSelected ? Colors.white : Colors.white60, + fontWeight: isSelected ? FontWeight.bold : FontWeight.normal, + ), + ), + ], + ), + ); + } +} diff --git a/lib/screens/notifications/notifications_page.dart b/lib/screens/notifications/notifications_page.dart new file mode 100644 index 0000000..df7d3ba --- /dev/null +++ b/lib/screens/notifications/notifications_page.dart @@ -0,0 +1,88 @@ +import 'package:flutter/material.dart'; +import 'package:cloud_firestore/cloud_firestore.dart'; +import 'package:intl/intl.dart'; +import '../../widgets/costum_header.dart'; + +class NotificationsPage extends StatelessWidget { + const NotificationsPage({super.key}); + + Stream getNotifications() { + return FirebaseFirestore.instance + .collection('notifications') + .orderBy('timestamp', descending: true) + .snapshots(); + } + + Icon _getIcon(String type) { + switch (type) { + case 'gerak': + return const Icon(Icons.directions_run, color: Colors.redAccent); + case 'jarak': + return const Icon(Icons.sensors, color: Colors.orange); + case 'kamera': + return const Icon(Icons.camera_alt, color: Colors.blueAccent); + default: + return const Icon(Icons.notification_important, color: Colors.grey); + } + } + + @override + Widget build(BuildContext context) { + // const primaryColor = Color(0xFF5F59A6); + + return Scaffold( + appBar: const CustomAppBar(title: 'Notifikasi'), + body: StreamBuilder( + stream: getNotifications(), + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.waiting) { + return const Center(child: CircularProgressIndicator()); + } + + if (!snapshot.hasData || snapshot.data!.docs.isEmpty) { + return const Center(child: Text("Belum ada notifikasi.")); + } + + final items = snapshot.data!.docs; + + return ListView.separated( + padding: const EdgeInsets.all(16), + separatorBuilder: (context, index) => const SizedBox(height: 12), + itemCount: items.length, + itemBuilder: (context, index) { + final data = items[index].data() as Map; + final type = data['type'] ?? 'lainnya'; + final message = data['message'] ?? 'Tidak ada pesan'; + final timestamp = (data['timestamp'] as Timestamp).toDate(); + final timeText = + DateFormat('dd MMM yyyy • HH:mm').format(timestamp); + + return Container( + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(16), + boxShadow: const [ + BoxShadow( + color: Colors.black12, + blurRadius: 4, + offset: Offset(0, 2)) + ], + ), + child: ListTile( + leading: _getIcon(type), + title: Text( + message, + style: const TextStyle(fontWeight: FontWeight.w600), + ), + subtitle: Text(timeText), + contentPadding: + const EdgeInsets.symmetric(vertical: 8, horizontal: 16), + ), + ); + }, + ); + }, + ), + ); + } +} diff --git a/lib/screens/settings/settings_page.dart b/lib/screens/settings/settings_page.dart new file mode 100644 index 0000000..ce583a1 --- /dev/null +++ b/lib/screens/settings/settings_page.dart @@ -0,0 +1,203 @@ +import 'package:flutter/material.dart'; +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:firebase_database/firebase_database.dart'; +import '../../widgets/costum_header.dart'; + +class SettingsPage extends StatefulWidget { + const SettingsPage({super.key}); + + @override + State createState() => _SettingsPageState(); +} + +class _SettingsPageState extends State { + final DatabaseReference _dbRef = FirebaseDatabase.instance.ref('control'); + + bool _isDeviceOn = false; + String _mode = 'otomatis'; + + @override + void initState() { + super.initState(); + _listenToStatus(); + } + + void _listenToStatus() { + _dbRef.child('status').onValue.listen((event) { + final value = event.snapshot.value; + if (value is bool) { + setState(() { + _isDeviceOn = value; + }); + } + }); + + _dbRef.child('mode').onValue.listen((event) { + final value = event.snapshot.value; + if (value is String) { + setState(() { + _mode = value; + }); + } + }); + } + + void _toggleDevice(bool value) { + _dbRef.child('status').set(value); + } + + void _changeMode(String newMode) { + _dbRef.child('mode').set(newMode); + } + + void _logout() async { + await FirebaseAuth.instance.signOut(); + if (mounted) { + Navigator.of(context).pushReplacementNamed('/login'); + } + } + + @override + Widget build(BuildContext context) { + const primaryColor = Color(0xFF5F59A6); + + return Scaffold( + appBar: const CustomAppBar(title: 'Pengaturan'), + body: SingleChildScrollView( + padding: const EdgeInsets.all(20), + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Column( + children: [ + const Icon(Icons.settings, size: 64, color: primaryColor), + const SizedBox(height: 10), + Text( + 'Pengaturan Perangkat', + style: TextStyle( + fontSize: 22, + fontWeight: FontWeight.bold, + color: primaryColor, + ), + ), + ], + ), + const SizedBox(height: 30), + _buildControlCard( + icon: Icons.power_settings_new, + title: 'Status Perangkat', + subtitle: _isDeviceOn ? 'AKTIF' : 'NONAKTIF', + trailing: Switch( + value: _isDeviceOn, + onChanged: _toggleDevice, + activeColor: primaryColor, + ), + iconColor: _isDeviceOn ? Colors.green : Colors.red, + ), + const SizedBox(height: 20), + _buildControlCard( + icon: Icons.settings_remote, + title: 'Mode', + subtitle: _mode.toUpperCase(), + trailing: Row( + mainAxisSize: MainAxisSize.min, + children: [ + ChoiceChip( + label: const Text('Otomatis'), + selected: _mode == 'otomatis', + onSelected: (selected) { + if (selected) _changeMode('otomatis'); + }, + selectedColor: primaryColor, + labelStyle: TextStyle( + color: _mode == 'otomatis' ? Colors.white : Colors.black, + ), + ), + const SizedBox(width: 10), + ChoiceChip( + label: const Text('Manual'), + selected: _mode == 'manual', + onSelected: (selected) { + if (selected) _changeMode('manual'); + }, + selectedColor: primaryColor, + labelStyle: TextStyle( + color: _mode == 'manual' ? Colors.white : Colors.black, + ), + ), + ], + ), + iconColor: primaryColor, + ), + const SizedBox(height: 30), + ElevatedButton.icon( + onPressed: _logout, + icon: const Icon(Icons.logout), + label: const Text('Logout'), + style: ElevatedButton.styleFrom( + backgroundColor: Colors.redAccent, + foregroundColor: Colors.white, + padding: const EdgeInsets.symmetric(vertical: 14), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + ), + ), + ), + ], + ), + ), + ); + } + + Widget _buildControlCard({ + required IconData icon, + required String title, + required String subtitle, + required Widget trailing, + required Color iconColor, + }) { + return Container( + padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 16), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(18), + boxShadow: const [ + BoxShadow(color: Colors.black12, blurRadius: 6, offset: Offset(0, 3)), + ], + border: Border.all(color: Colors.black12), + ), + child: Row( + children: [ + Container( + padding: const EdgeInsets.all(10), + decoration: BoxDecoration( + color: iconColor.withOpacity(0.1), + shape: BoxShape.circle, + ), + child: Icon(icon, size: 28, color: iconColor), + ), + const SizedBox(width: 16), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(title, + style: const TextStyle( + fontWeight: FontWeight.w600, fontSize: 16)), + const SizedBox(height: 4), + Text( + subtitle, + style: TextStyle( + color: Colors.grey[700], + fontSize: 13, + fontWeight: FontWeight.w500), + ), + ], + ), + ), + trailing, + ], + ), + ); + } +} diff --git a/lib/screens/splash_screen.dart b/lib/screens/splash_screen.dart new file mode 100644 index 0000000..e904b7d --- /dev/null +++ b/lib/screens/splash_screen.dart @@ -0,0 +1,101 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:firebase_auth/firebase_auth.dart'; + +class SplashScreen extends StatefulWidget { + const SplashScreen({super.key}); + + @override + State createState() => _SplashScreenState(); +} + +class _SplashScreenState extends State + with SingleTickerProviderStateMixin { + late AnimationController _controller; + late Animation _scaleAnimation; + late Animation _opacityAnimation; + + @override + void initState() { + super.initState(); + + _controller = AnimationController( + vsync: this, + duration: const Duration(seconds: 2), + ); + + _scaleAnimation = Tween(begin: 0.6, end: 1.0).animate( + CurvedAnimation(parent: _controller, curve: Curves.easeOutBack), + ); + + _opacityAnimation = Tween(begin: 0.0, end: 1.0).animate( + CurvedAnimation(parent: _controller, curve: Curves.easeIn), + ); + + _controller.forward(); + + Timer(const Duration(seconds: 3), () { + final user = FirebaseAuth.instance.currentUser; + if (user != null) { + Navigator.pushReplacementNamed(context, '/main'); + } else { + Navigator.pushReplacementNamed(context, '/login'); + } + }); + } + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Container( + decoration: const BoxDecoration( + gradient: LinearGradient( + colors: [Color(0xFF6B4EFF),Color(0xFF8B70FF) ], + begin: Alignment.topLeft, + end: Alignment.bottomRight, + ), + ), + child: Center( + child: AnimatedBuilder( + animation: _controller, + builder: (context, child) { + return Opacity( + opacity: _opacityAnimation.value, + child: Transform.scale( + scale: _scaleAnimation.value, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Image.asset( + 'assets/images/logo.png', + width: 80, + height: 80, + ), + const SizedBox(height: 20), + Text( + 'AntiSpy Security', + style: Theme.of(context).textTheme.headlineMedium?.copyWith( + color: Colors.white, + fontWeight: FontWeight.bold, + letterSpacing: 1.2, + ), + ), + const SizedBox(height: 20), + const CircularProgressIndicator(color: Colors.white), + ], + ), + ), + ); + }, + ), + ), + ), + ); + } +} diff --git a/lib/services/auth_service.dart b/lib/services/auth_service.dart new file mode 100644 index 0000000..a7be379 --- /dev/null +++ b/lib/services/auth_service.dart @@ -0,0 +1,23 @@ +import 'package:firebase_auth/firebase_auth.dart'; + +class AuthService { + final FirebaseAuth _auth = FirebaseAuth.instance; + + Future login(String email, String password) async { + try { + UserCredential result = await _auth.signInWithEmailAndPassword( + email: email, + password: password, + ); + return result.user; + } catch (e) { + throw e.toString(); + } + } + + Future logout() async { + await _auth.signOut(); + } + + Stream get userStream => _auth.authStateChanges(); +} diff --git a/lib/widgets/costum_header.dart b/lib/widgets/costum_header.dart new file mode 100644 index 0000000..7c9d406 --- /dev/null +++ b/lib/widgets/costum_header.dart @@ -0,0 +1,41 @@ +import 'package:flutter/material.dart'; +import '../screens/notifications/notifications_page.dart'; + +class CustomAppBar extends StatelessWidget implements PreferredSizeWidget { + final String title; + + const CustomAppBar({super.key, required this.title}); + + @override + Widget build(BuildContext context) { + return AppBar( + backgroundColor: const Color(0xFF5F59A6), // ungu gelap + elevation: 4, + title: Text( + title, + style: const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 20, + ), + ), + actions: [ + IconButton( + icon: const Icon(Icons.notifications, color: Colors.white), + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const NotificationsPage(), + ), + ); + }, + ), +], + + ); + } + + @override + Size get preferredSize => const Size.fromHeight(kToolbarHeight); +} diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..84d48fb --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,458 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _flutterfire_internals: + dependency: transitive + description: + name: _flutterfire_internals + sha256: "214e6f07e2a44f45972e0365c7b537eaeaddb4598db0778dd4ac64b4acd3f5b1" + url: "https://pub.dev" + source: hosted + version: "1.3.55" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + cloud_firestore: + dependency: "direct main" + description: + name: cloud_firestore + sha256: d25c956be5261c14bc9a69c9662de8addb308376b4b53a64469aade52e7b02f8 + url: "https://pub.dev" + source: hosted + version: "5.6.8" + cloud_firestore_platform_interface: + dependency: transitive + description: + name: cloud_firestore_platform_interface + sha256: ee2b8f8c602ede36073afd3741e99cfea9dd982b4a44833daf665134d151c32a + url: "https://pub.dev" + source: hosted + version: "6.6.8" + cloud_firestore_web: + dependency: transitive + description: + name: cloud_firestore_web + sha256: b99bc4f1f70787f694b73bc6fce238d4d6cc822c9b31ba8ef1578b180b6f77bc + url: "https://pub.dev" + source: hosted + version: "4.4.8" + collection: + dependency: transitive + description: + name: collection + sha256: a1ace0a119f20aabc852d165077c036cd864315bd99b7eaa10a60100341941bf + url: "https://pub.dev" + source: hosted + version: "1.19.0" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + firebase_auth: + dependency: "direct main" + description: + name: firebase_auth + sha256: "10cd3f00a247f33b0a5c77574011a87379432bf3fec77a500b55f2bcc30ddd8b" + url: "https://pub.dev" + source: hosted + version: "5.5.4" + firebase_auth_platform_interface: + dependency: transitive + description: + name: firebase_auth_platform_interface + sha256: "2d15872a8899b0459fab6b4c148fd142e135acfc8a303d383d80b455e4dba7bd" + url: "https://pub.dev" + source: hosted + version: "7.6.3" + firebase_auth_web: + dependency: transitive + description: + name: firebase_auth_web + sha256: efba45393050ca03d992eae1d305d5fc8c0c9f5980624053512e935c23767c4f + url: "https://pub.dev" + source: hosted + version: "5.14.3" + firebase_core: + dependency: "direct main" + description: + name: firebase_core + sha256: "8cfe3c900512399ce8d50fcc817e5758ff8615eeb6fa5c846a4cc47bbf6353b6" + url: "https://pub.dev" + source: hosted + version: "3.13.1" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + sha256: d7253d255ff10f85cfd2adaba9ac17bae878fa3ba577462451163bd9f1d1f0bf + url: "https://pub.dev" + source: hosted + version: "5.4.0" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + sha256: ddd72baa6f727e5b23f32d9af23d7d453d67946f380bd9c21daf474ee0f7326e + url: "https://pub.dev" + source: hosted + version: "2.23.0" + firebase_database: + dependency: "direct main" + description: + name: firebase_database + sha256: e98c32b9462779f4c45eb036dcaf22cd6a17204e80f77c292bd1d05b08c8ef81 + url: "https://pub.dev" + source: hosted + version: "11.3.6" + firebase_database_platform_interface: + dependency: transitive + description: + name: firebase_database_platform_interface + sha256: "3e81c5e2152ad996309458f8338977989d81a44a692e27180db9380f6faffafb" + url: "https://pub.dev" + source: hosted + version: "0.2.6+6" + firebase_database_web: + dependency: transitive + description: + name: firebase_database_web + sha256: "0289c1c7832b3ca79520517c54bf42a40b9bfefa8198906145ab17e75989d80f" + url: "https://pub.dev" + source: hosted + version: "0.2.6+12" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_hooks: + dependency: transitive + description: + name: flutter_hooks + sha256: b772e710d16d7a20c0740c4f855095026b31c7eb5ba3ab67d2bd52021cd9461d + url: "https://pub.dev" + source: hosted + version: "0.21.2" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" + url: "https://pub.dev" + source: hosted + version: "5.0.0" + flutter_mjpeg: + dependency: "direct main" + description: + name: flutter_mjpeg + sha256: "46ea3f1a49838deb8e2b01a70b897313c7f985affecfaf3b3bae6f4e15405b6b" + url: "https://pub.dev" + source: hosted + version: "2.0.4" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + go_router: + dependency: "direct main" + description: + name: go_router + sha256: "0b1e06223bee260dee31a171fb1153e306907563a0b0225e8c1733211911429a" + url: "https://pub.dev" + source: hosted + version: "15.1.2" + http: + dependency: transitive + description: + name: http + sha256: "5895291c13fa8a3bd82e76d5627f69e0d85ca6a30dcac95c4ea19a5d555879c2" + url: "https://pub.dev" + source: hosted + version: "0.13.6" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + intl: + dependency: "direct main" + description: + name: intl + sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" + url: "https://pub.dev" + source: hosted + version: "0.20.2" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "7bb2830ebd849694d1ec25bf1f44582d6ac531a57a365a803a6034ff751d2d06" + url: "https://pub.dev" + source: hosted + version: "10.0.7" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: "9491a714cca3667b60b5c420da8217e6de0d1ba7a5ec322fab01758f6998f379" + url: "https://pub.dev" + source: hosted + version: "3.0.8" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 + url: "https://pub.dev" + source: hosted + version: "5.1.1" + logging: + dependency: transitive + description: + name: logging + sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + url: "https://pub.dev" + source: hosted + version: "1.3.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + url: "https://pub.dev" + source: hosted + version: "1.15.0" + nested: + dependency: transitive + description: + name: nested + sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" + url: "https://pub.dev" + source: hosted + version: "1.0.0" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + provider: + dependency: "direct main" + description: + name: provider + sha256: "4abbd070a04e9ddc287673bf5a030c7ca8b685ff70218720abab8b092f53dd84" + url: "https://pub.dev" + source: hosted + version: "6.1.5" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "9f47fd3630d76be3ab26f0ee06d213679aa425996925ff3feffdec504931c377" + url: "https://pub.dev" + source: hosted + version: "1.12.0" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "688af5ed3402a4bde5b3a6c15fd768dbf2621a614950b17f04626c431ab3c4c3" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "664d3a9a64782fcdeb83ce9c6b39e78fd2971d4e37827b9b06c3aa1edc5e760c" + url: "https://pub.dev" + source: hosted + version: "0.7.3" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + visibility_detector: + dependency: transitive + description: + name: visibility_detector + sha256: dd5cc11e13494f432d15939c3aa8ae76844c42b723398643ce9addb88a5ed420 + url: "https://pub.dev" + source: hosted + version: "0.4.0+2" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b + url: "https://pub.dev" + source: hosted + version: "14.3.0" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + webview_flutter: + dependency: "direct main" + description: + name: webview_flutter + sha256: c3e4fe614b1c814950ad07186007eff2f2e5dd2935eba7b9a9a1af8e5885f1ba + url: "https://pub.dev" + source: hosted + version: "4.13.0" + webview_flutter_android: + dependency: "direct main" + description: + name: webview_flutter_android + sha256: f6e6afef6e234801da77170f7a1847ded8450778caf2fe13979d140484be3678 + url: "https://pub.dev" + source: hosted + version: "4.7.0" + webview_flutter_platform_interface: + dependency: "direct main" + description: + name: webview_flutter_platform_interface + sha256: f0dc2dc3a2b1e3a6abdd6801b9355ebfeb3b8f6cde6b9dc7c9235909c4a1f147 + url: "https://pub.dev" + source: hosted + version: "2.13.1" + webview_flutter_wkwebview: + dependency: transitive + description: + name: webview_flutter_wkwebview + sha256: a3d461fe3467014e05f3ac4962e5fdde2a4bf44c561cb53e9ae5c586600fdbc3 + url: "https://pub.dev" + source: hosted + version: "3.22.0" +sdks: + dart: ">=3.6.2 <4.0.0" + flutter: ">=3.27.0" diff --git a/pubspec.yaml b/pubspec.yaml new file mode 100644 index 0000000..b11b80f --- /dev/null +++ b/pubspec.yaml @@ -0,0 +1,99 @@ +name: antispy +description: "A new Flutter project." +# The following line prevents the package from being accidentally published to +# pub.dev using `flutter pub publish`. This is preferred for private packages. +publish_to: 'none' # Remove this line if you wish to publish to pub.dev + +# The following defines the version and build number for your application. +# A version number is three numbers separated by dots, like 1.2.43 +# followed by an optional build number separated by a +. +# Both the version and the builder number may be overridden in flutter +# build by specifying --build-name and --build-number, respectively. +# In Android, build-name is used as versionName while build-number used as versionCode. +# Read more about Android versioning at https://developer.android.com/studio/publish/versioning +# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. +# Read more about iOS versioning at +# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html +# In Windows, build-name is used as the major, minor, and patch parts +# of the product and file versions while build-number is used as the build suffix. +version: 1.0.0+1 + +environment: + sdk: ^3.6.2 + +# Dependencies specify other packages that your package needs in order to work. +# To automatically upgrade your package dependencies to the latest versions +# consider running `flutter pub upgrade --major-versions`. Alternatively, +# dependencies can be manually updated by changing the version numbers below to +# the latest version available on pub.dev. To see which dependencies have newer +# versions available, run `flutter pub outdated`. +dependencies: + flutter: + sdk: flutter + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^1.0.8 + firebase_core: ^3.13.1 + go_router: ^15.1.2 + firebase_auth: ^5.5.4 + provider: ^6.1.5 + firebase_database: ^11.3.6 + intl: ^0.20.2 + cloud_firestore: ^5.6.8 + flutter_mjpeg: ^2.0.4 + webview_flutter: ^4.13.0 + webview_flutter_android: ^4.7.0 + webview_flutter_platform_interface: ^2.13.1 + +dev_dependencies: + flutter_test: + sdk: flutter + + # The "flutter_lints" package below contains a set of recommended lints to + # encourage good coding practices. The lint set provided by the package is + # activated in the `analysis_options.yaml` file located at the root of your + # package. See that file for information about deactivating specific lint + # rules and activating additional ones. + flutter_lints: ^5.0.0 + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter packages. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + assets: + - assets/images/logo.png + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/to/resolution-aware-images + + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/to/asset-from-package + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/to/font-from-package