Add the ability to take a photo and save that image into Firebase Store
This commit is contained in:
@@ -0,0 +1,18 @@
|
|||||||
|
#
|
||||||
|
# NOTE: This podspec is NOT to be published. It is only used as a local source!
|
||||||
|
#
|
||||||
|
|
||||||
|
Pod::Spec.new do |s|
|
||||||
|
s.name = 'Flutter'
|
||||||
|
s.version = '1.0.0'
|
||||||
|
s.summary = 'High-performance, high-fidelity mobile apps.'
|
||||||
|
s.description = <<-DESC
|
||||||
|
Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS.
|
||||||
|
DESC
|
||||||
|
s.homepage = 'https://flutter.io'
|
||||||
|
s.license = { :type => 'MIT' }
|
||||||
|
s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
|
||||||
|
s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
|
||||||
|
s.ios.deployment_target = '8.0'
|
||||||
|
s.vendored_frameworks = 'Flutter.framework'
|
||||||
|
end
|
||||||
@@ -20,6 +20,9 @@ PODS:
|
|||||||
- Firebase/Firestore (6.0.0):
|
- Firebase/Firestore (6.0.0):
|
||||||
- Firebase/CoreOnly
|
- Firebase/CoreOnly
|
||||||
- FirebaseFirestore (~> 1.3.0)
|
- FirebaseFirestore (~> 1.3.0)
|
||||||
|
- Firebase/Storage (6.0.0):
|
||||||
|
- Firebase/CoreOnly
|
||||||
|
- FirebaseStorage (~> 3.2.0)
|
||||||
- firebase_auth (0.0.1):
|
- firebase_auth (0.0.1):
|
||||||
- Firebase/Auth (~> 6.0)
|
- Firebase/Auth (~> 6.0)
|
||||||
- Firebase/Core
|
- Firebase/Core
|
||||||
@@ -27,6 +30,9 @@ PODS:
|
|||||||
- firebase_core (0.0.1):
|
- firebase_core (0.0.1):
|
||||||
- Firebase/Core
|
- Firebase/Core
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- firebase_storage (0.0.1):
|
||||||
|
- Firebase/Storage
|
||||||
|
- Flutter
|
||||||
- FirebaseAnalytics (6.0.0):
|
- FirebaseAnalytics (6.0.0):
|
||||||
- FirebaseCore (~> 6.0)
|
- FirebaseCore (~> 6.0)
|
||||||
- FirebaseInstanceID (~> 4.0)
|
- FirebaseInstanceID (~> 4.0)
|
||||||
@@ -65,6 +71,10 @@ PODS:
|
|||||||
- FirebaseCore (~> 6.0)
|
- FirebaseCore (~> 6.0)
|
||||||
- GoogleUtilities/Environment (~> 6.0)
|
- GoogleUtilities/Environment (~> 6.0)
|
||||||
- GoogleUtilities/UserDefaults (~> 6.0)
|
- GoogleUtilities/UserDefaults (~> 6.0)
|
||||||
|
- FirebaseStorage (3.2.1):
|
||||||
|
- FirebaseAuthInterop (~> 1.0)
|
||||||
|
- FirebaseCore (~> 6.0)
|
||||||
|
- GTMSessionFetcher/Core (~> 1.1)
|
||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
- flutter_local_notifications (0.0.1):
|
- flutter_local_notifications (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
@@ -124,6 +134,8 @@ PODS:
|
|||||||
- nanopb (~> 0.3)
|
- nanopb (~> 0.3)
|
||||||
- gRPC-Core/Interface (1.19.0)
|
- gRPC-Core/Interface (1.19.0)
|
||||||
- GTMSessionFetcher/Core (1.2.2)
|
- GTMSessionFetcher/Core (1.2.2)
|
||||||
|
- image_picker (0.0.1):
|
||||||
|
- Flutter
|
||||||
- leveldb-library (1.20)
|
- leveldb-library (1.20)
|
||||||
- nanopb (0.3.901):
|
- nanopb (0.3.901):
|
||||||
- nanopb/decode (= 0.3.901)
|
- nanopb/decode (= 0.3.901)
|
||||||
@@ -138,9 +150,11 @@ DEPENDENCIES:
|
|||||||
- cloud_firestore (from `.symlinks/plugins/cloud_firestore/ios`)
|
- cloud_firestore (from `.symlinks/plugins/cloud_firestore/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 `.symlinks/flutter/ios`)
|
- Flutter (from `.symlinks/flutter/ios`)
|
||||||
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
|
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
|
||||||
- google_sign_in (from `.symlinks/plugins/google_sign_in/ios`)
|
- google_sign_in (from `.symlinks/plugins/google_sign_in/ios`)
|
||||||
|
- image_picker (from `.symlinks/plugins/image_picker/ios`)
|
||||||
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
|
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
|
||||||
|
|
||||||
SPEC REPOS:
|
SPEC REPOS:
|
||||||
@@ -153,6 +167,7 @@ SPEC REPOS:
|
|||||||
- FirebaseCore
|
- FirebaseCore
|
||||||
- FirebaseFirestore
|
- FirebaseFirestore
|
||||||
- FirebaseInstanceID
|
- FirebaseInstanceID
|
||||||
|
- FirebaseStorage
|
||||||
- GoogleAppMeasurement
|
- GoogleAppMeasurement
|
||||||
- GoogleSignIn
|
- GoogleSignIn
|
||||||
- GoogleToolboxForMac
|
- GoogleToolboxForMac
|
||||||
@@ -171,12 +186,16 @@ 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: ".symlinks/flutter/ios"
|
:path: ".symlinks/flutter/ios"
|
||||||
flutter_local_notifications:
|
flutter_local_notifications:
|
||||||
:path: ".symlinks/plugins/flutter_local_notifications/ios"
|
:path: ".symlinks/plugins/flutter_local_notifications/ios"
|
||||||
google_sign_in:
|
google_sign_in:
|
||||||
:path: ".symlinks/plugins/google_sign_in/ios"
|
:path: ".symlinks/plugins/google_sign_in/ios"
|
||||||
|
image_picker:
|
||||||
|
:path: ".symlinks/plugins/image_picker/ios"
|
||||||
shared_preferences:
|
shared_preferences:
|
||||||
:path: ".symlinks/plugins/shared_preferences/ios"
|
:path: ".symlinks/plugins/shared_preferences/ios"
|
||||||
|
|
||||||
@@ -186,12 +205,14 @@ SPEC CHECKSUMS:
|
|||||||
Firebase: fa80b9d987ca014a1ba9357496ef2a0178b28b12
|
Firebase: fa80b9d987ca014a1ba9357496ef2a0178b28b12
|
||||||
firebase_auth: 7a2cc520766f90212b845a5b35316601707bfa25
|
firebase_auth: 7a2cc520766f90212b845a5b35316601707bfa25
|
||||||
firebase_core: ce5006bb48508ee4e71e0f429a3f519bb8ee2961
|
firebase_core: ce5006bb48508ee4e71e0f429a3f519bb8ee2961
|
||||||
|
firebase_storage: d83bfc0e0e849b2f871a34c474466bf5014ff304
|
||||||
FirebaseAnalytics: 1743c5f4de3687d0745709dfdc4b1dea1484f44c
|
FirebaseAnalytics: 1743c5f4de3687d0745709dfdc4b1dea1484f44c
|
||||||
FirebaseAuth: efc72b0f6fe075d2a6de8d81a6d9de83ef2b47eb
|
FirebaseAuth: efc72b0f6fe075d2a6de8d81a6d9de83ef2b47eb
|
||||||
FirebaseAuthInterop: 0ffa57668be100582bb7643d4fcb7615496c41fc
|
FirebaseAuthInterop: 0ffa57668be100582bb7643d4fcb7615496c41fc
|
||||||
FirebaseCore: e38f025287b413255a53acc1945d048a112047f7
|
FirebaseCore: e38f025287b413255a53acc1945d048a112047f7
|
||||||
FirebaseFirestore: 0537b2a960a4819fae2834e688e5daeb571c81d6
|
FirebaseFirestore: 0537b2a960a4819fae2834e688e5daeb571c81d6
|
||||||
FirebaseInstanceID: 0e0348a3c00a734fa376a070f5ad4533ad975cb5
|
FirebaseInstanceID: 0e0348a3c00a734fa376a070f5ad4533ad975cb5
|
||||||
|
FirebaseStorage: 926d41552072b9fee67aa645760f05f87b7ce604
|
||||||
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
|
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
|
||||||
flutter_local_notifications: 9e4738ce2471c5af910d961a6b7eadcf57c50186
|
flutter_local_notifications: 9e4738ce2471c5af910d961a6b7eadcf57c50186
|
||||||
google_sign_in: 27e70a98b529f0b076d4b19f231b81da28b1750b
|
google_sign_in: 27e70a98b529f0b076d4b19f231b81da28b1750b
|
||||||
@@ -202,6 +223,7 @@ SPEC CHECKSUMS:
|
|||||||
"gRPC-C++": 98be881723177d8c4faf5fdffacb582c7b4971a2
|
"gRPC-C++": 98be881723177d8c4faf5fdffacb582c7b4971a2
|
||||||
gRPC-Core: bd9472c8daa2e414b9f8038ba667bf56ce0e02b8
|
gRPC-Core: bd9472c8daa2e414b9f8038ba667bf56ce0e02b8
|
||||||
GTMSessionFetcher: 61bb0f61a4cb560030f1222021178008a5727a23
|
GTMSessionFetcher: 61bb0f61a4cb560030f1222021178008a5727a23
|
||||||
|
image_picker: e3eacd46b94694dde7cf2705955cece853aa1a8f
|
||||||
leveldb-library: 08cba283675b7ed2d99629a4bc5fd052cd2bb6a5
|
leveldb-library: 08cba283675b7ed2d99629a4bc5fd052cd2bb6a5
|
||||||
nanopb: 2901f78ea1b7b4015c860c2fdd1ea2fee1a18d48
|
nanopb: 2901f78ea1b7b4015c860c2fdd1ea2fee1a18d48
|
||||||
Protobuf: 7a877b7f3e5964e3fce995e2eb323dbc6831bb5a
|
Protobuf: 7a877b7f3e5964e3fce995e2eb323dbc6831bb5a
|
||||||
|
|||||||
@@ -259,6 +259,7 @@
|
|||||||
"${BUILT_PRODUCTS_DIR}/flutter_local_notifications/flutter_local_notifications.framework",
|
"${BUILT_PRODUCTS_DIR}/flutter_local_notifications/flutter_local_notifications.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/gRPC-C++/grpcpp.framework",
|
"${BUILT_PRODUCTS_DIR}/gRPC-C++/grpcpp.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/gRPC-Core/grpc.framework",
|
"${BUILT_PRODUCTS_DIR}/gRPC-Core/grpc.framework",
|
||||||
|
"${BUILT_PRODUCTS_DIR}/image_picker/image_picker.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/leveldb-library/leveldb.framework",
|
"${BUILT_PRODUCTS_DIR}/leveldb-library/leveldb.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework",
|
"${BUILT_PRODUCTS_DIR}/nanopb/nanopb.framework",
|
||||||
"${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework",
|
"${BUILT_PRODUCTS_DIR}/shared_preferences/shared_preferences.framework",
|
||||||
@@ -274,6 +275,7 @@
|
|||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_local_notifications.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_local_notifications.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/grpcpp.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/grpcpp.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/grpc.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/grpc.framework",
|
||||||
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/image_picker.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/leveldb.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/leveldb.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/nanopb.framework",
|
||||||
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework",
|
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/shared_preferences.framework",
|
||||||
|
|||||||
+17
-13
@@ -2,6 +2,8 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>NSCameraUsageDescription</key>
|
||||||
|
<string>Permiso para usar la camara</string>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>en</string>
|
<string>en</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
@@ -41,18 +43,20 @@
|
|||||||
</array>
|
</array>
|
||||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||||
<false/>
|
<false/>
|
||||||
<key>CFBundleURLTypes</key>
|
<key>NSPhotoLibraryUsageDescription</key>
|
||||||
<array>
|
<string>Permiso para ver tus fotos</string>
|
||||||
<dict>
|
<key>NSMicrophoneUsageDescription</key>
|
||||||
<key>CFBundleTypeRole</key>
|
<string>Permiso para grabar audio</string>
|
||||||
<string>Editor</string>
|
<key>CFBundleURLTypes</key>
|
||||||
<key>CFBundleURLSchemes</key>
|
<array>
|
||||||
<array>
|
<dict>
|
||||||
<!-- TODO Replace this value: -->
|
<key>CFBundleTypeRole</key>
|
||||||
<!-- Copied from GoogleService-Info.plist key REVERSED_CLIENT_ID -->
|
<string>Editor</string>
|
||||||
<string>com.googleusercontent.apps.173215752753-sfdf5d19ospsuphvgaclfsie0vp873lb</string>
|
<key>CFBundleURLSchemes</key>
|
||||||
</array>
|
<array>
|
||||||
</dict>
|
<string>com.googleusercontent.apps.173215752753-sfdf5d19ospsuphvgaclfsie0vp873lb</string>
|
||||||
</array>
|
</array>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
|
import 'package:firebase_storage/firebase_storage.dart';
|
||||||
|
import 'package:uuid/uuid.dart';
|
||||||
|
|
||||||
class ExpensesRepository {
|
class ExpensesRepository {
|
||||||
final String userId;
|
final String userId;
|
||||||
@@ -33,18 +38,45 @@ class ExpensesRepository {
|
|||||||
.delete();
|
.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
add(String categoryName, double value, DateTime date) {
|
add(String categoryName, double value, DateTime date, File selectedImage) async {
|
||||||
Firestore.instance
|
var document = Firestore.instance
|
||||||
.collection('users')
|
.collection('users')
|
||||||
.document(userId)
|
.document(userId)
|
||||||
.collection('expenses')
|
.collection('expenses')
|
||||||
.document()
|
.document();
|
||||||
.setData({
|
|
||||||
|
await document.setData({
|
||||||
"category": categoryName,
|
"category": categoryName,
|
||||||
"value": value,
|
"value": value,
|
||||||
"month": date.month,
|
"month": date.month,
|
||||||
"day": date.day,
|
"day": date.day,
|
||||||
"year": date.year,
|
"year": date.year,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (selectedImage != null) {
|
||||||
|
var imageName = Uuid().v1();
|
||||||
|
var imagePath = "/users/$userId/$imageName.jpg";
|
||||||
|
final StorageReference storageReference = FirebaseStorage().ref().child(imagePath);
|
||||||
|
|
||||||
|
final StorageUploadTask uploadTask = storageReference.putFile(selectedImage);
|
||||||
|
|
||||||
|
final StreamSubscription<StorageTaskEvent> streamSubscription = uploadTask.events.listen((event) {
|
||||||
|
// You can use this to notify yourself or your user in any kind of way.
|
||||||
|
// For example: you could use the uploadTask.events stream in a StreamBuilder instead
|
||||||
|
// to show your user what the current status is. In that case, you would not need to cancel any
|
||||||
|
// subscription as StreamBuilder handles this automatically.
|
||||||
|
|
||||||
|
// Here, every StorageTaskEvent concerning the upload is printed to the logs.
|
||||||
|
print('EVENT ${event.type}');
|
||||||
|
});
|
||||||
|
|
||||||
|
// Cancel your subscription when done.
|
||||||
|
await uploadTask.onComplete;
|
||||||
|
streamSubscription.cancel();
|
||||||
|
|
||||||
|
document.setData({
|
||||||
|
"imageUrl": (await storageReference.getDownloadURL()).toString(),
|
||||||
|
}, merge: true,);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+47
-28
@@ -1,6 +1,9 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:como_gasto/category_selection_widget.dart';
|
import 'package:como_gasto/category_selection_widget.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
import '../expenses_repository.dart';
|
import '../expenses_repository.dart';
|
||||||
@@ -25,6 +28,8 @@ class _AddPageState extends State<AddPage> with SingleTickerProviderStateMixin {
|
|||||||
String dateStr = "hoy";
|
String dateStr = "hoy";
|
||||||
DateTime date = DateTime.now();
|
DateTime date = DateTime.now();
|
||||||
|
|
||||||
|
File _selectedPicture;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -64,41 +69,50 @@ class _AddPageState extends State<AddPage> with SingleTickerProviderStateMixin {
|
|||||||
offset: Offset(0, h * (1 - _pageAnimation.value)),
|
offset: Offset(0, h * (1 - _pageAnimation.value)),
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
automaticallyImplyLeading: false,
|
leading: BackButton(
|
||||||
|
color: Colors.grey,
|
||||||
|
onPressed: () {
|
||||||
|
_controller.reverse();
|
||||||
|
},
|
||||||
|
),
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
elevation: 0.0,
|
elevation: 0.0,
|
||||||
title: GestureDetector(
|
title: Text(
|
||||||
onTap: () {
|
"Category ($dateStr)",
|
||||||
showDatePicker(
|
style: TextStyle(
|
||||||
context: context,
|
color: Colors.grey,
|
||||||
initialDate: DateTime.now(),
|
|
||||||
firstDate: DateTime.now().subtract(Duration(hours: 24*30)),
|
|
||||||
lastDate: DateTime.now(),
|
|
||||||
).then((newDate) {
|
|
||||||
if (newDate != null) {
|
|
||||||
setState(() {
|
|
||||||
date = newDate;
|
|
||||||
dateStr = "${date.year.toString()}-${date.month.toString().padLeft(2,'0')}-${date.day.toString().padLeft(2,'0')}";
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
"Category ($dateStr)",
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
centerTitle: false,
|
centerTitle: false,
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(
|
icon: Icon(Icons.calendar_today),
|
||||||
Icons.close,
|
color: Colors.grey,
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_controller.reverse();
|
showDatePicker(
|
||||||
|
context: context,
|
||||||
|
initialDate: DateTime.now(),
|
||||||
|
firstDate: DateTime.now().subtract(Duration(hours: 24*30)),
|
||||||
|
lastDate: DateTime.now(),
|
||||||
|
).then((newDate) {
|
||||||
|
if (newDate != null) {
|
||||||
|
setState(() {
|
||||||
|
date = newDate;
|
||||||
|
dateStr = "${date.year.toString()}-${date.month.toString().padLeft(2,'0')}-${date.day.toString().padLeft(2,'0')}";
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.camera_alt),
|
||||||
|
color: Colors.grey,
|
||||||
|
onPressed: () async {
|
||||||
|
var image = await ImagePicker.pickImage(source: ImageSource.camera);
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
_selectedPicture = image;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@@ -119,6 +133,11 @@ class _AddPageState extends State<AddPage> with SingleTickerProviderStateMixin {
|
|||||||
return Column(
|
return Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
_categorySelector(),
|
_categorySelector(),
|
||||||
|
if (_selectedPicture != null)
|
||||||
|
SizedBox(
|
||||||
|
height: 100,
|
||||||
|
child: Image.file(_selectedPicture),
|
||||||
|
),
|
||||||
_currentValue(),
|
_currentValue(),
|
||||||
_numpad(),
|
_numpad(),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@@ -303,7 +322,7 @@ class _AddPageState extends State<AddPage> with SingleTickerProviderStateMixin {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
var db = Provider.of<ExpensesRepository>(context);
|
var db = Provider.of<ExpensesRepository>(context);
|
||||||
if (value > 0 && category != "") {
|
if (value > 0 && category != "") {
|
||||||
db.add(category, value / 100.0, date);
|
db.add(category, value / 100.0, date, _selectedPicture);
|
||||||
|
|
||||||
_controller.reverse();
|
_controller.reverse();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
|
import 'package:firebase_storage/firebase_storage.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class DayExpenseListTile extends StatelessWidget {
|
class DayExpenseListTile extends StatelessWidget {
|
||||||
@@ -46,6 +47,9 @@ class DayExpenseListTile extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
subtitle: document['imageUrl'] == null
|
||||||
|
? null
|
||||||
|
: Image.network(document['imageUrl']),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.4.0+1"
|
version: "0.4.0+1"
|
||||||
|
firebase_storage:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: firebase_storage
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.8"
|
||||||
flare_dart:
|
flare_dart:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -165,6 +172,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.4"
|
version: "2.1.4"
|
||||||
|
image_picker:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: image_picker
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.6.1+11"
|
||||||
intl:
|
intl:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -303,6 +317,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.6"
|
version: "1.1.6"
|
||||||
|
uuid:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: uuid
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "2.0.2"
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
+4
-1
@@ -14,7 +14,7 @@ description: An app to help to track your expenses
|
|||||||
version: 1.0.0+1
|
version: 1.0.0+1
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.1.0 <3.0.0"
|
sdk: ">=2.2.2 <3.0.0"
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
@@ -22,6 +22,9 @@ dependencies:
|
|||||||
charts_flutter: ^0.6.0
|
charts_flutter: ^0.6.0
|
||||||
font_awesome_flutter: ^8.4.0
|
font_awesome_flutter: ^8.4.0
|
||||||
cloud_firestore: ^0.11.0+2
|
cloud_firestore: ^0.11.0+2
|
||||||
|
firebase_storage: ^3.0.8
|
||||||
|
image_picker: ^0.6.1+11
|
||||||
|
uuid:
|
||||||
|
|
||||||
# The following adds the Cupertino Icons font to your application.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
|
|||||||
Reference in New Issue
Block a user