Download asset to local and error fixing (#100)

* Update photo_manager pub package
* Added download endpoint for assets
* Successfully save a photo to the local device's gallery
* Save save a video to the local device's gallery
* Fixed #97
* Added download loading indicator
* Refactor and increase the font size for curated search thumbnail images
* Reposition loading animation on the search result page
This commit is contained in:
Alex
2022-04-02 12:31:53 -05:00
committed by GitHub
parent 60df387459
commit 90ef64efa3
34 changed files with 538 additions and 257 deletions

View File

@@ -8,12 +8,24 @@ class ImmichToast {
required BuildContext context,
required String msg,
ToastType toastType = ToastType.info,
ToastGravity gravity = ToastGravity.TOP,
}) {
FToast fToast;
fToast = FToast();
fToast.init(context);
_getColor(ToastType type, BuildContext context) {
switch (type) {
case ToastType.info:
return Theme.of(context).primaryColor;
case ToastType.success:
return const Color.fromARGB(255, 78, 140, 124);
case ToastType.error:
return const Color.fromARGB(255, 220, 48, 85);
}
}
fToast.showToast(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
@@ -36,8 +48,8 @@ class ImmichToast {
: Container(),
(toastType == ToastType.success)
? const Icon(
Icons.check,
color: Color.fromARGB(255, 104, 248, 140),
Icons.check_circle_rounded,
color: Color.fromARGB(255, 78, 140, 124),
)
: Container(),
(toastType == ToastType.error)
@@ -53,7 +65,7 @@ class ImmichToast {
child: Text(
msg,
style: TextStyle(
color: Theme.of(context).primaryColor,
color: _getColor(toastType, context),
fontWeight: FontWeight.bold,
fontSize: 15,
),
@@ -62,7 +74,7 @@ class ImmichToast {
],
),
),
gravity: ToastGravity.TOP,
gravity: gravity,
toastDuration: const Duration(seconds: 2),
);
}