Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #136 from theTaoTeam/pullfromall
Browse files Browse the repository at this point in the history
Pullfromall
  • Loading branch information
Scott Clampet authored May 18, 2019
2 parents 442863f + e632e88 commit 729ecad
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 38 deletions.
4 changes: 2 additions & 2 deletions fude_app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ DEPENDENCIES:
- firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_storage (from `.symlinks/plugins/firebase_storage/ios`)
- Flutter (from `.symlinks/flutter/ios-release`)
- Flutter (from `.symlinks/flutter/ios`)
- image_picker (from `.symlinks/plugins/image_picker/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
Expand Down Expand Up @@ -186,7 +186,7 @@ EXTERNAL SOURCES:
firebase_storage:
:path: ".symlinks/plugins/firebase_storage/ios"
Flutter:
:path: ".symlinks/flutter/ios-release"
:path: ".symlinks/flutter/ios"
image_picker:
:path: ".symlinks/plugins/image_picker/ios"
shared_preferences:
Expand Down
2 changes: 1 addition & 1 deletion fude_app/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@
);
inputPaths = (
"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../.symlinks/flutter/ios-release/Flutter.framework",
"${PODS_ROOT}/../.symlinks/flutter/ios/Flutter.framework",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
Expand Down
8 changes: 4 additions & 4 deletions fude_app/lib/helpers/randomNoteModal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void showRandomNote(BuildContext context, DocumentSnapshot randomNote,
child: AlertDialog(
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
contentPadding: EdgeInsets.all(0),
contentPadding: EdgeInsets.all(2.5),
content: ClipRRect(
borderRadius: BorderRadius.circular(30),
child: Container(
Expand Down Expand Up @@ -65,17 +65,17 @@ void showRandomNote(BuildContext context, DocumentSnapshot randomNote,
? Expanded(
child: Center(
child: Text(
"You don't have any $category ideas yet.",
category == 'ALL' ? "You still need to add some ideas to this jar!" : "You don't have any ideas in this category yet!",
textAlign: TextAlign.center,
overflow: TextOverflow.fade,
overflow: TextOverflow.clip,
style: TextStyle(
color: Theme.of(context).primaryColor ==
Color.fromRGBO(40, 40, 40, 1)
? Color.fromRGBO(242, 242, 242, 1)
: Color.fromRGBO(40, 40, 40, 1),
fontWeight: FontWeight.bold,
fontSize: 20,
letterSpacing: 3,
letterSpacing: 1,
),
),
),
Expand Down
4 changes: 2 additions & 2 deletions fude_app/lib/pages/jars/jar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ class _JarPageState extends State<JarPage> {
child: Column(
children: <Widget>[
Text(
'SELECT A CATEGORY',
'TAP A CATEGORY TO',
style: TextStyle(
color: Theme.of(context)
.secondaryHeaderColor,
Expand All @@ -280,7 +280,7 @@ class _JarPageState extends State<JarPage> {
height: height * 0.01,
),
Text(
'TO PULL A RANDOM IDEA',
'PULL A RANDOM IDEA',
style: TextStyle(
color: Theme.of(context)
.secondaryHeaderColor,
Expand Down
8 changes: 1 addition & 7 deletions fude_app/lib/pages/jars/jar_edit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class _JarPageState extends State<EditJarPage> {
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
final GlobalKey<FormState> addUserFormKey = GlobalKey<FormState>();
int categoryCount = 0;
bool needsAtLeastOneCategory = false;
List<dynamic> currentCategories = [];
bool userHasBeenAdded = false;
bool needToInviteThisUser = false;
Expand All @@ -48,7 +47,7 @@ class _JarPageState extends State<EditJarPage> {

void updateJar(MainModel model) {
//validate form.
if (!this.formKey.currentState.validate() || needsAtLeastOneCategory) {
if (!this.formKey.currentState.validate()) {
return;
} else {
formKey.currentState.save();
Expand Down Expand Up @@ -80,16 +79,12 @@ class _JarPageState extends State<EditJarPage> {
void updateCategoryCount() {
setState(() {
categoryCount += 1;
needsAtLeastOneCategory = false;
});
}

void addCategoryToRemoveList(String category) {
_formData['categoriesToRemove'].add(category);
setState(() {
if (currentCategories.length == 1 && categoryCount == 0) {
needsAtLeastOneCategory = true;
}
currentCategories.removeWhere((val) => val == category);
});
}
Expand Down Expand Up @@ -191,7 +186,6 @@ class _JarPageState extends State<EditJarPage> {
jar: model.selectedJar,
addCategoryToRemoveList: addCategoryToRemoveList,
categories: currentCategories,
needsAtLeastOneCategory: needsAtLeastOneCategory,
updateCategory: updateCategory,
updateTitle: updateTitle,
updateImage: updateImage,
Expand Down
16 changes: 12 additions & 4 deletions fude_app/lib/scoped-models/jar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ mixin JarModel on Model {
notifyListeners();
CollectionReference jarCollection = _firestore.collection('jars');
String imageLocation;
data['categories'].add('ALL');

try {
if (data['image'] != null) {
imageLocation = await uploadJarImageToStorage(data['image']);
Expand Down Expand Up @@ -361,11 +363,17 @@ mixin JarModel on Model {
print(e);
}
if (notes.documents.length > 0) {
notes.documents.forEach((doc) {
if (doc.data['category'] == category) {
if (category == 'ALL') {
notes.documents.forEach((doc) {
_jarNotesByCategory.add(doc);
}
});
});
} else {
notes.documents.forEach((doc) {
if (doc.data['category'] == category) {
_jarNotesByCategory.add(doc);
}
});
}
} else {
return null;
}
Expand Down
7 changes: 2 additions & 5 deletions fude_app/lib/widgets/form-inputs/add_jar_category_input.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:fude/scoped-models/main.dart';
class AddJarCategoryField extends StatelessWidget {
final String hint;
final bool enabled;
final bool needsAtLeastOneCategory;
final Function updateCategory;
final Function addCategoryToRemoveList;
final MainModel model;
Expand All @@ -14,7 +13,6 @@ class AddJarCategoryField extends StatelessWidget {
AddJarCategoryField(
{this.hint,
this.enabled,
this.needsAtLeastOneCategory,
this.updateCategory,
this.addCategoryToRemoveList,
this.model,
Expand All @@ -24,7 +22,7 @@ class AddJarCategoryField extends StatelessWidget {
final double height = MediaQuery.of(context).size.height;
final double width = MediaQuery.of(context).size.width;
return GestureDetector(
onLongPress: () => addCategoryToRemoveList(hint),
onLongPress: () => hint != 'ALL' ? addCategoryToRemoveList(hint) : print("you can't delete the all category"),
child: Card(
color: Theme.of(context).cardColor,
elevation: 6.0,
Expand Down Expand Up @@ -62,8 +60,7 @@ class AddJarCategoryField extends StatelessWidget {
),
validator: (String val) {
String finalVal = val.trim();
if (needsAtLeastOneCategory == true ||
finalVal.isEmpty && categories.length < 1) {
if (finalVal.isEmpty) {
return 'cannot be blank';
}
},
Expand Down
1 change: 0 additions & 1 deletion fude_app/lib/widgets/forms/add_jar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class AddJarForm extends StatelessWidget {
model: model,
enabled: true,
categories: categories,
needsAtLeastOneCategory: needsAtLeastOneCategory
),
],
),
Expand Down
14 changes: 2 additions & 12 deletions fude_app/lib/widgets/forms/edit_jar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class EditJarForm extends StatelessWidget {
final MainModel model;
final List<dynamic> categories;
final int categoryCount;
final bool needsAtLeastOneCategory;
final Function updateTitle;
final Function updateCategory;
final Function updateImage;
Expand All @@ -25,7 +24,6 @@ class EditJarForm extends StatelessWidget {
this.categories,
this.jar,
this.categoryCount,
this.needsAtLeastOneCategory,
this.updateTitle,
this.updateCategory,
this.addCategoryToRemoveList,
Expand Down Expand Up @@ -74,13 +72,12 @@ class EditJarForm extends StatelessWidget {
updateCategory: updateCategory,
enabled: false,
addCategoryToRemoveList: addCategoryToRemoveList,
needsAtLeastOneCategory: needsAtLeastOneCategory,
),
Text(
categories[i] != 'ALL' ? Text(
'Tap and hold to delete',
style: TextStyle(
color: Color.fromRGBO(131, 129, 129, 1), fontSize: 12),
)
) : Container()
],
),
);
Expand Down Expand Up @@ -130,13 +127,6 @@ class EditJarForm extends StatelessWidget {
),
SizedBox(height: height * 0.03),
_buildFormTitles("CATEGORIES", context),
needsAtLeastOneCategory
? Text(
'Please keep at least one category',
style: TextStyle(color: Colors.red),
textAlign: TextAlign.start,
)
: Container(),
SizedBox(height: height * 0.01),
_buildExistingCategoryInputs(context),
Column(
Expand Down

0 comments on commit 729ecad

Please sign in to comment.