diff --git a/assets/images/bg.jpg b/assets/images/bg.jpg new file mode 100644 index 0000000..3514f06 Binary files /dev/null and b/assets/images/bg.jpg differ diff --git a/lib/Screens/HomePage.dart b/lib/Screens/HomePage.dart index 896dd0f..127b8b1 100644 --- a/lib/Screens/HomePage.dart +++ b/lib/Screens/HomePage.dart @@ -1,11 +1,12 @@ import 'dart:io'; - +import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:smart_printer/Screens/SideMenu.dart'; import 'package:http/http.dart' as http; import 'package:path_provider/path_provider.dart'; import 'package:file_picker/file_picker.dart'; import 'package:path/path.dart' as path; +import 'package:smart_printer/Screens/ViewProfile.dart'; class HomePage extends StatefulWidget { const HomePage({Key? key}) : super(key: key); @@ -21,6 +22,7 @@ class _HomePageState extends State { String sides = 'one-side'; String orien = 'portrait'; String? _status; + num _numberOfPages = 0; Future _pickFiles() async { FilePickerResult? result = @@ -31,11 +33,35 @@ class _HomePageState extends State { List filePaths = result.paths.toList(); List numberOfCopies = List.filled(files.length, 1); + String pcIpAddress = '172.24.240.1'; + Uri url = Uri.parse('http://$pcIpAddress:3000/pages'); setState(() { _selectedFiles = files; _filePaths = filePaths; _numberOfCopies = numberOfCopies; }); + for (int i = 0; i < _selectedFiles.length; i++) { + try { + int numberOfPages = await countPages(_selectedFiles[i]); + print('Number of pages in the file: $numberOfPages'); + } catch (e) { + print('Error: $e'); + } + } + + // print('for loop starting'); + // try { + // for (int i = 0; i < _selectedFiles.length; i++) { + // var request = http.MultipartRequest('POST', url); + // request.files + // .add(await http.MultipartFile.fromPath('pdf', _filePaths[i]!)); + // var response = await request.send(); + // } + // } catch (e) { + // print("error"); + // } + + // print('for loop ending'); } } @@ -49,7 +75,7 @@ class _HomePageState extends State { try { // Get the PC's IP address and the folder path - String pcIpAddress = '172.24.240.1'; // Replace with the PC's IP address + String pcIpAddress = '172.20.0.1'; // Replace with the PC's IP address // Prepare the URL for file transfer Uri url = Uri.parse('http://$pcIpAddress:3000/upload'); @@ -76,12 +102,17 @@ class _HomePageState extends State { request.files.add(await http.MultipartFile.fromPath('pdf', tempPath)); // Send the request - var response = await request.send(); - + var streamedResponse = await request.send(); + var response = await http.Response.fromStream(streamedResponse); // Check the response status if (response.statusCode == 200) { setState(() { _status = 'File transferred successfully'; + final data = json.decode(response.body); + _numberOfPages += data['pages']; + + print("this is pages"); + print(_numberOfPages); }); } else { setState(() { @@ -98,6 +129,24 @@ class _HomePageState extends State { _emptyList(); } + Future countPages(File file) async { + if (await file.exists()) { + List list = file.readAsLinesSync(); + + int lineCount = list.length; + ; + // await file.openRead().transform(utf8.decoder).forEach((line) { + // lineCount++; + // }); + + // Assuming an average of 50 lines per page, you can estimate the number of pages. + int pages = (lineCount / 50).ceil(); + return pages; + } else { + throw FileSystemException('File not found'); + } + } + void _deleteFile(int index) async { await _selectedFiles.remove(_selectedFiles[index]); await _filePaths.remove(_filePaths[index]); @@ -144,6 +193,11 @@ class _HomePageState extends State { ), ), const SizedBox(height: 20), + Text( + 'number of pages used: $_numberOfPages', + style: TextStyle(fontSize: 20), + ), + const SizedBox(height: 20), Container( margin: const EdgeInsets.symmetric(horizontal: 40), padding: @@ -182,7 +236,7 @@ class _HomePageState extends State { style: TextStyle( wordSpacing: 1, fontFamily: 'Times New Roman', - fontSize: 18)) + fontSize: 13)) ], ), ), @@ -274,7 +328,7 @@ class _HomePageState extends State { style: TextStyle( fontSize: 16, fontWeight: FontWeight.bold), ), - const SizedBox(width: 10), + const SizedBox(width: 3), DropdownButton( value: sides, onChanged: (String? newValue) { @@ -304,7 +358,7 @@ class _HomePageState extends State { style: TextStyle( fontSize: 16, fontWeight: FontWeight.bold), ), - const SizedBox(width: 10), + const SizedBox(width: 3), DropdownButton( value: orien, onChanged: (String? newValue) { diff --git a/lib/Screens/LoginPage.dart b/lib/Screens/LoginPage.dart index a3c05ce..01eff5d 100644 --- a/lib/Screens/LoginPage.dart +++ b/lib/Screens/LoginPage.dart @@ -4,6 +4,9 @@ import 'package:flutter/material.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:smart_printer/Screens/HomePage.dart'; import 'package:smart_printer/Screens/RegistrationPage.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; +import 'package:smart_printer/Services/auth.dart'; class LoginPage extends StatefulWidget { const LoginPage({super.key}); @@ -14,196 +17,324 @@ class LoginPage extends StatefulWidget { class _LoginPageState extends State { // final _formKey = GlobalKey(); - final _emailcontroller = new TextEditingController(); - final _passwdcontroller = new TextEditingController(); - Future signIn() async { + final TextEditingController _emailcontroller = new TextEditingController(); + final TextEditingController _passwdcontroller = new TextEditingController(); + + // Future signIn() async { + // try { + // await FirebaseAuth.instance.signInWithEmailAndPassword( + // email: _emailcontroller.text.trim(), + // password: _passwdcontroller.text.trim()); + // Navigator.pop(context); + // Navigator.push(context, MaterialPageRoute(builder: (context) { + // return const HomePage(); + // })); + // } on FirebaseAuthException catch (E) { + // Fluttertoast.showToast( + // msg: 'User does not exist', + // toastLength: Toast.LENGTH_SHORT, + // gravity: ToastGravity.CENTER, + // timeInSecForIosWeb: 1, + // backgroundColor: Colors.red, + // textColor: Colors.white, + // fontSize: 16.0); + // } + // } + + //modified sign in + // //---------------------CODE1---------------------------- + // Future signIn() async { + // try { + // SharedPreferences prefs = await SharedPreferences.getInstance(); + // String? userToken = prefs.getString('userToken'); + + // if (userToken != null) { + // // If the user token exists, directly navigate to the Home page + // Navigator.pushReplacement( + // context, + // MaterialPageRoute(builder: (context) => const HomePage()), + // ); + // } else { + // // If the user token doesn't exist, perform the sign-in process + // await FirebaseAuth.instance.signInWithEmailAndPassword( + // email: _emailcontroller.text.trim(), + // password: _passwdcontroller.text.trim(), + // ); + // User? user = FirebaseAuth.instance.currentUser; + // if (user != null) { + // // Store the user's authentication token in SharedPreferences + // await prefs.setString('userToken', user.uid); + // } + // Navigator.pushReplacement( + // context, + // MaterialPageRoute(builder: (context) => const HomePage()), + // ); + // } + // } on FirebaseAuthException catch (e) { + // Fluttertoast.showToast( + // msg: 'User does not exist', + // toastLength: Toast.LENGTH_SHORT, + // gravity: ToastGravity.CENTER, + // timeInSecForIosWeb: 1, + // backgroundColor: Colors.red, + // textColor: Colors.white, + // fontSize: 16.0, + // ); + // } + // } + // //--------------------------------------------------------------- + + //------------------------CODE2-------------------------------- + final Auth _auth = Auth(); + + @override + void dispose() { + _emailcontroller.dispose(); + _passwdcontroller.dispose(); + super.dispose(); + } + //-------------------------------------------------------------- + + Future signIn() async { + // //----------------CODE1------------------------- + // try { + // final storage = FlutterSecureStorage(); + // String? userToken = await storage.read(key: 'userToken'); + + // if (userToken != null) { + // // If the user token exists, directly navigate to the Home page + // Navigator.pushReplacement( + // context, + // MaterialPageRoute(builder: (context) => const HomePage()), + // ); + // } else { + // // If the user token doesn't exist, perform the sign-in process + // await FirebaseAuth.instance.signInWithEmailAndPassword( + // email: _emailcontroller.text.trim(), + // password: _passwdcontroller.text.trim(), + // ); + // User? user = FirebaseAuth.instance.currentUser; + // if (user != null) { + // // Store the user's authentication token securely + // await storage.write(key: 'userToken', value: user.uid); + // } + // Navigator.pushReplacement( + // context, + // MaterialPageRoute(builder: (context) => const HomePage()), + // ); + // } + // //----------------------------------------------------------- + + //----------------------CODE2---------------------- try { - await FirebaseAuth.instance.signInWithEmailAndPassword( - email: _emailcontroller.text.trim(), - password: _passwdcontroller.text.trim()); - Navigator.pop(context); - Navigator.push(context, MaterialPageRoute(builder: (context) { - return const HomePage(); - })); - } on FirebaseAuthException catch (E) { - Fluttertoast.showToast( + User? user = await _auth.signInWithEmailAndPassword( + _emailcontroller.text.trim(), + _passwdcontroller.text.trim(), + ); + if (user != null) { + Navigator.pushReplacement( + context, + MaterialPageRoute(builder: (context) => const HomePage()), + ); + } else { + Fluttertoast.showToast( msg: 'User does not exist', toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.CENTER, timeInSecForIosWeb: 1, backgroundColor: Colors.red, textColor: Colors.white, - fontSize: 16.0); + fontSize: 16.0, + ); + } + } on FirebaseAuthException catch (e) { + Fluttertoast.showToast( + msg: 'User does not exist', + toastLength: Toast.LENGTH_SHORT, + gravity: ToastGravity.CENTER, + timeInSecForIosWeb: 1, + backgroundColor: Colors.red, + textColor: Colors.white, + fontSize: 16.0, + ); } } + //------------------------------------------------------- @override Widget build(BuildContext context) { - return Scaffold( - body: SafeArea( - child: SingleChildScrollView( - scrollDirection: Axis.vertical, - child: Container( - decoration: const BoxDecoration( - // gradient: LinearGradient(colors:[Color(0xFFEDAEF9),Color(0xFF81B1FA)]) - gradient: LinearGradient( - colors: [Color(0xFFA0B5EB), Color(0xFFC9F0E4)])), - height: MediaQuery.sizeOf(context).height, - width: MediaQuery.sizeOf(context).width, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( - 'Smart Printer', - style: TextStyle( - fontFamily: 'Times New Roman', - fontSize: 38, - fontWeight: FontWeight.w500, + //---------CHANGES IN RETURN-------- + return WillPopScope( + onWillPop: () async { + // Disable the back button + return false; + }, + child: Scaffold( + body: SafeArea( + child: SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Container( + decoration: const BoxDecoration( + // gradient: LinearGradient(colors:[Color(0xFFEDAEF9),Color(0xFF81B1FA)]) + gradient: LinearGradient( + colors: [Color(0xFFA0B5EB), Color(0xFFC9F0E4)])), + height: MediaQuery.sizeOf(context).height, + width: MediaQuery.sizeOf(context).width, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + 'Smart Printer', + style: TextStyle( + fontFamily: 'Times New Roman', + fontSize: 38, + fontWeight: FontWeight.w500, + ), + ), + const SizedBox( + height: 100, + ), + const Text( + 'Login To Your Account', + style: TextStyle( + fontFamily: 'Times New Roman', + fontSize: 18, + ), ), - ), - const SizedBox( - height: 100, - ), - const Text( - 'Login To Your Account', - style: TextStyle( - fontFamily: 'Times New Roman', - fontSize: 18, + const SizedBox( + height: 20, ), - ), - const SizedBox( - height: 20, - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 50), - child: TextField( - controller: _emailcontroller, - keyboardType: TextInputType.emailAddress, - decoration: InputDecoration( - border: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(20)), + Padding( + padding: EdgeInsets.symmetric(horizontal: 50), + child: TextField( + controller: _emailcontroller, + keyboardType: TextInputType.emailAddress, + decoration: InputDecoration( + border: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(20)), + ), + labelText: 'E-mail', ), - labelText: 'E-mail', ), ), - ), - const SizedBox( - height: 20, - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: 50), - child: TextField( - controller: _passwdcontroller, - obscureText: true, - decoration: InputDecoration( - border: OutlineInputBorder( - borderRadius: BorderRadius.all(Radius.circular(20)), + const SizedBox( + height: 20, + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: 50), + child: TextField( + controller: _passwdcontroller, + obscureText: true, + decoration: InputDecoration( + border: OutlineInputBorder( + borderRadius: BorderRadius.all(Radius.circular(20)), + ), + labelText: 'Password', ), - labelText: 'Password', ), ), - ), - const SizedBox( - height: 18, - ), - SizedBox( - width: 200, - child: ElevatedButton( - onPressed: () { - signIn(); + const SizedBox( + height: 18, + ), + SizedBox( + width: 200, + child: ElevatedButton( + onPressed: () { + signIn(); - // Navigator.pop(context); - // Navigator.push(context, - // MaterialPageRoute(builder: (context) { - // return const HomePage(); - // })); - }, - style: ElevatedButton.styleFrom( - backgroundColor: const Color(0xFF5200FF), + // Navigator.pop(context); + // Navigator.push(context, + // MaterialPageRoute(builder: (context) { + // return const HomePage(); + // })); + }, + style: ElevatedButton.styleFrom( + backgroundColor: const Color(0xFF5200FF), + ), + child: const Text('Login'), ), - child: const Text('Login'), ), - ), - const SizedBox( - height: 20, - ), - const Text( - 'Login With', - style: TextStyle(fontSize: 18), - ), - const SizedBox( - height: 20, - ), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - SizedBox( - height: 75, - width: 75, - child: Card( - shape: BeveledRectangleBorder( - borderRadius: BorderRadius.circular(4), - ), - child: IconButton( - icon: Image.asset('assets/images/google.png'), - onPressed: () {}, + const SizedBox( + height: 20, + ), + const Text( + 'Login With', + style: TextStyle(fontSize: 18), + ), + const SizedBox( + height: 20, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + SizedBox( + height: 75, + width: 75, + child: Card( + shape: BeveledRectangleBorder( + borderRadius: BorderRadius.circular(4), + ), + child: IconButton( + icon: Image.asset('assets/images/google.png'), + onPressed: () {}, + ), ), ), - ), - SizedBox( - height: 75, - width: 75, - child: Card( - shape: BeveledRectangleBorder( - borderRadius: BorderRadius.circular(4), - ), - child: IconButton( - icon: Image.asset('assets/images/facebook.png'), - onPressed: () {}, + SizedBox( + height: 75, + width: 75, + child: Card( + shape: BeveledRectangleBorder( + borderRadius: BorderRadius.circular(4), + ), + child: IconButton( + icon: Image.asset('assets/images/facebook.png'), + onPressed: () {}, + ), ), ), - ), - SizedBox( - height: 75, - width: 75, - child: Card( - shape: BeveledRectangleBorder( - borderRadius: BorderRadius.circular(4), - ), - child: IconButton( - icon: Image.asset('assets/images/twitter.png'), - onPressed: () {}, + SizedBox( + height: 75, + width: 75, + child: Card( + shape: BeveledRectangleBorder( + borderRadius: BorderRadius.circular(4), + ), + child: IconButton( + icon: Image.asset('assets/images/twitter.png'), + onPressed: () {}, + ), ), ), - ), - ], - ), - const SizedBox( - height: 20, - ), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( - "Don't have an account ?", - style: TextStyle(fontSize: 16), - ), - TextButton( - onPressed: () { - Navigator.pop(context); - Navigator.push(context, - MaterialPageRoute(builder: (context) { - return const RegisterPage(); - })); - }, - child: const Text( - "Create one", - style: TextStyle(fontSize: 16, color: Colors.black), + ], + ), + const SizedBox( + height: 20, + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Text( + "Don't have an account ?", + style: TextStyle(fontSize: 16), ), - ), - ], - ) - ], + TextButton( + onPressed: () { + Navigator.pop(context); + Navigator.push(context, + MaterialPageRoute(builder: (context) { + return const RegisterPage(); + })); + }, + child: const Text( + "Create one", + style: TextStyle(fontSize: 16, color: Colors.black), + ), + ), + ], + ) + ], + ), ), ), ), diff --git a/lib/Services/auth.dart b/lib/Services/auth.dart index 6fee5bf..a25e222 100644 --- a/lib/Services/auth.dart +++ b/lib/Services/auth.dart @@ -1,39 +1,109 @@ import 'package:firebase_auth/firebase_auth.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; -class Auth{ +class Auth { final FirebaseAuth _auth = FirebaseAuth.instance; - // sign in with email and password - Future signInWithEmailAndPassword(String email, String password) async{ - try{ - UserCredential result = await _auth.signInWithEmailAndPassword(email: email, password: password); + // // sign in with email and password + // Future signInWithEmailAndPassword(String email, String password) async { + // try { + // UserCredential result = await _auth.signInWithEmailAndPassword( + // email: email, password: password); + // User? user = result.user; + // return user; + // } catch (e) { + // print(e.toString()); + // return null; + // } + // } + + //modified sign in code + // //-----------------------------CODE1------------------------ + // Future signInWithEmailAndPassword(String email, String password) async { + // try { + // UserCredential result = await _auth.signInWithEmailAndPassword( + // email: email, password: password); + // User? user = result.user; + + // // Store the user's authentication token in SharedPreferences + // SharedPreferences prefs = await SharedPreferences.getInstance(); + // prefs.setString('userToken', result.user!.uid); + + // return user; + // } catch (e) { + // print(e.toString()); + // return null; + // } + // } + // //------------------------------------------------------------ + + //-------------------------CODE2------------------------------- + Future signInWithEmailAndPassword(String email, String password) async { + try { + UserCredential result = await _auth.signInWithEmailAndPassword( + email: email, password: password); User? user = result.user; + + // Store the user's authentication token securely + final storage = FlutterSecureStorage(); + await storage.write(key: 'userToken', value: result.user!.uid); + return user; - }catch(e){ + } catch (e) { print(e.toString()); return null; } } + //------------------------------------------------------------------ // register with email and password - Future registerWithEmailAndPassword(String email, String password) async{ - try{ - UserCredential result = await _auth.createUserWithEmailAndPassword(email: email, password: password); + Future registerWithEmailAndPassword(String email, String password) async { + try { + UserCredential result = await _auth.createUserWithEmailAndPassword( + email: email, password: password); User? user = result.user; return user; - }catch(e){ + } catch (e) { print(e.toString()); return null; } } - // sign out - Future signOut() async{ - try{ + // // sign out + // Future signOut() async { + // try { + // return await _auth.signOut(); + // } catch (e) { + // print(e.toString()); + // return null; + // } + // } + + //modfied sign out + // //----------------CODE1------------------------- + // Future signOut() async { + // try { + // SharedPreferences prefs = await SharedPreferences.getInstance(); + // await prefs.remove('userToken'); + // return await _auth.signOut(); + // } catch (e) { + // print(e.toString()); + // return null; + // } + // } + // //-------------------------------------------------- + + //--------------------------------CODE2----------------------------- + Future signOut() async { + try { + final storage = FlutterSecureStorage(); + await storage.delete(key: 'userToken'); return await _auth.signOut(); - }catch(e){ + } catch (e) { print(e.toString()); return null; } } -} \ No newline at end of file + //----------------------------------------------------------------- +} diff --git a/linux/flutter/generated_plugin_registrant.cc b/linux/flutter/generated_plugin_registrant.cc index e71a16d..d0e7f79 100644 --- a/linux/flutter/generated_plugin_registrant.cc +++ b/linux/flutter/generated_plugin_registrant.cc @@ -6,6 +6,10 @@ #include "generated_plugin_registrant.h" +#include void fl_register_plugins(FlPluginRegistry* registry) { + g_autoptr(FlPluginRegistrar) flutter_secure_storage_linux_registrar = + fl_plugin_registry_get_registrar_for_plugin(registry, "FlutterSecureStorageLinuxPlugin"); + flutter_secure_storage_linux_plugin_register_with_registrar(flutter_secure_storage_linux_registrar); } diff --git a/linux/flutter/generated_plugins.cmake b/linux/flutter/generated_plugins.cmake index 2e1de87..b29e9ba 100644 --- a/linux/flutter/generated_plugins.cmake +++ b/linux/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + flutter_secure_storage_linux ) list(APPEND FLUTTER_FFI_PLUGIN_LIST diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 2597bfc..e4ed9de 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -8,11 +8,15 @@ import Foundation import cloud_firestore import firebase_auth import firebase_core +import flutter_secure_storage_macos import path_provider_foundation +import shared_preferences_foundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin")) FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) + FlutterSecureStorageMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStorageMacosPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) + SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) } diff --git a/pubspec.lock b/pubspec.lock index df818a7..7857fa1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -182,6 +182,54 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.15" + flutter_secure_storage: + dependency: "direct main" + description: + name: flutter_secure_storage + sha256: "5abe3d5c25ab435e48c47fb61bac25606062a305fac637c2f020e25abd30014a" + url: "https://pub.dev" + source: hosted + version: "5.1.2" + flutter_secure_storage_linux: + dependency: transitive + description: + name: flutter_secure_storage_linux + sha256: "0912ae29a572230ad52d8a4697e5518d7f0f429052fd51df7e5a7952c7efe2a3" + url: "https://pub.dev" + source: hosted + version: "1.1.3" + flutter_secure_storage_macos: + dependency: transitive + description: + name: flutter_secure_storage_macos + sha256: "388f76fd0f093e7415a39ec4c169ae7cceeee6d9f9ba529d788a13f2be4de7bd" + url: "https://pub.dev" + source: hosted + version: "1.1.2" + flutter_secure_storage_platform_interface: + dependency: transitive + description: + name: flutter_secure_storage_platform_interface + sha256: b3773190e385a3c8a382007893d678ae95462b3c2279e987b55d140d3b0cb81b + url: "https://pub.dev" + source: hosted + version: "1.0.1" + flutter_secure_storage_web: + dependency: transitive + description: + name: flutter_secure_storage_web + sha256: "42938e70d4b872e856e678c423cc0e9065d7d294f45bc41fc1981a4eb4beaffe" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + flutter_secure_storage_windows: + dependency: transitive + description: + name: flutter_secure_storage_windows + sha256: ca89c8059cf439985aa83c59619b3674c7ef6cc2e86943d169a7369d6a69cab5 + url: "https://pub.dev" + source: hosted + version: "1.1.3" flutter_test: dependency: "direct dev" description: flutter @@ -344,6 +392,62 @@ packages: url: "https://pub.dev" source: hosted version: "4.2.4" + shared_preferences: + dependency: "direct main" + description: + name: shared_preferences + sha256: "396f85b8afc6865182610c0a2fc470853d56499f75f7499e2a73a9f0539d23d0" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + sha256: "6478c6bbbecfe9aced34c483171e90d7c078f5883558b30ec3163cf18402c749" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + shared_preferences_foundation: + dependency: transitive + description: + name: shared_preferences_foundation + sha256: e014107bb79d6d3297196f4f2d0db54b5d1f85b8ea8ff63b8e8b391a02700feb + url: "https://pub.dev" + source: hosted + version: "2.2.2" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + sha256: "9d387433ca65717bbf1be88f4d5bb18f10508917a8fa2fb02e0fd0d7479a9afa" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + sha256: fb5cf25c0235df2d0640ac1b1174f6466bd311f621574997ac59018a6664548d + url: "https://pub.dev" + source: hosted + version: "2.2.0" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + sha256: "74083203a8eae241e0de4a0d597dbedab3b8fef5563f33cf3c12d7e93c655ca5" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + sha256: "5e588e2efef56916a3b229c3bfe81e6a525665a454519ca51dbcc4236a274173" + url: "https://pub.dev" + source: hosted + version: "2.2.0" sky_engine: dependency: transitive description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index ad34656..523e79c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -34,6 +34,9 @@ dependencies: http: ^1.0.0 file_picker: ^5.3.2 path_provider: ^2.0.15 + shared_preferences: ^2.0.0 + flutter_secure_storage: ^5.0.0 + # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 1a82e7d..39cedd3 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -7,8 +7,11 @@ #include "generated_plugin_registrant.h" #include +#include void RegisterPlugins(flutter::PluginRegistry* registry) { FirebaseCorePluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); + FlutterSecureStorageWindowsPluginRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index fa8a39b..1f5d05f 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST firebase_core + flutter_secure_storage_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST