You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

33 lines
1.4 KiB

// prefs = await SharedPreferences.getInstance();
// String token = prefs.getString("tokensTeso");
// Map<String, String> requestHeaders = {
// 'Content-type': 'application/json',
// 'Authorization': token
// };
// String url = serverLocation + "posts/upload-post";
// var request = http.MultipartRequest('POST', Uri.parse(url))
// ..headers['Authorization'] = token
// ..fields["title"] = controller.text
// ..fields["aspect"] = aspectRatio
// ..fields["thumbnail"] =
// widget.thumbnail != null ? base64Encode(widget.thumbnail) : null
// ..files.add(await http.MultipartFile.fromPath(
// 'video', widget.video.replaceAll("file://", "")));
// var res = await request.send();
// var response = await dio.Dio().post(
// url,
// data: formData,
// options: dio.Options(headers: requestHeaders),
// onSendProgress: (int sent, int total) {
// print('here : $sent $total');
// },
// );
// if (res.statusCode == 200) {
// var response = await http.Response.fromStream(res);
// Map handler = jsonDecode(response.body);
// PostedAd postedAd = PostedAd.fromJSON(handler);
// Provider.of<UserProvider>(context, listen: false)
// .updatePosted(postedAd);
// Navigator.pop(context);
// } else {}