Skip to content

Instantly share code, notes, and snippets.

@obadajasm
Created April 12, 2020 13:04
Show Gist options
  • Save obadajasm/10995f1f5909b0b5f7e62fb164c4def3 to your computer and use it in GitHub Desktop.
Save obadajasm/10995f1f5909b0b5f7e62fb164c4def3 to your computer and use it in GitHub Desktop.
ListView.builder(
physics: NeverScrollableScrollPhysics(),
shrinkWrap: true,
itemCount: provider.items == null ? 0 : provider.items.length,
itemBuilder: (ctx, index) {
return GestureDetector(
onTap: () async {
var tempDir = await DownloadsPathProvider.downloadsDirectory;
await Directory(tempDir.path + "/SubDownloader").create();
String fullPath = tempDir.path +
"/SubDownloader/${provider.items[index]['SubFileName']}'";
print('full path $fullPath');
await provider.download2(
provider.items[index]['ZipDownloadLink'],
fullPath,
);
if (provider.errMSG.isEmpty) {
Fluttertoast.showToast(
msg: "Subtitle Saved in $fullPath",
toastLength: Toast.LENGTH_SHORT,
gravity: ToastGravity.BOTTOM,
timeInSecForIosWeb: 1,
backgroundColor: Colors.black,
textColor: Colors.white,
fontSize: 16.0);
}
},
child: Center(
child: Card(
color: Color(0xffdbdbdb),
//Color(0xffffbd69),
margin: EdgeInsets.all(10),
shape: RoundedRectangleBorder(
borderRadius: const BorderRadius.all(
Radius.circular(55.0),
),
),
elevation: 7,
child: ListTile(
trailing: Text(
(int.parse(provider.items[index]['SubSize']) / 1024)
.floor()
.toString() +
"K"),
title: Center(
child: Text(
provider.items == null
? ""
: "${provider.items[index]['SubFileName']}",
),
),
),
),
),
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment