Clean code of shared folder (#249)

* optimize android side gradle settings

* android minsdk back to 21

* remove unused package, update linter and fix lint error

* clean code of 'shared module' with offical dart style guide

* restore uploadProfileImage method in UserService
This commit is contained in:
xpwmaosldk 2022-06-23 13:14:14 +09:00 committed by GitHub
parent caaa474c23
commit ef097d15dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 100 additions and 103 deletions

View file

@ -10,12 +10,10 @@ class ImmichToast {
ToastType toastType = ToastType.info,
ToastGravity gravity = ToastGravity.TOP,
}) {
FToast fToast;
fToast = FToast();
final fToast = FToast();
fToast.init(context);
_getColor(ToastType type, BuildContext context) {
Color _getColor(ToastType type, BuildContext context) {
switch (type) {
case ToastType.info:
return Theme.of(context).primaryColor;
@ -26,6 +24,26 @@ class ImmichToast {
}
}
Icon _getIcon(ToastType type) {
switch (type) {
case ToastType.info:
return Icon(
Icons.info_outline_rounded,
color: Theme.of(context).primaryColor,
);
case ToastType.success:
return const Icon(
Icons.check_circle_rounded,
color: Color.fromARGB(255, 78, 140, 124),
);
case ToastType.error:
return const Icon(
Icons.error_outline_rounded,
color: Color.fromARGB(255, 240, 162, 156),
);
}
}
fToast.showToast(
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
@ -40,24 +58,7 @@ class ImmichToast {
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
(toastType == ToastType.info)
? Icon(
Icons.info_outline_rounded,
color: Theme.of(context).primaryColor,
)
: Container(),
(toastType == ToastType.success)
? const Icon(
Icons.check_circle_rounded,
color: Color.fromARGB(255, 78, 140, 124),
)
: Container(),
(toastType == ToastType.error)
? const Icon(
Icons.error_outline_rounded,
color: Color.fromARGB(255, 240, 162, 156),
)
: Container(),
_getIcon(toastType),
const SizedBox(
width: 12.0,
),