SHARE
TWEET

Untitled

a guest Feb 15th, 2020 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3.  
  4.    Future<bool> _SendToServer() async {
  5.     print('Future Started ...');
  6.     await _displaySnackBarLoading(context, "Uploading ...");
  7.  
  8.     var dataUploaded = false;
  9.     var UploadTask;
  10.  
  11.     /// Check Inputs
  12.     var dataChecked = await _validateInputs();
  13.     print('dataChecked $dataChecked');
  14.     await Future.delayed(Duration(seconds: 4));
  15.  
  16.     /// Create New Post
  17.     var postCreated = await _CreatePost();
  18.     print(' postCreated $postCreated');
  19.     setState(() {
  20.       dataChecked = true;
  21.     });
  22.  
  23.     /// Rest Fields
  24.     var fieldsRested = await _Resetdata();
  25.     print('fieldsRested $fieldsRested');
  26.  
  27.     if (dataChecked == false || postCreated != null || fieldsRested == false) {
  28.       dataUploaded = false;
  29.  
  30.       /// Upload it
  31.       UploadTask = await _displaySnackBar(context, "تم إضافة الهبة بنجاح ");
  32.  
  33.       setState(() {
  34.         dataUploaded = true;
  35.       });
  36.  
  37.       /// Loging
  38.       print("fieldsRested $fieldsRested " +
  39.           "dataChecked $dataChecked" +
  40.           "fieldsRested $fieldsRested");
  41.     }
  42.  
  43.     print("Future Endeed ...");
  44.     return dataUploaded;
  45.   }
  46.  
  47.  
  48.  onPressed: () async {
  49.               var isFinish = false;
  50.  
  51.               if (_name.isNotEmpty && !_loading) {
  52.                 final action = await Dialogs.yesAbortDialog(context,
  53.                     ' Add Heba', 'Are You Sure You Want To Add This Post');
  54.                 if (action == DialogAction.yes) {
  55. //                   _SendToServer();
  56.  
  57. //                  _navigateAndDisplaySelection(context) ;
  58. //
  59.                   await _SendToServer().whenComplete(() async {
  60.                     await _displaySnackBar(
  61.                         context, "s");
  62.                     await Navigator.of(context).pushNamed(HomeScreen.id);
  63.                   });
  64.  
  65.                   setState(() => tappedYes = true);
  66.                 } else {
  67.                   setState(() => tappedYes = false);
  68.                 }
  69.               } else if (_name.isNotEmpty == false) {
  70.                 _displaySnackBar(context, " أدخل إسم للهبة $_name");
  71.               }
  72.  
  73. //              showDialog();
  74. //              print("onPressed Triggerd \n"
  75. //                  "Post Object :  name : $_name desc : $_desc location: $_location \n"
  76. //                  " images pathes : ${listOfImageLinks.length} "
  77. //                  "Selected Images List : ${readyToUploadImages.length} \n");
  78.  
  79.               /// loding ??
  80.             },
  81.           ),
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top