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

Commit

Permalink
feat(jar, jar edit, jar add, jar scoped model): add option to pull fr…
Browse files Browse the repository at this point in the history
…om entire jar

re #129
  • Loading branch information
Scott Clampet authored and Scott Clampet committed May 18, 2019
1 parent 4c6fe7e commit e632e88
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 13 deletions.
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
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,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
4 changes: 2 additions & 2 deletions fude_app/lib/widgets/forms/edit_jar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ class EditJarForm extends StatelessWidget {
enabled: false,
addCategoryToRemoveList: addCategoryToRemoveList,
),
Text(
categories[i] != 'ALL' ? Text(
'Tap and hold to delete',
style: TextStyle(
color: Color.fromRGBO(131, 129, 129, 1), fontSize: 12),
)
) : Container()
],
),
);
Expand Down

0 comments on commit e632e88

Please sign in to comment.