diff options
Diffstat (limited to 'lib/views/recipe_view.dart')
-rw-r--r-- | lib/views/recipe_view.dart | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/lib/views/recipe_view.dart b/lib/views/recipe_view.dart index 92a50b7..f512770 100644 --- a/lib/views/recipe_view.dart +++ b/lib/views/recipe_view.dart @@ -16,7 +16,6 @@ import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:path_provider/path_provider.dart'; import 'package:image_picker/image_picker.dart'; import 'package:share_plus/share_plus.dart'; -import 'package:http/http.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; @@ -131,7 +130,7 @@ class _RecipeViewState extends State<RecipeView> { setState(() {}); } - // TODO: FIXME: This might introduce bugs later (sanetize); maybe use FileHandler? + // TODO: FIXME: This might introduce bugs later (sanitize); maybe use FileHandler? void downloadRecipe(BuildContext context, Recipe recipe) async { RecipeData.recipeList.add(recipe); ToastBar.showToastBar(context, AppLocalizations.of(context)!.downloadSuccess); @@ -292,7 +291,7 @@ class _RecipeViewState extends State<RecipeView> { if (_ingredients.isEmpty) { // TODO: translation - widget.showToastCallback!("No ingredients found", ""); + widget.showToastCallback!("No ingredients found", "", () {}); return; } @@ -308,30 +307,12 @@ class _RecipeViewState extends State<RecipeView> { if (widget.showToastCallback != null) { // TODO: translation - widget.showToastCallback!("Added to Shoplist", ""); + widget.showToastCallback!("Added to Shoplist", "", () {}); } } void _uploadRecipe(BuildContext context) async { return; - - Map<String, String> _headers = {"Content-Type": "application/json; charset=UTF-8"}; - String _body = _unsavedRecipe.toJsonString(); - Response? res; - - try { - res = await post(Uri.https(SettingsData.settings["serverURL"]!, "/"), headers: _headers, body: _body); - } catch (e) { - print(e); - } finally { - if (res != null && res.statusCode == 200) { - ToastBar.showToastBar(context, AppLocalizations.of(context)!.uploadSuccess); - } else { - ToastBar.showToastBar(context, AppLocalizations.of(context)!.uploadError); - } - - setState(() {}); - } } List<Widget> _buildAppBarActions(BuildContext context, Recipe recipe) { |