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 #110 from theTaoTeam/notesimage
Browse files Browse the repository at this point in the history
fix(jar notes): fix fav note toggle so it works properly when there a…
  • Loading branch information
Scott Clampet authored Apr 30, 2019
2 parents 3ab9971 + 19a934e commit a8b323b
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 11 deletions.
2 changes: 0 additions & 2 deletions fude_app/lib/pages/jars/jar_edit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class _JarPageState extends State<EditJarPage> {
} else {
formKey.currentState.save();
model.updateJar(_formData);
model.fetchAllUserJars(model.currUserEmail);
Navigator.pop(context);
}
}
Expand Down Expand Up @@ -234,7 +233,6 @@ class _JarPageState extends State<EditJarPage> {
color: Colors.red,
onPressed: () {
model.deleteJar();
model.fetchAllUserJars(model.currUserEmail);
Navigator.pop(context);
})
],
Expand Down
41 changes: 34 additions & 7 deletions fude_app/lib/pages/jars/jar_notes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class JarNotes extends StatefulWidget {

class _JarNotesState extends State<JarNotes> {
bool isFavorite = false;
var stream; // state variable

@override
void initState() {
Expand Down Expand Up @@ -177,12 +176,40 @@ class _JarNotesState extends State<JarNotes> {
),
],
)
: Center(
child: Text(
'ADD AN IDEA TO GET STARTED',
style: Theme.of(context).textTheme.subtitle,
textAlign: TextAlign.center,
),
: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
SizedBox(height: height * .3,),
Center(
child: Text(
isFavorite
? 'NO FAVORITES'
: 'ADD AN IDEA TO GET STARTED',
style: Theme.of(context).textTheme.subtitle,
textAlign: TextAlign.center,
),
),
Expanded(
child: Align(
alignment: Alignment.bottomRight,
child: Container(
padding: EdgeInsets.fromLTRB(
0, 0, width * 0.04, width * 0.05),
child: IconButton(
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
icon: isFavorite
? Icon(Icons.favorite)
: Icon(Icons.favorite_border),
iconSize: 38,
color: Theme.of(context).iconTheme.color,
onPressed: () => toggleFavoriteFilter(),
),
),
),
),
],
);
}
}),
Expand Down
6 changes: 5 additions & 1 deletion fude_app/lib/scoped-models/jar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ mixin JarModel on Model {
imageLocation == null ? _selJar['image'] : imageLocation.toString(),
'isFav': _selJar['isFav']
});
final user = await _auth.currentUser();
fetchAllUserJars(user.email);
notifyListeners();
} catch (e) {
print(e);
}
Expand All @@ -109,6 +112,8 @@ mixin JarModel on Model {
.document(_selJar.documentID)
.delete()
.catchError((err) => print(err));
final user = await _auth.currentUser();
fetchAllUserJars(user.email);
notifyListeners();
} catch (e) {
print(e);
Expand Down Expand Up @@ -194,7 +199,6 @@ mixin JarModel on Model {
} catch (e) {
print(e);
}
// print('location: $location -------');
//returns the download url
return location;
}
Expand Down
2 changes: 1 addition & 1 deletion fude_app/lib/widgets/forms/add_user_to_jar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class AddUserToJarForm extends StatelessWidget {
? Container(
padding: EdgeInsets.only(left: width * 0.04),
child: Text(
"This user doesn't have an account yet. Please have them create one before adding!",
"This user doesn't have an account yet. Please have them create one before sharing!",
overflow: TextOverflow.clip,
style: TextStyle(
color: Colors.red,
Expand Down

0 comments on commit a8b323b

Please sign in to comment.