Skip to content

Commit

Permalink
Fix for images not loading correctly on the edit page
Browse files Browse the repository at this point in the history
  • Loading branch information
ahoefnagel committed Jun 11, 2020
1 parent 3baf888 commit e3fba8d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions client/lib/pages/plant-detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class PlantDetail extends StatelessWidget {
centerTitle: true,
),
body: StatefulWrapper(
onInit: () { (getUserPlantImage(userPlant) as Future<CachedNetworkImage>).then((image) => userPlantImage = image); },
onInit: () async { userPlantImage = getUserPlantImage(userPlant); },
child: DefaultTextStyle(
style: TextStyle(
fontFamily: 'Libre Baskerville',
Expand Down Expand Up @@ -89,7 +89,7 @@ class PlantDetail extends StatelessWidget {
child: Align(
alignment: Alignment.topRight,
child: RawMaterialButton(
onPressed: () {
onPressed: () async {
Navigator.pushReplacementNamed(context, '/add-plant', arguments: { 'plant': userPlant, 'userPlantImage': userPlantImage});
},
elevation: 2.0,
Expand Down
6 changes: 2 additions & 4 deletions client/lib/widgets/PlantListItem.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,8 @@ class PlantListItem extends StatelessWidget {
foregroundColor: Colors.orange.shade900,
color: Colors.amber.shade100,
icon: Icons.edit,
onTap: (){
plantImage.then((userPlantImage) =>
Navigator.pushNamed(context, '/add-plant', arguments: { 'plant': userPlant, 'userPlantImage': userPlantImage})
);
onTap: () async {
Navigator.pushNamed(context, '/add-plant', arguments: { 'plant': userPlant, 'userPlantImage': await plantImage});
},
),
IconSlideAction(
Expand Down

0 comments on commit e3fba8d

Please sign in to comment.