From 5da455c17d7282e045001e002d398bf8efe6b945 Mon Sep 17 00:00:00 2001 From: vamzx Date: Tue, 14 May 2024 14:55:06 +0530 Subject: [PATCH 1/2] dark mode feature --- app/.flutter-plugins-dependencies | 2 +- app/lib/common_widget/custom_button.dart | 26 ++++-- app/lib/main.dart | 29 ++++--- app/lib/screens/landing_screen/dashboard.dart | 15 ++-- app/lib/screens/landing_screen/drawer.dart | 31 ++++--- app/lib/screens/landing_screen/navbar.dart | 11 +-- .../screens/landing_screen/notification.dart | 81 ++++++++++--------- app/lib/screens/profile/profile.dart | 10 +-- app/lib/screens/request_notes/request.dart | 38 +++++---- app/lib/theme/theme.dart | 22 +++++ app/lib/theme/theme_provider.dart | 22 +++++ app/pubspec.yaml | 1 + 12 files changed, 178 insertions(+), 110 deletions(-) create mode 100644 app/lib/theme/theme.dart create mode 100644 app/lib/theme/theme_provider.dart diff --git a/app/.flutter-plugins-dependencies b/app/.flutter-plugins-dependencies index cc88b8c..c055af8 100644 --- a/app/.flutter-plugins-dependencies +++ b/app/.flutter-plugins-dependencies @@ -1 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_local_notifications","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/flutter_local_notifications-17.1.1/","native_build":true,"dependencies":[]},{"name":"flutter_pdfview","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/flutter_pdfview-1.3.2/","native_build":true,"dependencies":[]},{"name":"open_file","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/open_file-3.3.2/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.2/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"permission_handler_apple","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/permission_handler_apple-9.4.4/","native_build":true,"dependencies":[]},{"name":"share_plus","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/share_plus-9.0.0/","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.4.0/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/sqflite-2.3.3/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_ios","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/url_launcher_ios-6.2.5/","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_local_notifications","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/flutter_local_notifications-17.1.1/","native_build":true,"dependencies":[]},{"name":"flutter_pdfview","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/flutter_pdfview-1.3.2/","native_build":true,"dependencies":[]},{"name":"open_file","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/open_file-3.3.2/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/path_provider_android-2.2.4/","native_build":true,"dependencies":[]},{"name":"permission_handler_android","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/permission_handler_android-12.0.5/","native_build":true,"dependencies":[]},{"name":"share_plus","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/share_plus-9.0.0/","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/shared_preferences_android-2.2.2/","native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/sqflite-2.3.3/","native_build":true,"dependencies":[]},{"name":"url_launcher_android","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/url_launcher_android-6.3.1/","native_build":true,"dependencies":[]}],"macos":[{"name":"flutter_local_notifications","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/flutter_local_notifications-17.1.1/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.2/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"share_plus","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/share_plus-9.0.0/","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.4.0/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/sqflite-2.3.3/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_macos","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/url_launcher_macos-3.1.0/","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]},{"name":"share_plus","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/share_plus-9.0.0/","native_build":false,"dependencies":["url_launcher_linux"]},{"name":"shared_preferences_linux","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.3.2/","native_build":false,"dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/url_launcher_linux-3.1.1/","native_build":true,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/","native_build":false,"dependencies":[]},{"name":"permission_handler_windows","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/permission_handler_windows-0.2.1/","native_build":true,"dependencies":[]},{"name":"share_plus","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/share_plus-9.0.0/","native_build":true,"dependencies":["url_launcher_windows"]},{"name":"shared_preferences_windows","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.3.2/","native_build":false,"dependencies":["path_provider_windows"]},{"name":"url_launcher_windows","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.1/","native_build":true,"dependencies":[]}],"web":[{"name":"permission_handler_html","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/permission_handler_html-0.1.1/","dependencies":[]},{"name":"share_plus","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/share_plus-9.0.0/","dependencies":["url_launcher_web"]},{"name":"shared_preferences_web","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/shared_preferences_web-2.3.0/","dependencies":[]},{"name":"url_launcher_web","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/url_launcher_web-2.3.1/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_local_notifications","dependencies":[]},{"name":"flutter_pdfview","dependencies":[]},{"name":"open_file","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"permission_handler","dependencies":["permission_handler_android","permission_handler_apple","permission_handler_html","permission_handler_windows"]},{"name":"permission_handler_android","dependencies":[]},{"name":"permission_handler_apple","dependencies":[]},{"name":"permission_handler_html","dependencies":[]},{"name":"permission_handler_windows","dependencies":[]},{"name":"share_plus","dependencies":["url_launcher_web","url_launcher_windows","url_launcher_linux"]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2024-05-13 21:07:44.992866","version":"3.19.5"} \ No newline at end of file +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_local_notifications","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_local_notifications-17.1.2\\\\","native_build":true,"dependencies":[]},{"name":"flutter_pdfview","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_pdfview-1.3.2\\\\","native_build":true,"dependencies":[]},{"name":"open_file","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\open_file-3.3.2\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"permission_handler_apple","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_apple-9.4.4\\\\","native_build":true,"dependencies":[]},{"name":"share_plus","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\share_plus-9.0.0\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.3.3+1\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_ios","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_ios-6.3.0\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_local_notifications","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_local_notifications-17.1.2\\\\","native_build":true,"dependencies":[]},{"name":"flutter_pdfview","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_pdfview-1.3.2\\\\","native_build":true,"dependencies":[]},{"name":"open_file","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\open_file-3.3.2\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.4\\\\","native_build":true,"dependencies":[]},{"name":"permission_handler_android","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_android-12.0.6\\\\","native_build":true,"dependencies":[]},{"name":"share_plus","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\share_plus-9.0.0\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_android-2.2.2\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.3.3+1\\\\","native_build":true,"dependencies":[]},{"name":"url_launcher_android","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_android-6.3.1\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"flutter_local_notifications","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_local_notifications-17.1.2\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"share_plus","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\share_plus-9.0.0\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.3.3+1\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_macos","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_macos-3.2.0\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]},{"name":"share_plus","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\share_plus-9.0.0\\\\","native_build":false,"dependencies":["url_launcher_linux"]},{"name":"shared_preferences_linux","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_linux-2.3.2\\\\","native_build":false,"dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_linux-3.1.1\\\\","native_build":true,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.2.1\\\\","native_build":false,"dependencies":[]},{"name":"permission_handler_windows","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_windows-0.2.1\\\\","native_build":true,"dependencies":[]},{"name":"share_plus","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\share_plus-9.0.0\\\\","native_build":true,"dependencies":["url_launcher_windows"]},{"name":"shared_preferences_windows","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_windows-2.3.2\\\\","native_build":false,"dependencies":["path_provider_windows"]},{"name":"url_launcher_windows","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_windows-3.1.1\\\\","native_build":true,"dependencies":[]}],"web":[{"name":"permission_handler_html","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_html-0.1.1\\\\","dependencies":[]},{"name":"share_plus","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\share_plus-9.0.0\\\\","dependencies":["url_launcher_web"]},{"name":"shared_preferences_web","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_web-2.3.0\\\\","dependencies":[]},{"name":"url_launcher_web","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_web-2.3.1\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_local_notifications","dependencies":[]},{"name":"flutter_pdfview","dependencies":[]},{"name":"open_file","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"permission_handler","dependencies":["permission_handler_android","permission_handler_apple","permission_handler_html","permission_handler_windows"]},{"name":"permission_handler_android","dependencies":[]},{"name":"permission_handler_apple","dependencies":[]},{"name":"permission_handler_html","dependencies":[]},{"name":"permission_handler_windows","dependencies":[]},{"name":"share_plus","dependencies":["url_launcher_web","url_launcher_windows","url_launcher_linux"]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2024-05-14 14:41:21.347116","version":"3.19.4"} \ No newline at end of file diff --git a/app/lib/common_widget/custom_button.dart b/app/lib/common_widget/custom_button.dart index 41e046d..63d7b97 100644 --- a/app/lib/common_widget/custom_button.dart +++ b/app/lib/common_widget/custom_button.dart @@ -1,7 +1,15 @@ import 'package:flutter/material.dart'; +Widget CustomButton( + String title, + IconData icon, + VoidCallback onTap, + double screenWidth, + BuildContext context, +) { + final ThemeData theme = Theme.of(context); + final Color primaryColor = theme.colorScheme.primary; + final Color secondaryColor = theme.colorScheme.secondary; -Widget CustomButton(String title, IconData icon, VoidCallback onTap, - double screenWidth, BuildContext context) { return Padding( padding: const EdgeInsets.only(top: 10, left: 30, right: 30, bottom: 10), child: GestureDetector( @@ -12,16 +20,20 @@ Widget CustomButton(String title, IconData icon, VoidCallback onTap, width: screenWidth * 0.90 - 30, height: 50, decoration: BoxDecoration( - color: const Color.fromARGB(255, 129, 129, 129).withOpacity(0.1), + color: theme.colorScheme.background, borderRadius: BorderRadius.circular(30), - gradient: const LinearGradient( - colors: [Colors.blue, Colors.red, Colors.green], + gradient: LinearGradient( + colors: [ + primaryColor, + primaryColor.withOpacity(0.8), // Adjust opacity for gradient + primaryColor.withOpacity(0.6), // Adjust opacity for gradient + ], ), ), child: Row( children: [ const SizedBox(width: 50), - Icon(icon, color: Theme.of(context).colorScheme.secondary), + Icon(icon, color: secondaryColor), const SizedBox(width: 30), Expanded( child: Text( @@ -29,7 +41,7 @@ Widget CustomButton(String title, IconData icon, VoidCallback onTap, softWrap: false, overflow: TextOverflow.ellipsis, style: TextStyle( - color: Theme.of(context).colorScheme.secondary, + color: secondaryColor, fontSize: 20, ), ), diff --git a/app/lib/main.dart b/app/lib/main.dart index d095c80..d57a9b6 100644 --- a/app/lib/main.dart +++ b/app/lib/main.dart @@ -1,21 +1,25 @@ -import 'dart:developer'; - -import 'package:examtime/services/SharedServices/Preferences.dart'; -import 'package:examtime/services/SharedServices/Sharedservices.dart'; -import 'package:examtime/screens/request_notes/request.dart'; -import 'package:flutter/material.dart'; -import 'package:examtime/screens/landing_screen/dashboard.dart'; -import 'package:examtime/screens/liked_notes/liked.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:examtime/screens/auth_screen/signin.dart'; import 'package:examtime/screens/auth_screen/signup.dart'; +import 'package:examtime/screens/landing_screen/dashboard.dart'; +import 'package:examtime/screens/liked_notes/liked.dart'; import 'package:examtime/screens/profile/profile.dart'; +import 'package:examtime/screens/request_notes/request.dart'; +import 'package:examtime/services/SharedServices/Preferences.dart'; +import 'package:examtime/services/SharedServices/Sharedservices.dart'; +import 'package:examtime/theme/theme_provider.dart'; +import 'package:flutter/material.dart'; +import 'package:provider/provider.dart'; import 'package:shared_preferences/shared_preferences.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); preferences = await SharedPreferences.getInstance(); - runApp(const MyApp()); + runApp( + ChangeNotifierProvider(create: (context) => ThemeProvider(), + child: const MyApp(), + ) + ); } class MyApp extends StatelessWidget { @@ -25,9 +29,8 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( title: 'ExamTime', - theme: ThemeData( - primaryColor: const Color(0xFF1F2937), - ), + //themeMode: ThemeMode.system, + theme: Provider.of(context).themeData, initialRoute: '/', routes: { '/': (context) => LoadingScreen(), @@ -91,7 +94,7 @@ class _LoadingScreenState extends State @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: _backgroundColorAnimation.value ?? Colors.white, + backgroundColor: Theme.of(context).colorScheme.background, body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/app/lib/screens/landing_screen/dashboard.dart b/app/lib/screens/landing_screen/dashboard.dart index 9527b0d..1d294e0 100644 --- a/app/lib/screens/landing_screen/dashboard.dart +++ b/app/lib/screens/landing_screen/dashboard.dart @@ -1,17 +1,17 @@ +import 'dart:io'; + import 'package:dio/dio.dart'; -import 'package:examtime/model/notes.dart'; import 'package:examtime/screens/landing_screen/popupdetail.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:http/http.dart' as http; +import 'package:open_file/open_file.dart'; import 'package:path_provider/path_provider.dart'; import 'package:permission_handler/permission_handler.dart'; -import 'package:flutter_local_notifications/flutter_local_notifications.dart'; -import 'dart:io'; -import 'package:open_file/open_file.dart'; import 'package:share_plus/share_plus.dart'; -import 'navbar.dart'; import 'drawer.dart'; +import 'navbar.dart'; final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); @@ -64,6 +64,7 @@ class DashboardPage extends StatelessWidget { return false; // Disables the back button }, child: Scaffold( + backgroundColor: Theme.of(context).colorScheme.background, appBar: CommonNavBar(), drawer: AppDrawer(), // Use the CommonNavBar as the app bar body: ListView.builder( @@ -80,7 +81,7 @@ class DashboardPage extends StatelessWidget { margin: EdgeInsets.all(20), padding: EdgeInsets.all(20), decoration: BoxDecoration( - color: Colors.white, + color: Theme.of(context).colorScheme.primary, borderRadius: BorderRadius.circular(10), boxShadow: [ BoxShadow( @@ -118,7 +119,7 @@ class DashboardPage extends StatelessWidget { ? Icons.favorite : Icons.favorite_border, color: - likedStatus[index] ? Colors.red : Colors.grey, + likedStatus[index] ? Colors.red :Theme.of(context).colorScheme.onSurface, ), onPressed: () { _toggleLikedStatus(index, likedStatus); diff --git a/app/lib/screens/landing_screen/drawer.dart b/app/lib/screens/landing_screen/drawer.dart index ef89045..5016e9a 100644 --- a/app/lib/screens/landing_screen/drawer.dart +++ b/app/lib/screens/landing_screen/drawer.dart @@ -1,8 +1,11 @@ import 'dart:ui'; + +import 'package:examtime/screens/profile/profile.dart'; import 'package:examtime/services/SharedServices/Sharedservices.dart'; +import 'package:examtime/theme/theme_provider.dart'; import 'package:flutter/material.dart'; -import 'package:examtime/screens/profile/profile.dart'; -import 'package:flutter/widgets.dart'; +import 'package:provider/provider.dart'; + import '../auth_screen/signin.dart'; import '../liked_notes/liked.dart'; import '../request_notes/request.dart'; @@ -14,7 +17,7 @@ class AppDrawer extends StatelessWidget { var media = MediaQuery.of(context).size; return Drawer( width: media.width, - backgroundColor: Colors.transparent, + backgroundColor: Theme.of(context).colorScheme.background, child: BackdropFilter( filter: ImageFilter.blur( sigmaX: 5.0, @@ -26,7 +29,7 @@ class AppDrawer extends StatelessWidget { ), Container( width: media.width * 0.70, - decoration: BoxDecoration(color: Colors.white), + decoration: BoxDecoration(color: Theme.of(context).colorScheme.background), child: SafeArea( child: Padding( padding: EdgeInsets.all(45), @@ -49,13 +52,12 @@ class AppDrawer extends StatelessWidget { ), ), ), - SizedBox(width: 20), + const SizedBox(width: 20), Expanded( child: Text( 'John Doe', - style: TextStyle( + style: const TextStyle( fontSize: 20, - color: Colors.black, fontWeight: FontWeight.w700, ), ), @@ -67,8 +69,7 @@ class AppDrawer extends StatelessWidget { SizedBox( height: 15, ), - const Divider( - color: Colors.black26, + Divider( height: 1, ), Expanded( @@ -118,6 +119,16 @@ class AppDrawer extends StatelessWidget { const SizedBox( height: 15, ), + ListTile( + leading: Icon(Icons.lightbulb), + title: Text('Change Mode'), + onTap: () { + Provider.of(context, listen: false).toggleTheme(); + }, + ), + const SizedBox( + height: 15, + ), ListTile( leading: Icon(Icons.logout), title: Text('Logout'), @@ -131,7 +142,6 @@ class AppDrawer extends StatelessWidget { ), ), const Divider( - color: Colors.black26, height: 1, ), const SizedBox( @@ -148,7 +158,6 @@ class AppDrawer extends StatelessWidget { "Switch Account", style: TextStyle( fontSize: 18, - color: Colors.black, fontWeight: FontWeight.w700), ), Padding( diff --git a/app/lib/screens/landing_screen/navbar.dart b/app/lib/screens/landing_screen/navbar.dart index efb4946..2dece92 100644 --- a/app/lib/screens/landing_screen/navbar.dart +++ b/app/lib/screens/landing_screen/navbar.dart @@ -1,7 +1,6 @@ -import 'package:flutter/material.dart'; import 'package:cached_network_image/cached_network_image.dart'; -import 'package:responsive_sizer/responsive_sizer.dart'; -import 'dashboard.dart'; +import 'package:flutter/material.dart'; + import 'notification.dart'; class CommonNavBar extends StatelessWidget implements PreferredSizeWidget { @@ -12,11 +11,10 @@ class CommonNavBar extends StatelessWidget implements PreferredSizeWidget { @override Widget build(BuildContext context) { - final ThemeData theme = Theme.of(context); return AppBar( automaticallyImplyLeading: false, - backgroundColor: theme.primaryColor, + backgroundColor: Theme.of(context).colorScheme.primary, centerTitle: true, title: Row( children: [ @@ -62,8 +60,7 @@ class CommonNavBar extends StatelessWidget implements PreferredSizeWidget { items: [ PopupMenuItem( child: Container( - color: Colors.white, - // Set the background color to white + color: Theme.of(context).colorScheme.background, child: NotificationPage(), ), ), diff --git a/app/lib/screens/landing_screen/notification.dart b/app/lib/screens/landing_screen/notification.dart index 21b52f8..013e5cc 100644 --- a/app/lib/screens/landing_screen/notification.dart +++ b/app/lib/screens/landing_screen/notification.dart @@ -7,45 +7,52 @@ class NotificationPage extends StatelessWidget { } contentBox(context) { - return Stack( - children: [ - SingleChildScrollView( - child: Container( - color: Colors.white, // Set the background color to white - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - 'Notifications', - style: TextStyle(fontSize: 22, fontWeight: FontWeight.w600), + return Container( + color: Theme.of(context).colorScheme.background, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Stack( + children: [ + SingleChildScrollView( + child: Container( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + 'Notifications', + style: TextStyle(fontSize: 22, fontWeight: FontWeight.w600), + ), + SizedBox( + height: 15, + ), + Text( + 'You have 3 new notifications', + style: TextStyle(fontSize: 14), + textAlign: TextAlign.center, + ), + SizedBox( + height: 22, + ), + Align( + alignment: Alignment.bottomRight, + child: TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text( + 'Close', + style: TextStyle(fontSize: 18), + )), + ), + ], + ), ), - SizedBox( - height: 15, - ), - Text( - 'You have 3 new notifications', - style: TextStyle(fontSize: 14), - textAlign: TextAlign.center, - ), - SizedBox( - height: 22, - ), - Align( - alignment: Alignment.bottomRight, - child: TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text( - 'Close', - style: TextStyle(fontSize: 18), - )), - ), - ], - ), + ), + ], ), - ), - ], + ], + ), ); } } diff --git a/app/lib/screens/profile/profile.dart b/app/lib/screens/profile/profile.dart index a85cbf3..0ce8a7c 100644 --- a/app/lib/screens/profile/profile.dart +++ b/app/lib/screens/profile/profile.dart @@ -1,12 +1,8 @@ import 'package:examtime/common_widget/custom_button.dart'; import 'package:examtime/common_widget/emailWidget.dart'; -import 'package:flutter/material.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:responsive_sizer/responsive_sizer.dart'; -import 'package:examtime/screens/landing_screen/dashboard.dart'; -import 'package:examtime/screens/landing_screen/notification.dart'; -import 'package:examtime/screens/landing_screen/navbar.dart'; import 'package:examtime/screens/landing_screen/drawer.dart'; +import 'package:examtime/screens/landing_screen/navbar.dart'; +import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class ProfileScreen extends StatefulWidget { @@ -108,7 +104,7 @@ class _ProfileScreenState extends State { _email, style: TextStyle( fontSize: 16, - color: Colors.grey, + color: Theme.of(context).colorScheme.primary, ), ), SizedBox(height: 16), diff --git a/app/lib/screens/request_notes/request.dart b/app/lib/screens/request_notes/request.dart index 4292b60..8e4f53e 100644 --- a/app/lib/screens/request_notes/request.dart +++ b/app/lib/screens/request_notes/request.dart @@ -1,7 +1,7 @@ -import 'package:flutter/material.dart'; import 'package:examtime/screens/landing_screen/dashboard.dart'; -import 'package:examtime/screens/landing_screen/navbar.dart'; import 'package:examtime/screens/landing_screen/drawer.dart'; +import 'package:examtime/screens/landing_screen/navbar.dart'; +import 'package:flutter/material.dart'; class RequestNotesPage extends StatefulWidget { static const String routeName = '/request_notes'; @@ -38,20 +38,18 @@ class _RequestNotesPageState extends State { children: [ TextField( controller: _noteController, - cursorColor: Color(0xFF1F2937), // Set cursor color - decoration: const InputDecoration( + cursorColor: Theme.of(context).colorScheme.secondary, // Set cursor color + decoration: InputDecoration( labelText: 'Enter your note request', - labelStyle: TextStyle( - color: Color(0xFF1F2937), // Set label text color - ), + labelStyle: TextStyle(color: Theme.of(context).colorScheme.secondary), border: OutlineInputBorder( borderSide: BorderSide( - color: Color(0xFF1F2937), // Set border color + color: Theme.of(context).colorScheme.secondary, // Set border color ), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide( - color: Color(0xFF1F2937), // Set border color + color: Theme.of(context).colorScheme.secondary, // Set border color ), ), ), @@ -66,7 +64,7 @@ class _RequestNotesPageState extends State { style: TextStyle(color: Colors.white), ), style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFF1F2937), + backgroundColor: Theme.of(context).colorScheme.primary, ), ), ], @@ -87,29 +85,30 @@ class _RequestNotesPageState extends State { context: context, builder: (BuildContext context) { return AlertDialog( - backgroundColor: Colors.white, // Set background color to white + backgroundColor: Theme.of(context).colorScheme.background, content: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - const Padding( + Padding( padding: EdgeInsets.all(16.0), child: Text( 'Note Request Sent', textAlign: TextAlign.center, style: TextStyle( - color: Color(0xFF1F2937), // Set text color + color: Theme.of(context).colorScheme.secondary, // Set text color fontWeight: FontWeight.bold, ), ), ), - const Padding( + Padding( padding: EdgeInsets.symmetric(horizontal: 16.0), - child: Text( + child: + Text( 'Your note request has been sent successfully.', textAlign: TextAlign.center, style: TextStyle( - color: Color(0xFF1F2937), // Set text color + color:Theme.of(context).colorScheme.secondary, // Set text color ), ), ), @@ -124,7 +123,7 @@ class _RequestNotesPageState extends State { decoration: BoxDecoration( borderRadius: BorderRadius.circular(10.0), border: Border.all( - color: Color(0xFF1F2937), + color: Theme.of(context).colorScheme.secondary, // Set border color ), ), @@ -132,12 +131,11 @@ class _RequestNotesPageState extends State { child: Text( 'OK', style: - TextStyle(color: Color(0xFF1F2937)), // Set text color - ), + TextStyle(color: Theme.of(context).colorScheme.secondary) ), ), ), - ], + )], ), ); }, diff --git a/app/lib/theme/theme.dart b/app/lib/theme/theme.dart new file mode 100644 index 0000000..b3e90c2 --- /dev/null +++ b/app/lib/theme/theme.dart @@ -0,0 +1,22 @@ +import 'package:flutter/material.dart'; + +ThemeData lightMode = ThemeData( + brightness: Brightness.light, + colorScheme: ColorScheme.light( + background: Colors.white, + primary: Colors.blue.shade900, + secondary: Colors.black, + + ) + + +); +ThemeData darkMode = ThemeData( + brightness: Brightness.dark, + colorScheme: ColorScheme.dark( + background: Colors.grey.shade900, + primary: Colors.blue.shade200, + secondary: Colors.white, + ) +); + diff --git a/app/lib/theme/theme_provider.dart b/app/lib/theme/theme_provider.dart new file mode 100644 index 0000000..0d78fff --- /dev/null +++ b/app/lib/theme/theme_provider.dart @@ -0,0 +1,22 @@ +import 'package:examtime/theme/theme.dart'; +import 'package:flutter/material.dart'; + +class ThemeProvider with ChangeNotifier{ + ThemeData _themeData = lightMode; + + ThemeData get themeData => _themeData; + + set themeData(ThemeData themeData) { + _themeData = themeData; + notifyListeners(); + } + + void toggleTheme() { + if(_themeData == lightMode) { + themeData = darkMode; + } else { + themeData = lightMode; + } + } + +} \ No newline at end of file diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 24883e4..f9e85f1 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -35,6 +35,7 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 + provider: cached_network_image: ^3.3.1 responsive_sizer: ^3.3.0+1 flutter_svg: ^2.0.10+1 From ec7d8608fc3f1167d8f50bcbd61ad8a0e41d2364 Mon Sep 17 00:00:00 2001 From: vamzx Date: Tue, 14 May 2024 14:55:06 +0530 Subject: [PATCH 2/2] dark mode feature --- app/.flutter-plugins-dependencies | 3 +- app/lib/common_widget/custom_button.dart | 26 ++++-- app/lib/main.dart | 35 ++++---- app/lib/screens/landing_screen/dashboard.dart | 11 +-- app/lib/screens/landing_screen/drawer.dart | 29 ++++--- app/lib/screens/landing_screen/navbar.dart | 11 +-- .../screens/landing_screen/notification.dart | 81 ++++++++++--------- app/lib/screens/profile/profile.dart | 10 +-- app/lib/screens/request_notes/request.dart | 38 +++++---- app/lib/theme/theme.dart | 22 +++++ app/lib/theme/theme_provider.dart | 22 +++++ app/pubspec.yaml | 1 + 12 files changed, 177 insertions(+), 112 deletions(-) create mode 100644 app/lib/theme/theme.dart create mode 100644 app/lib/theme/theme_provider.dart diff --git a/app/.flutter-plugins-dependencies b/app/.flutter-plugins-dependencies index 0020168..c055af8 100644 --- a/app/.flutter-plugins-dependencies +++ b/app/.flutter-plugins-dependencies @@ -1,2 +1 @@ -{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_local_notifications","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/flutter_local_notifications-17.1.1/","native_build":true,"dependencies":[]},{"name":"flutter_pdfview","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/flutter_pdfview-1.3.2/","native_build":true,"dependencies":[]},{"name":"open_file","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/open_file-3.3.2/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.2/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"permission_handler_apple","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/permission_handler_apple-9.4.4/","native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/sqflite-2.3.3/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_ios","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/url_launcher_ios-6.2.5/","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_local_notifications","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/flutter_local_notifications-17.1.1/","native_build":true,"dependencies":[]},{"name":"flutter_pdfview","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/flutter_pdfview-1.3.2/","native_build":true,"dependencies":[]},{"name":"open_file","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/open_file-3.3.2/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/path_provider_android-2.2.4/","native_build":true,"dependencies":[]},{"name":"permission_handler_android","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/permission_handler_android-12.0.5/","native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/sqflite-2.3.3/","native_build":true,"dependencies":[]},{"name":"url_launcher_android","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/url_launcher_android-6.3.1/","native_build":true,"dependencies":[]}],"macos":[{"name":"flutter_local_notifications","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/flutter_local_notifications-17.1.1/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.2/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/sqflite-2.3.3/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_macos","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/url_launcher_macos-3.1.0/","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]},{"name":"url_launcher_linux","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/url_launcher_linux-3.1.1/","native_build":true,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/","native_build":false,"dependencies":[]},{"name":"permission_handler_windows","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/permission_handler_windows-0.2.1/","native_build":true,"dependencies":[]},{"name":"url_launcher_windows","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.1/","native_build":true,"dependencies":[]}],"web":[{"name":"permission_handler_html","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/permission_handler_html-0.1.1/","dependencies":[]},{"name":"url_launcher_web","path":"/Users/yashshukla/.pub-cache/hosted/pub.dev/url_launcher_web-2.3.1/","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_local_notifications","dependencies":[]},{"name":"flutter_pdfview","dependencies":[]},{"name":"open_file","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"permission_handler","dependencies":["permission_handler_android","permission_handler_apple","permission_handler_html","permission_handler_windows"]},{"name":"permission_handler_android","dependencies":[]},{"name":"permission_handler_apple","dependencies":[]},{"name":"permission_handler_html","dependencies":[]},{"name":"permission_handler_windows","dependencies":[]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2024-05-02 11:33:01.206945","version":"3.19.5"} - +{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_local_notifications","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_local_notifications-17.1.2\\\\","native_build":true,"dependencies":[]},{"name":"flutter_pdfview","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_pdfview-1.3.2\\\\","native_build":true,"dependencies":[]},{"name":"open_file","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\open_file-3.3.2\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"permission_handler_apple","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_apple-9.4.4\\\\","native_build":true,"dependencies":[]},{"name":"share_plus","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\share_plus-9.0.0\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.3.3+1\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_ios","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_ios-6.3.0\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"flutter_local_notifications","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_local_notifications-17.1.2\\\\","native_build":true,"dependencies":[]},{"name":"flutter_pdfview","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_pdfview-1.3.2\\\\","native_build":true,"dependencies":[]},{"name":"open_file","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\open_file-3.3.2\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.4\\\\","native_build":true,"dependencies":[]},{"name":"permission_handler_android","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_android-12.0.6\\\\","native_build":true,"dependencies":[]},{"name":"share_plus","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\share_plus-9.0.0\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_android-2.2.2\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.3.3+1\\\\","native_build":true,"dependencies":[]},{"name":"url_launcher_android","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_android-6.3.1\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"flutter_local_notifications","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\flutter_local_notifications-17.1.2\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"share_plus","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\share_plus-9.0.0\\\\","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.4.0\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.3.3+1\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_macos","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_macos-3.2.0\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[]},{"name":"share_plus","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\share_plus-9.0.0\\\\","native_build":false,"dependencies":["url_launcher_linux"]},{"name":"shared_preferences_linux","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_linux-2.3.2\\\\","native_build":false,"dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_linux-3.1.1\\\\","native_build":true,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.2.1\\\\","native_build":false,"dependencies":[]},{"name":"permission_handler_windows","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_windows-0.2.1\\\\","native_build":true,"dependencies":[]},{"name":"share_plus","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\share_plus-9.0.0\\\\","native_build":true,"dependencies":["url_launcher_windows"]},{"name":"shared_preferences_windows","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_windows-2.3.2\\\\","native_build":false,"dependencies":["path_provider_windows"]},{"name":"url_launcher_windows","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_windows-3.1.1\\\\","native_build":true,"dependencies":[]}],"web":[{"name":"permission_handler_html","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\permission_handler_html-0.1.1\\\\","dependencies":[]},{"name":"share_plus","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\share_plus-9.0.0\\\\","dependencies":["url_launcher_web"]},{"name":"shared_preferences_web","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_web-2.3.0\\\\","dependencies":[]},{"name":"url_launcher_web","path":"C:\\\\Users\\\\vamzx\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\url_launcher_web-2.3.1\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"flutter_local_notifications","dependencies":[]},{"name":"flutter_pdfview","dependencies":[]},{"name":"open_file","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"permission_handler","dependencies":["permission_handler_android","permission_handler_apple","permission_handler_html","permission_handler_windows"]},{"name":"permission_handler_android","dependencies":[]},{"name":"permission_handler_apple","dependencies":[]},{"name":"permission_handler_html","dependencies":[]},{"name":"permission_handler_windows","dependencies":[]},{"name":"share_plus","dependencies":["url_launcher_web","url_launcher_windows","url_launcher_linux"]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]}],"date_created":"2024-05-14 14:41:21.347116","version":"3.19.4"} \ No newline at end of file diff --git a/app/lib/common_widget/custom_button.dart b/app/lib/common_widget/custom_button.dart index 41e046d..63d7b97 100644 --- a/app/lib/common_widget/custom_button.dart +++ b/app/lib/common_widget/custom_button.dart @@ -1,7 +1,15 @@ import 'package:flutter/material.dart'; +Widget CustomButton( + String title, + IconData icon, + VoidCallback onTap, + double screenWidth, + BuildContext context, +) { + final ThemeData theme = Theme.of(context); + final Color primaryColor = theme.colorScheme.primary; + final Color secondaryColor = theme.colorScheme.secondary; -Widget CustomButton(String title, IconData icon, VoidCallback onTap, - double screenWidth, BuildContext context) { return Padding( padding: const EdgeInsets.only(top: 10, left: 30, right: 30, bottom: 10), child: GestureDetector( @@ -12,16 +20,20 @@ Widget CustomButton(String title, IconData icon, VoidCallback onTap, width: screenWidth * 0.90 - 30, height: 50, decoration: BoxDecoration( - color: const Color.fromARGB(255, 129, 129, 129).withOpacity(0.1), + color: theme.colorScheme.background, borderRadius: BorderRadius.circular(30), - gradient: const LinearGradient( - colors: [Colors.blue, Colors.red, Colors.green], + gradient: LinearGradient( + colors: [ + primaryColor, + primaryColor.withOpacity(0.8), // Adjust opacity for gradient + primaryColor.withOpacity(0.6), // Adjust opacity for gradient + ], ), ), child: Row( children: [ const SizedBox(width: 50), - Icon(icon, color: Theme.of(context).colorScheme.secondary), + Icon(icon, color: secondaryColor), const SizedBox(width: 30), Expanded( child: Text( @@ -29,7 +41,7 @@ Widget CustomButton(String title, IconData icon, VoidCallback onTap, softWrap: false, overflow: TextOverflow.ellipsis, style: TextStyle( - color: Theme.of(context).colorScheme.secondary, + color: secondaryColor, fontSize: 20, ), ), diff --git a/app/lib/main.dart b/app/lib/main.dart index 9a085fb..87dcb29 100644 --- a/app/lib/main.dart +++ b/app/lib/main.dart @@ -1,21 +1,19 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:examtime/screens/auth_screen/signin.dart'; +import 'package:examtime/screens/auth_screen/signup.dart'; import 'package:examtime/screens/discussion/discussion.dart'; - -import 'dart:developer'; - +import 'package:examtime/screens/landing_screen/dashboard.dart'; +import 'package:examtime/screens/liked_notes/liked.dart'; +import 'package:examtime/screens/profile/profile.dart'; +import 'package:examtime/screens/request_notes/request.dart'; import 'package:examtime/services/SharedServices/Preferences.dart'; import 'package:examtime/services/SharedServices/Sharedservices.dart'; -import 'package:examtime/screens/request_notes/request.dart'; import 'package:examtime/services/notification_service.dart'; +import 'package:examtime/theme/theme_provider.dart'; import 'package:flutter/material.dart'; -import 'package:examtime/screens/landing_screen/dashboard.dart'; -import 'package:examtime/screens/liked_notes/liked.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:examtime/screens/auth_screen/signin.dart'; -import 'package:examtime/screens/auth_screen/signup.dart'; -import 'package:examtime/screens/profile/profile.dart'; import 'package:flutter_local_notifications/flutter_local_notifications.dart'; +import 'package:provider/provider.dart'; import 'package:shared_preferences/shared_preferences.dart'; -import 'package:examtime/screens/auth_screen/otp.dart'; final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); @@ -23,7 +21,11 @@ void main() async { WidgetsFlutterBinding.ensureInitialized(); await LocalNotificationService().init(); preferences = await SharedPreferences.getInstance(); - runApp(const MyApp()); + runApp( + ChangeNotifierProvider(create: (context) => ThemeProvider(), + child: const MyApp(), + ) + ); } Future backgroundHandler() async { @@ -38,9 +40,8 @@ class MyApp extends StatelessWidget { return MaterialApp( debugShowCheckedModeBanner: false, title: 'ExamTime', - theme: ThemeData( - primaryColor: const Color(0xFF1F2937), - ), + //themeMode: ThemeMode.system, + theme: Provider.of(context).themeData, initialRoute: '/', routes: { '/': (context) => const LoadingScreen(), @@ -53,7 +54,7 @@ class MyApp extends StatelessWidget { DiscussionPage.routeName: (context) => DiscussionPage(), //OTPPage.routeName: (context) => OTPPage(), - main + //main }, ); } @@ -108,7 +109,7 @@ class _LoadingScreenState extends State @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: _backgroundColorAnimation.value ?? Colors.white, + backgroundColor: Theme.of(context).colorScheme.background, body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, diff --git a/app/lib/screens/landing_screen/dashboard.dart b/app/lib/screens/landing_screen/dashboard.dart index c689539..167e9ac 100644 --- a/app/lib/screens/landing_screen/dashboard.dart +++ b/app/lib/screens/landing_screen/dashboard.dart @@ -1,3 +1,5 @@ +import 'dart:io'; + // import 'dart:convert'; // import 'package:dio/dio.dart'; // import 'package:examtime/model/notes.dart'; @@ -541,22 +543,20 @@ import 'package:examtime/screens/note_preview/preview_note_screen.dart'; import 'package:examtime/services/ApiServices/api_services.dart.dart'; import 'package:examtime/services/notification_service.dart'; import 'package:dio/dio.dart'; -import 'package:examtime/model/notes.dart'; import 'package:examtime/screens/landing_screen/popupdetail.dart'; import 'package:flutter/material.dart'; +import 'package:flutter_local_notifications/flutter_local_notifications.dart'; import 'package:http/http.dart' as http; +import 'package:open_file/open_file.dart'; import 'package:path_provider/path_provider.dart'; import 'package:permission_handler/permission_handler.dart'; -import 'package:flutter_local_notifications/flutter_local_notifications.dart'; -import 'dart:io'; -import 'package:open_file/open_file.dart'; import 'package:share_plus/share_plus.dart'; +import 'drawer.dart'; import '../../model/user.dart'; import '../../services/SharedServices/Sharedservices.dart'; import 'navbar.dart'; -import 'drawer.dart'; final flutterLocalNotificationsPlugin = FlutterLocalNotificationsPlugin(); @@ -622,6 +622,7 @@ class _DashboardPageState extends State { return false; // Disables the back button }, child: Scaffold( + backgroundColor: Theme.of(context).colorScheme.background, appBar: const CommonNavBar(), drawer: AppDrawer(), // Use the CommonNavBar as the app bar body: isLoading diff --git a/app/lib/screens/landing_screen/drawer.dart b/app/lib/screens/landing_screen/drawer.dart index c796845..a6ae067 100644 --- a/app/lib/screens/landing_screen/drawer.dart +++ b/app/lib/screens/landing_screen/drawer.dart @@ -1,10 +1,13 @@ import 'package:examtime/screens/discussion/discussion.dart'; import 'dart:ui'; + +import 'package:examtime/screens/profile/profile.dart'; import 'package:examtime/model/user.dart'; import 'package:examtime/services/SharedServices/Sharedservices.dart'; +import 'package:examtime/theme/theme_provider.dart'; import 'package:flutter/material.dart'; -import 'package:examtime/screens/profile/profile.dart'; -import 'package:flutter/widgets.dart'; +import 'package:provider/provider.dart'; + import '../auth_screen/signin.dart'; import '../liked_notes/liked.dart'; import '../request_notes/request.dart'; @@ -16,7 +19,7 @@ class AppDrawer extends StatelessWidget { var media = MediaQuery.of(context).size; return Drawer( width: media.width, - backgroundColor: Colors.transparent, + backgroundColor: Theme.of(context).colorScheme.background, child: BackdropFilter( filter: ImageFilter.blur( sigmaX: 5.0, @@ -28,7 +31,7 @@ class AppDrawer extends StatelessWidget { ), Container( width: media.width * 0.70, - decoration: const BoxDecoration(color: Colors.white), + decoration: BoxDecoration(color: Theme.of(context).colorScheme.background), child: SafeArea( child: Padding( padding: const EdgeInsets.all(12), @@ -54,7 +57,7 @@ class AppDrawer extends StatelessWidget { ), ), ), - SizedBox(width: 20), + const SizedBox(width: 20), Expanded( child: Text( SharedServices.getLoginDetails() @@ -63,7 +66,6 @@ class AppDrawer extends StatelessWidget { 'user name', style: const TextStyle( fontSize: 20, - color: Colors.black, fontWeight: FontWeight.w700, ), ), @@ -75,8 +77,7 @@ class AppDrawer extends StatelessWidget { const SizedBox( height: 15, ), - const Divider( - color: Colors.black26, + Divider( height: 1, ), Expanded( @@ -126,6 +127,16 @@ class AppDrawer extends StatelessWidget { const SizedBox( height: 15, ), + ListTile( + leading: Icon(Icons.lightbulb), + title: Text('Change Mode'), + onTap: () { + Provider.of(context, listen: false).toggleTheme(); + }, + ), + const SizedBox( + height: 15, + ), ListTile( leading: Icon(Icons.logout), title: Text('Logout'), @@ -146,7 +157,6 @@ class AppDrawer extends StatelessWidget { ), ), const Divider( - color: Colors.black26, height: 1, ), const SizedBox( @@ -163,7 +173,6 @@ class AppDrawer extends StatelessWidget { "Switch Account", style: TextStyle( fontSize: 18, - color: Colors.black, fontWeight: FontWeight.w700), ), Image.asset("assets/img/next.png", diff --git a/app/lib/screens/landing_screen/navbar.dart b/app/lib/screens/landing_screen/navbar.dart index f650169..9f17e10 100644 --- a/app/lib/screens/landing_screen/navbar.dart +++ b/app/lib/screens/landing_screen/navbar.dart @@ -1,7 +1,6 @@ -import 'package:flutter/material.dart'; import 'package:cached_network_image/cached_network_image.dart'; -import 'package:responsive_sizer/responsive_sizer.dart'; -import 'dashboard.dart'; +import 'package:flutter/material.dart'; + import 'notification.dart'; class CommonNavBar extends StatelessWidget implements PreferredSizeWidget { @@ -12,11 +11,10 @@ class CommonNavBar extends StatelessWidget implements PreferredSizeWidget { @override Widget build(BuildContext context) { - final ThemeData theme = Theme.of(context); return AppBar( automaticallyImplyLeading: false, - backgroundColor: theme.primaryColor, + backgroundColor: Theme.of(context).colorScheme.primary, centerTitle: true, title: Row( children: [ @@ -60,8 +58,7 @@ class CommonNavBar extends StatelessWidget implements PreferredSizeWidget { items: [ PopupMenuItem( child: Container( - color: Colors.white, - // Set the background color to white + color: Theme.of(context).colorScheme.background, child: NotificationPage(), ), ), diff --git a/app/lib/screens/landing_screen/notification.dart b/app/lib/screens/landing_screen/notification.dart index 21b52f8..013e5cc 100644 --- a/app/lib/screens/landing_screen/notification.dart +++ b/app/lib/screens/landing_screen/notification.dart @@ -7,45 +7,52 @@ class NotificationPage extends StatelessWidget { } contentBox(context) { - return Stack( - children: [ - SingleChildScrollView( - child: Container( - color: Colors.white, // Set the background color to white - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Text( - 'Notifications', - style: TextStyle(fontSize: 22, fontWeight: FontWeight.w600), + return Container( + color: Theme.of(context).colorScheme.background, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Stack( + children: [ + SingleChildScrollView( + child: Container( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + 'Notifications', + style: TextStyle(fontSize: 22, fontWeight: FontWeight.w600), + ), + SizedBox( + height: 15, + ), + Text( + 'You have 3 new notifications', + style: TextStyle(fontSize: 14), + textAlign: TextAlign.center, + ), + SizedBox( + height: 22, + ), + Align( + alignment: Alignment.bottomRight, + child: TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text( + 'Close', + style: TextStyle(fontSize: 18), + )), + ), + ], + ), ), - SizedBox( - height: 15, - ), - Text( - 'You have 3 new notifications', - style: TextStyle(fontSize: 14), - textAlign: TextAlign.center, - ), - SizedBox( - height: 22, - ), - Align( - alignment: Alignment.bottomRight, - child: TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text( - 'Close', - style: TextStyle(fontSize: 18), - )), - ), - ], - ), + ), + ], ), - ), - ], + ], + ), ); } } diff --git a/app/lib/screens/profile/profile.dart b/app/lib/screens/profile/profile.dart index 924c191..8fe2cd2 100644 --- a/app/lib/screens/profile/profile.dart +++ b/app/lib/screens/profile/profile.dart @@ -4,13 +4,9 @@ import 'package:dio/dio.dart'; import 'package:examtime/common_widget/custom_button.dart'; import 'package:examtime/common_widget/emailWidget.dart'; import 'package:examtime/services/ApiServices/api_services.dart.dart'; -import 'package:flutter/material.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:responsive_sizer/responsive_sizer.dart'; -import 'package:examtime/screens/landing_screen/dashboard.dart'; -import 'package:examtime/screens/landing_screen/notification.dart'; -import 'package:examtime/screens/landing_screen/navbar.dart'; import 'package:examtime/screens/landing_screen/drawer.dart'; +import 'package:examtime/screens/landing_screen/navbar.dart'; +import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import '../../model/user.dart'; @@ -137,7 +133,7 @@ class _ProfileScreenState extends State { user?.email??_email, style: TextStyle( fontSize: 16, - color: Colors.grey, + color: Theme.of(context).colorScheme.primary, ), ), const SizedBox(height: 16), diff --git a/app/lib/screens/request_notes/request.dart b/app/lib/screens/request_notes/request.dart index 4292b60..8e4f53e 100644 --- a/app/lib/screens/request_notes/request.dart +++ b/app/lib/screens/request_notes/request.dart @@ -1,7 +1,7 @@ -import 'package:flutter/material.dart'; import 'package:examtime/screens/landing_screen/dashboard.dart'; -import 'package:examtime/screens/landing_screen/navbar.dart'; import 'package:examtime/screens/landing_screen/drawer.dart'; +import 'package:examtime/screens/landing_screen/navbar.dart'; +import 'package:flutter/material.dart'; class RequestNotesPage extends StatefulWidget { static const String routeName = '/request_notes'; @@ -38,20 +38,18 @@ class _RequestNotesPageState extends State { children: [ TextField( controller: _noteController, - cursorColor: Color(0xFF1F2937), // Set cursor color - decoration: const InputDecoration( + cursorColor: Theme.of(context).colorScheme.secondary, // Set cursor color + decoration: InputDecoration( labelText: 'Enter your note request', - labelStyle: TextStyle( - color: Color(0xFF1F2937), // Set label text color - ), + labelStyle: TextStyle(color: Theme.of(context).colorScheme.secondary), border: OutlineInputBorder( borderSide: BorderSide( - color: Color(0xFF1F2937), // Set border color + color: Theme.of(context).colorScheme.secondary, // Set border color ), ), focusedBorder: OutlineInputBorder( borderSide: BorderSide( - color: Color(0xFF1F2937), // Set border color + color: Theme.of(context).colorScheme.secondary, // Set border color ), ), ), @@ -66,7 +64,7 @@ class _RequestNotesPageState extends State { style: TextStyle(color: Colors.white), ), style: ElevatedButton.styleFrom( - backgroundColor: Color(0xFF1F2937), + backgroundColor: Theme.of(context).colorScheme.primary, ), ), ], @@ -87,29 +85,30 @@ class _RequestNotesPageState extends State { context: context, builder: (BuildContext context) { return AlertDialog( - backgroundColor: Colors.white, // Set background color to white + backgroundColor: Theme.of(context).colorScheme.background, content: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - const Padding( + Padding( padding: EdgeInsets.all(16.0), child: Text( 'Note Request Sent', textAlign: TextAlign.center, style: TextStyle( - color: Color(0xFF1F2937), // Set text color + color: Theme.of(context).colorScheme.secondary, // Set text color fontWeight: FontWeight.bold, ), ), ), - const Padding( + Padding( padding: EdgeInsets.symmetric(horizontal: 16.0), - child: Text( + child: + Text( 'Your note request has been sent successfully.', textAlign: TextAlign.center, style: TextStyle( - color: Color(0xFF1F2937), // Set text color + color:Theme.of(context).colorScheme.secondary, // Set text color ), ), ), @@ -124,7 +123,7 @@ class _RequestNotesPageState extends State { decoration: BoxDecoration( borderRadius: BorderRadius.circular(10.0), border: Border.all( - color: Color(0xFF1F2937), + color: Theme.of(context).colorScheme.secondary, // Set border color ), ), @@ -132,12 +131,11 @@ class _RequestNotesPageState extends State { child: Text( 'OK', style: - TextStyle(color: Color(0xFF1F2937)), // Set text color - ), + TextStyle(color: Theme.of(context).colorScheme.secondary) ), ), ), - ], + )], ), ); }, diff --git a/app/lib/theme/theme.dart b/app/lib/theme/theme.dart new file mode 100644 index 0000000..b3e90c2 --- /dev/null +++ b/app/lib/theme/theme.dart @@ -0,0 +1,22 @@ +import 'package:flutter/material.dart'; + +ThemeData lightMode = ThemeData( + brightness: Brightness.light, + colorScheme: ColorScheme.light( + background: Colors.white, + primary: Colors.blue.shade900, + secondary: Colors.black, + + ) + + +); +ThemeData darkMode = ThemeData( + brightness: Brightness.dark, + colorScheme: ColorScheme.dark( + background: Colors.grey.shade900, + primary: Colors.blue.shade200, + secondary: Colors.white, + ) +); + diff --git a/app/lib/theme/theme_provider.dart b/app/lib/theme/theme_provider.dart new file mode 100644 index 0000000..0d78fff --- /dev/null +++ b/app/lib/theme/theme_provider.dart @@ -0,0 +1,22 @@ +import 'package:examtime/theme/theme.dart'; +import 'package:flutter/material.dart'; + +class ThemeProvider with ChangeNotifier{ + ThemeData _themeData = lightMode; + + ThemeData get themeData => _themeData; + + set themeData(ThemeData themeData) { + _themeData = themeData; + notifyListeners(); + } + + void toggleTheme() { + if(_themeData == lightMode) { + themeData = darkMode; + } else { + themeData = lightMode; + } + } + +} \ No newline at end of file diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 97794de..f51123f 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -35,6 +35,7 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 + provider: cached_network_image: ^3.3.1 responsive_sizer: ^3.3.0+1 flutter_svg: ^2.0.10+1