import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:loading_indicator/loading_indicator.dart'; import 'package:provider/provider.dart'; import 'package:teso/Classes/Uploading.dart'; import 'package:teso/providers/user_provider.dart'; import 'package:teso/util/consts.dart'; uploadTile(BuildContext context, Uploading pendingUpload) { return Card( child: Container( width: MediaQuery.of(context).size.width, height: 70, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Container( //constraints: BoxConstraints(minHeight: 80, maxHeight: 150), width: 60, height: 60, child: pendingUpload != null && pendingUpload.thumbnail != null ? Image( width: double.infinity, height: double.infinity, fit: BoxFit.cover, image: MemoryImage(base64Decode(pendingUpload.thumbnail)), gaplessPlayback: true, ) : Image( width: double.infinity, height: double.infinity, fit: BoxFit.cover, image: AssetImage( "assets/images/blank.jpg", ), gaplessPlayback: true, ), ), pendingUpload.isProcessing ? new Wrap( direction: Axis.vertical, children: [ Text("Preparing post.."), LoadingIndicator( indicatorType: Indicator.ballPulse, /// Required, The loading type of the widget colors: [tesoAsh, tesoBlue, tesoGold], /// Optional, The color collections strokeWidth: 2, /// Optional, The stroke of the line, only applicable to widget which contains line ) ], ) : new Wrap( direction: Axis.vertical, children: [ Text("Processing.."), Container( width: MediaQuery.of(context).size.width * 0.65, height: 10, child: LinearProgressIndicator( value: pendingUpload.pending, backgroundColor: tesoAsh, valueColor: new AlwaysStoppedAnimation(tesoBlue), ), ), ], ), pendingUpload.isProcessing ? Container() : Container( width: 40, height: 40, child: InkWell( onTap: () => Provider.of(context, listen: false) .cancelUpload(pendingUpload), child: Icon(Icons.close), ), ), ], ), ), ); }