@@ -110,15 +110,11 @@ void showIngredientDetails(BuildContext context, int id, {String? image}) {
110
110
Ingredient ? ingredient;
111
111
NutritionalGoals ? goals;
112
112
String ? source;
113
- String ? url;
114
113
115
114
if (snapshot.hasData) {
116
115
ingredient = snapshot.data;
117
116
goals = ingredient! .nutritionalValues.toGoals ();
118
117
source = ingredient.sourceName ?? 'unknown' ;
119
- url = ingredient.remoteId == null
120
- ? null
121
- : 'https://world.openfoodfacts.org/product/${ingredient .remoteId }' ;
122
118
}
123
119
return AlertDialog (
124
120
title: (snapshot.hasData) ? Text (ingredient! .name) : null ,
@@ -131,7 +127,7 @@ void showIngredientDetails(BuildContext context, int id, {String? image}) {
131
127
if (image != null ) const SizedBox (height: 12 ),
132
128
if (snapshot.hasError)
133
129
Text (
134
- 'Ingredient lookup error: ${snapshot .error }' ,
130
+ 'Ingredient lookup error: ${snapshot .error ?? 'unknown error' }' ,
135
131
style: const TextStyle (color: Colors .red),
136
132
),
137
133
if (! snapshot.hasData && ! snapshot.hasError) const CircularProgressIndicator (),
@@ -144,13 +140,14 @@ void showIngredientDetails(BuildContext context, int id, {String? image}) {
144
140
showGperKg: false ,
145
141
),
146
142
),
147
- if (snapshot.hasData && url == null ) Text ('Source: ${source !}' ),
148
- if (snapshot.hasData && url != null )
143
+ if (snapshot.hasData && ingredient! .licenseObjectURl == null )
144
+ Text ('Source: ${source !}' ),
145
+ if (snapshot.hasData && ingredient! .licenseObjectURl != null )
149
146
Padding (
150
147
padding: const EdgeInsets .only (top: 12 ),
151
148
child: InkWell (
152
149
child: Text ('Source: ${source !}' ),
153
- onTap: () => launchURL (url ! , context),
150
+ onTap: () => launchURL (ingredient ! .licenseObjectURl ! , context),
154
151
),
155
152
),
156
153
],
0 commit comments