Commit c08d00b7 authored by Adam Bruck's avatar Adam Bruck

Post Page

parent 6e8344eb
...@@ -11,6 +11,7 @@ import 'package:cloud_firestore_web/cloud_firestore_web.dart'; ...@@ -11,6 +11,7 @@ import 'package:cloud_firestore_web/cloud_firestore_web.dart';
import 'package:firebase_app_check_web/firebase_app_check_web.dart'; import 'package:firebase_app_check_web/firebase_app_check_web.dart';
import 'package:firebase_auth_web/firebase_auth_web.dart'; import 'package:firebase_auth_web/firebase_auth_web.dart';
import 'package:firebase_core_web/firebase_core_web.dart'; import 'package:firebase_core_web/firebase_core_web.dart';
import 'package:firebase_storage_web/firebase_storage_web.dart';
import 'package:image_picker_for_web/image_picker_for_web.dart'; import 'package:image_picker_for_web/image_picker_for_web.dart';
import 'package:permission_handler_html/permission_handler_html.dart'; import 'package:permission_handler_html/permission_handler_html.dart';
import 'package:url_launcher_web/url_launcher_web.dart'; import 'package:url_launcher_web/url_launcher_web.dart';
...@@ -23,6 +24,7 @@ void registerPlugins([final Registrar? pluginRegistrar]) { ...@@ -23,6 +24,7 @@ void registerPlugins([final Registrar? pluginRegistrar]) {
FirebaseAppCheckWeb.registerWith(registrar); FirebaseAppCheckWeb.registerWith(registrar);
FirebaseAuthWeb.registerWith(registrar); FirebaseAuthWeb.registerWith(registrar);
FirebaseCoreWeb.registerWith(registrar); FirebaseCoreWeb.registerWith(registrar);
FirebaseStorageWeb.registerWith(registrar);
ImagePickerPlugin.registerWith(registrar); ImagePickerPlugin.registerWith(registrar);
WebPermissionHandler.registerWith(registrar); WebPermissionHandler.registerWith(registrar);
UrlLauncherPlugin.registerWith(registrar); UrlLauncherPlugin.registerWith(registrar);
......
...@@ -205,6 +205,24 @@ ...@@ -205,6 +205,24 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "3.2" "languageVersion": "3.2"
}, },
{
"name": "firebase_storage",
"rootUri": "file:///Users/arbruck/.pub-cache/hosted/pub.dev/firebase_storage-12.4.4",
"packageUri": "lib/",
"languageVersion": "3.2"
},
{
"name": "firebase_storage_platform_interface",
"rootUri": "file:///Users/arbruck/.pub-cache/hosted/pub.dev/firebase_storage_platform_interface-5.2.4",
"packageUri": "lib/",
"languageVersion": "3.2"
},
{
"name": "firebase_storage_web",
"rootUri": "file:///Users/arbruck/.pub-cache/hosted/pub.dev/firebase_storage_web-3.10.11",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{ {
"name": "fixnum", "name": "fixnum",
"rootUri": "file:///Users/arbruck/.pub-cache/hosted/pub.dev/fixnum-1.1.1", "rootUri": "file:///Users/arbruck/.pub-cache/hosted/pub.dev/fixnum-1.1.1",
...@@ -560,7 +578,7 @@ ...@@ -560,7 +578,7 @@
"languageVersion": "3.7" "languageVersion": "3.7"
} }
], ],
"generated": "2025-03-21T21:20:13.018829Z", "generated": "2025-03-26T00:42:17.344083Z",
"generator": "pub", "generator": "pub",
"generatorVersion": "3.7.2", "generatorVersion": "3.7.2",
"flutterRoot": "file:///Users/arbruck/Downloads/flutter", "flutterRoot": "file:///Users/arbruck/Downloads/flutter",
......
...@@ -134,6 +134,18 @@ firebase_data_connect ...@@ -134,6 +134,18 @@ firebase_data_connect
3.2 3.2
file:///Users/arbruck/.pub-cache/hosted/pub.dev/firebase_data_connect-0.1.3+2/ file:///Users/arbruck/.pub-cache/hosted/pub.dev/firebase_data_connect-0.1.3+2/
file:///Users/arbruck/.pub-cache/hosted/pub.dev/firebase_data_connect-0.1.3+2/lib/ file:///Users/arbruck/.pub-cache/hosted/pub.dev/firebase_data_connect-0.1.3+2/lib/
firebase_storage
3.2
file:///Users/arbruck/.pub-cache/hosted/pub.dev/firebase_storage-12.4.4/
file:///Users/arbruck/.pub-cache/hosted/pub.dev/firebase_storage-12.4.4/lib/
firebase_storage_platform_interface
3.2
file:///Users/arbruck/.pub-cache/hosted/pub.dev/firebase_storage_platform_interface-5.2.4/
file:///Users/arbruck/.pub-cache/hosted/pub.dev/firebase_storage_platform_interface-5.2.4/lib/
firebase_storage_web
3.4
file:///Users/arbruck/.pub-cache/hosted/pub.dev/firebase_storage_web-3.10.11/
file:///Users/arbruck/.pub-cache/hosted/pub.dev/firebase_storage_web-3.10.11/lib/
fixnum fixnum
3.1 3.1
file:///Users/arbruck/.pub-cache/hosted/pub.dev/fixnum-1.1.1/ file:///Users/arbruck/.pub-cache/hosted/pub.dev/fixnum-1.1.1/
......
...@@ -14,6 +14,8 @@ firebase_auth=/Users/arbruck/.pub-cache/hosted/pub.dev/firebase_auth-5.5.1/ ...@@ -14,6 +14,8 @@ firebase_auth=/Users/arbruck/.pub-cache/hosted/pub.dev/firebase_auth-5.5.1/
firebase_auth_web=/Users/arbruck/.pub-cache/hosted/pub.dev/firebase_auth_web-5.14.1/ firebase_auth_web=/Users/arbruck/.pub-cache/hosted/pub.dev/firebase_auth_web-5.14.1/
firebase_core=/Users/arbruck/.pub-cache/hosted/pub.dev/firebase_core-3.12.1/ firebase_core=/Users/arbruck/.pub-cache/hosted/pub.dev/firebase_core-3.12.1/
firebase_core_web=/Users/arbruck/.pub-cache/hosted/pub.dev/firebase_core_web-2.21.1/ firebase_core_web=/Users/arbruck/.pub-cache/hosted/pub.dev/firebase_core_web-2.21.1/
firebase_storage=/Users/arbruck/.pub-cache/hosted/pub.dev/firebase_storage-12.4.4/
firebase_storage_web=/Users/arbruck/.pub-cache/hosted/pub.dev/firebase_storage_web-3.10.11/
flutter_plugin_android_lifecycle=/Users/arbruck/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.26/ flutter_plugin_android_lifecycle=/Users/arbruck/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.26/
image_picker=/Users/arbruck/.pub-cache/hosted/pub.dev/image_picker-1.1.2/ image_picker=/Users/arbruck/.pub-cache/hosted/pub.dev/image_picker-1.1.2/
image_picker_android=/Users/arbruck/.pub-cache/hosted/pub.dev/image_picker_android-0.8.12+21/ image_picker_android=/Users/arbruck/.pub-cache/hosted/pub.dev/image_picker_android-0.8.12+21/
......
This diff is collapsed.
...@@ -1169,6 +1169,9 @@ PODS: ...@@ -1169,6 +1169,9 @@ PODS:
- Firebase/Firestore (11.8.0): - Firebase/Firestore (11.8.0):
- Firebase/CoreOnly - Firebase/CoreOnly
- FirebaseFirestore (~> 11.8.0) - FirebaseFirestore (~> 11.8.0)
- Firebase/Storage (11.8.0):
- Firebase/CoreOnly
- FirebaseStorage (~> 11.8.0)
- firebase_app_check (0.3.2-4): - firebase_app_check (0.3.2-4):
- Firebase/CoreOnly (~> 11.8.0) - Firebase/CoreOnly (~> 11.8.0)
- firebase_core - firebase_core
...@@ -1181,6 +1184,10 @@ PODS: ...@@ -1181,6 +1184,10 @@ PODS:
- firebase_core (3.12.1): - firebase_core (3.12.1):
- Firebase/CoreOnly (= 11.8.0) - Firebase/CoreOnly (= 11.8.0)
- Flutter - Flutter
- firebase_storage (12.4.4):
- Firebase/Storage (= 11.8.0)
- firebase_core
- Flutter
- FirebaseAppCheck (11.8.0): - FirebaseAppCheck (11.8.0):
- AppCheckCore (~> 11.0) - AppCheckCore (~> 11.0)
- FirebaseAppCheckInterop (~> 11.0) - FirebaseAppCheckInterop (~> 11.0)
...@@ -1227,6 +1234,13 @@ PODS: ...@@ -1227,6 +1234,13 @@ PODS:
- leveldb-library (~> 1.22) - leveldb-library (~> 1.22)
- nanopb (~> 3.30910.0) - nanopb (~> 3.30910.0)
- FirebaseSharedSwift (11.10.0) - FirebaseSharedSwift (11.10.0)
- FirebaseStorage (11.8.0):
- FirebaseAppCheckInterop (~> 11.0)
- FirebaseAuthInterop (~> 11.0)
- FirebaseCore (~> 11.8.0)
- FirebaseCoreExtension (~> 11.8.0)
- GoogleUtilities/Environment (~> 8.0)
- GTMSessionFetcher/Core (< 5.0, >= 3.4)
- Flutter (1.0.0) - Flutter (1.0.0)
- GoogleUtilities/AppDelegateSwizzler (8.0.2): - GoogleUtilities/AppDelegateSwizzler (8.0.2):
- GoogleUtilities/Environment - GoogleUtilities/Environment
...@@ -1364,6 +1378,7 @@ DEPENDENCIES: ...@@ -1364,6 +1378,7 @@ DEPENDENCIES:
- firebase_app_check (from `.symlinks/plugins/firebase_app_check/ios`) - firebase_app_check (from `.symlinks/plugins/firebase_app_check/ios`)
- firebase_auth (from `.symlinks/plugins/firebase_auth/ios`) - firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`) - firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_storage (from `.symlinks/plugins/firebase_storage/ios`)
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
...@@ -1385,6 +1400,7 @@ SPEC REPOS: ...@@ -1385,6 +1400,7 @@ SPEC REPOS:
- FirebaseFirestore - FirebaseFirestore
- FirebaseFirestoreInternal - FirebaseFirestoreInternal
- FirebaseSharedSwift - FirebaseSharedSwift
- FirebaseStorage
- GoogleUtilities - GoogleUtilities
- "gRPC-C++" - "gRPC-C++"
- gRPC-Core - gRPC-Core
...@@ -1405,6 +1421,8 @@ EXTERNAL SOURCES: ...@@ -1405,6 +1421,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/firebase_auth/ios" :path: ".symlinks/plugins/firebase_auth/ios"
firebase_core: firebase_core:
:path: ".symlinks/plugins/firebase_core/ios" :path: ".symlinks/plugins/firebase_core/ios"
firebase_storage:
:path: ".symlinks/plugins/firebase_storage/ios"
Flutter: Flutter:
:path: Flutter :path: Flutter
image_picker_ios: image_picker_ios:
...@@ -1424,6 +1442,7 @@ SPEC CHECKSUMS: ...@@ -1424,6 +1442,7 @@ SPEC CHECKSUMS:
firebase_app_check: 41ab298dc5440c44fba8b12a8f949062c049f3fa firebase_app_check: 41ab298dc5440c44fba8b12a8f949062c049f3fa
firebase_auth: 3d848b9b866b201e5c8e0c06d8b2cec272fd8825 firebase_auth: 3d848b9b866b201e5c8e0c06d8b2cec272fd8825
firebase_core: ac395f994af4e28f6a38b59e05a88ca57abeb874 firebase_core: ac395f994af4e28f6a38b59e05a88ca57abeb874
firebase_storage: b31bacb1f1d7abeb753d9195e97eb5d2180e1d6f
FirebaseAppCheck: f6648d6d2b321ecf94cf72f6737fc68d4fddc010 FirebaseAppCheck: f6648d6d2b321ecf94cf72f6737fc68d4fddc010
FirebaseAppCheckInterop: 9664c858489710f682766ef54e2b6741d3b62070 FirebaseAppCheckInterop: 9664c858489710f682766ef54e2b6741d3b62070
FirebaseAuth: ad59a1a7b161e75f74c39f70179d2482d40e2737 FirebaseAuth: ad59a1a7b161e75f74c39f70179d2482d40e2737
...@@ -1434,6 +1453,7 @@ SPEC CHECKSUMS: ...@@ -1434,6 +1453,7 @@ SPEC CHECKSUMS:
FirebaseFirestore: 563a4ab1a65e2858f05e150bb4c31b0f8f79248b FirebaseFirestore: 563a4ab1a65e2858f05e150bb4c31b0f8f79248b
FirebaseFirestoreInternal: 8c5921c360a70e447bfeefb245f450e8b50e750b FirebaseFirestoreInternal: 8c5921c360a70e447bfeefb245f450e8b50e750b
FirebaseSharedSwift: 1baacae75939499b5def867cbe34129464536a38 FirebaseSharedSwift: 1baacae75939499b5def867cbe34129464536a38
FirebaseStorage: 8eede00081a6ce904eaa8d2daa66f1e053e8e6ea
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
GoogleUtilities: 26a3abef001b6533cf678d3eb38fd3f614b7872d GoogleUtilities: 26a3abef001b6533cf678d3eb38fd3f614b7872d
"gRPC-C++": 2fa52b3141e7789a28a737f251e0c45b4cb20a87 "gRPC-C++": 2fa52b3141e7789a28a737f251e0c45b4cb20a87
......
...@@ -14,7 +14,7 @@ class _HomeScreenState extends State<HomeScreen> { ...@@ -14,7 +14,7 @@ class _HomeScreenState extends State<HomeScreen> {
final List<Widget> _screens = [ final List<Widget> _screens = [
const HomePage(), const HomePage(),
const PostPage(), PostBookPage(),
const InboxPage(), const InboxPage(),
]; ];
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_core/firebase_core.dart'; import 'package:firebase_core/firebase_core.dart';
import 'package:paperchase_app/mybooks.dart';
import 'firebase_options.dart'; import 'firebase_options.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'dart:convert'; import 'dart:convert';
...@@ -72,8 +73,9 @@ class _MyAppState extends State<MyApp> { ...@@ -72,8 +73,9 @@ class _MyAppState extends State<MyApp> {
'/login': (context) => const LoginPage(), '/login': (context) => const LoginPage(),
'/signup': (context) => const SignupPage(), '/signup': (context) => const SignupPage(),
'/profile': (context) => const ProfilePage(), '/profile': (context) => const ProfilePage(),
'/post': (context) => PostPage(), '/post': (context) => PostBookPage(),
'/inbox': (context) => const InboxPage(), '/inbox': (context) => const InboxPage(),
'/mybooks': (context) => MyBooksPage(),
}, },
); );
} }
...@@ -148,11 +150,14 @@ class _HomePageState extends State<HomePage> { ...@@ -148,11 +150,14 @@ class _HomePageState extends State<HomePage> {
_logout(); _logout();
} else if (value == 'profile') { } else if (value == 'profile') {
Navigator.pushNamed(context, '/profile'); Navigator.pushNamed(context, '/profile');
} else if (value == 'My Books'){
Navigator.push(context, MaterialPageRoute(builder: (context) => MyBooksPage()));
} }
}, },
itemBuilder: (BuildContext context) => [ itemBuilder: (BuildContext context) => [
const PopupMenuItem(value: 'profile', child: Text('Profile')), const PopupMenuItem(value: 'profile', child: Text('Profile')),
const PopupMenuItem(value: 'logout', child: Text('Logout')), const PopupMenuItem(value: 'logout', child: Text('Logout')),
const PopupMenuItem(value: 'My Books' , child: Text('My Books'))
], ],
) )
: null, : null,
......
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
class MyBooksPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('My Books')),
body: StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance.collection('books').snapshots(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(child: CircularProgressIndicator());
}
if (!snapshot.hasData || snapshot.data!.docs.isEmpty) {
return Center(child: Text('No books found.'));
}
var books = snapshot.data!.docs;
return ListView.builder(
itemCount: books.length,
itemBuilder: (context, index) {
var book = books[index].data() as Map<String, dynamic>;
return ListTile(
title: Text(book['title'] ?? 'No Title'),
subtitle: Text(book['author'] ?? 'Unknown Author'),
trailing: Text("\$${book['price']}"),
);
},
);
},
),
);
}
}
import 'dart:io'; import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart'; import 'package:image_picker/image_picker.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_storage/firebase_storage.dart';
class PostPage extends StatefulWidget { class PostBookPage extends StatefulWidget {
const PostPage({Key? key}) : super(key: key);
@override @override
_PostPageState createState() => _PostPageState(); _PostBookPageState createState() => _PostBookPageState();
} }
class _PostPageState extends State<PostPage> { class _PostBookPageState extends State<PostBookPage> {
late XFile? _imageFile; final TextEditingController titleController = TextEditingController();
final TextEditingController descriptionController = TextEditingController();
final ImagePicker _picker = ImagePicker(); final TextEditingController priceController = TextEditingController();
final TextEditingController isbnController = TextEditingController();
final TextEditingController _titleController = TextEditingController(); final TextEditingController authorController = TextEditingController();
final TextEditingController _descriptionController = TextEditingController(); File? _imageFile;
final TextEditingController _priceController = TextEditingController();
// Function to pick an image from camera or gallery
Future<void> _pickImage(ImageSource source) async {
// Default selected condition final pickedFile = await ImagePicker().pickImage(source: source);
String _selectedCondition = 'Like New'; if (pickedFile != null) {
@override
void initState() {
super.initState();
_imageFile = null;
}
// Pick an image from gallery
Future<void> _pickImageFromGallery() async {
final XFile? image = await _picker.pickImage(source: ImageSource.gallery);
setState(() { setState(() {
_imageFile = image; _imageFile = File(pickedFile.path);
}); });
print('Image picked: ${_imageFile!.path}');
} else {
print('No image selected.');
} }
}
// Capture an image from camera
Future<void> _pickImageFromCamera() async { // Function to upload book data to Firebase
final XFile? image = await _picker.pickImage(source: ImageSource.camera); Future<bool> uploadBook() async {
setState(() { try {
_imageFile = image; // Store book details in Firestore
await FirebaseFirestore.instance.collection('books').add({
'title': titleController.text,
'description': descriptionController.text,
'price': priceController.text,
'isbn': isbnController.text,
'author': authorController.text,
'imageUrl': '', // Remove Firebase Storage dependency
'createdAt': Timestamp.now(),
}); });
return true;
} catch (e) {
print('Error uploading book: $e');
return false;
} }
}
void _postTextbook() {
if (_imageFile != null && _titleController.text.isNotEmpty && _descriptionController.text.isNotEmpty && _priceController.text.isNotEmpty) {
// Handle the post functionality here. For example, uploading the image and other details.
print('Title: ${_titleController.text}');
print('Description: ${_descriptionController.text}');
print('Condition: $_selectedCondition');
print('Price: ${_priceController.text}');
print('Image Path: ${_imageFile!.path}');
// Show confirmation after posting // Function to handle book posting
Future<void> _postBook() async {
if (titleController.text.isEmpty || descriptionController.text.isEmpty ||
priceController.text.isEmpty || isbnController.text.isEmpty ||
authorController.text.isEmpty) {
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Textbook Posted!')), SnackBar(content: Text('All fields are required.'))
); );
return;
}
bool success = await uploadBook();
if (success) {
Navigator.pushReplacementNamed(context, '/mybooks');
} else { } else {
// If any required field is missing
ScaffoldMessenger.of(context).showSnackBar( ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(content: Text('Please fill all fields and select an image!')), SnackBar(content: Text('Failed to post book. Try again.'))
); );
} }
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(title: Text('Post a Book')),
title: const Text('Post Page'), body: Padding(
), padding: EdgeInsets.all(16.0),
body: SingleChildScrollView( // Wrap everything in a scrollable view child: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
_imageFile != null // Title Input
? Image.file(
File(_imageFile!.path),
height: 250,
width: 250,
fit: BoxFit.cover,
)
: const Text('No image selected.'),
const SizedBox(height: 20),
TextField( TextField(
controller: _titleController, controller: titleController,
decoration: const InputDecoration( decoration: InputDecoration(labelText: 'Title'),
labelText: 'Title',
hintText: 'Enter the title of the textbook',
),
), ),
const SizedBox(height: 20), SizedBox(height: 10),
// If an image has been picked, display it
// Description Input
TextField(
controller: descriptionController,
decoration: InputDecoration(labelText: 'Description'),
maxLines: 3,
),
SizedBox(height: 10),
// Price Input
TextField( TextField(
controller: _priceController, controller: priceController,
decoration: InputDecoration(labelText: 'Price'),
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
decoration: const InputDecoration(
labelText: 'Price',
hintText: 'Enter the price of the textbook',
), ),
SizedBox(height: 10),
// ISBN Input
TextField(
controller: isbnController,
decoration: InputDecoration(labelText: 'ISBN Number'),
keyboardType: TextInputType.number,
), ),
const SizedBox(height: 20), SizedBox(height: 10),
// Author Input
TextField( TextField(
controller: _descriptionController, controller: authorController,
decoration: const InputDecoration( decoration: InputDecoration(labelText: 'Author'),
labelText: 'Description',
hintText: 'Enter a brief description',
), ),
SizedBox(height: 20),
// Image Picker Buttons
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton.icon(
onPressed: () => _pickImage(ImageSource.camera),
icon: Icon(Icons.camera),
label: Text('Camera'),
), ),
const SizedBox(height: 20), SizedBox(width: 20),
const Text( ElevatedButton.icon(
'Condition', onPressed: () => _pickImage(ImageSource.gallery),
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold), icon: Icon(Icons.photo_library),
label: Text('Gallery'),
), ),
DropdownButton<String>( ],
value: _selectedCondition,
onChanged: (String? newValue) {
setState(() {
_selectedCondition = newValue!;
});
},
items: <String>['Poor', 'Fair', 'Good', "Like New"]
.map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
), ),
const SizedBox(height:20), SizedBox(height: 10),
ElevatedButton(
onPressed: _pickImageFromGallery, // Display Selected Image
child: const Text('Pick Image from Gallery'), if (_imageFile != null)
Container(
height: 150,
width: double.infinity,
child: Image.file(_imageFile!, fit: BoxFit.cover),
), ),
const SizedBox(height: 20), SizedBox(height: 20),
ElevatedButton(
onPressed: _pickImageFromCamera, // Post Book Button
child: const Text('Take a Photo with Camera'), Center(
child: ElevatedButton(
onPressed: _postBook,
child: Text('Post Book'),
), ),
const SizedBox(height: 20),
ElevatedButton(
onPressed: _postTextbook,
child: const Text('Post Image'),
), ),
], ],
), ),
), ),
) ),
); );
} }
} }
...@@ -10,6 +10,7 @@ import file_selector_macos ...@@ -10,6 +10,7 @@ import file_selector_macos
import firebase_app_check import firebase_app_check
import firebase_auth import firebase_auth
import firebase_core import firebase_core
import firebase_storage
import url_launcher_macos import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
...@@ -18,5 +19,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { ...@@ -18,5 +19,6 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseAppCheckPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAppCheckPlugin")) FLTFirebaseAppCheckPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAppCheckPlugin"))
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FLTFirebaseStoragePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseStoragePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
} }
...@@ -273,6 +273,30 @@ packages: ...@@ -273,6 +273,30 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.1.3+2" version: "0.1.3+2"
firebase_storage:
dependency: "direct main"
description:
name: firebase_storage
sha256: "2274bb277d0d56d4a106fd89bad5e8f7c005bae77dc3df5abd36101957010840"
url: "https://pub.dev"
source: hosted
version: "12.4.4"
firebase_storage_platform_interface:
dependency: transitive
description:
name: firebase_storage_platform_interface
sha256: "36ed6ebc2453a500c6d1e63c8126459056a70a798d53636242b0325951814cf5"
url: "https://pub.dev"
source: hosted
version: "5.2.4"
firebase_storage_web:
dependency: transitive
description:
name: firebase_storage_web
sha256: e169fc825cbd91c70d73f75b7e8be9ada272b4297184f779ca124b42945828fe
url: "https://pub.dev"
source: hosted
version: "3.10.11"
fixnum: fixnum:
dependency: transitive dependency: transitive
description: description:
......
...@@ -44,6 +44,7 @@ dependencies: ...@@ -44,6 +44,7 @@ dependencies:
permission_handler: ^11.4.0 permission_handler: ^11.4.0
firebase_app_check: ^0.3.2+4 firebase_app_check: ^0.3.2+4
camera: ^0.10.0+2 camera: ^0.10.0+2
firebase_storage: ^12.4.4
dev_dependencies: dev_dependencies:
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <file_selector_windows/file_selector_windows.h> #include <file_selector_windows/file_selector_windows.h>
#include <firebase_auth/firebase_auth_plugin_c_api.h> #include <firebase_auth/firebase_auth_plugin_c_api.h>
#include <firebase_core/firebase_core_plugin_c_api.h> #include <firebase_core/firebase_core_plugin_c_api.h>
#include <firebase_storage/firebase_storage_plugin_c_api.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h> #include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h> #include <url_launcher_windows/url_launcher_windows.h>
...@@ -22,6 +23,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) { ...@@ -22,6 +23,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("FirebaseAuthPluginCApi")); registry->GetRegistrarForPlugin("FirebaseAuthPluginCApi"));
FirebaseCorePluginCApiRegisterWithRegistrar( FirebaseCorePluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); registry->GetRegistrarForPlugin("FirebaseCorePluginCApi"));
FirebaseStoragePluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FirebaseStoragePluginCApi"));
PermissionHandlerWindowsPluginRegisterWithRegistrar( PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin")); registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
UrlLauncherWindowsRegisterWithRegistrar( UrlLauncherWindowsRegisterWithRegistrar(
......
...@@ -7,6 +7,7 @@ list(APPEND FLUTTER_PLUGIN_LIST ...@@ -7,6 +7,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
file_selector_windows file_selector_windows
firebase_auth firebase_auth
firebase_core firebase_core
firebase_storage
permission_handler_windows permission_handler_windows
url_launcher_windows url_launcher_windows
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment