forked from immich-app/immich
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6141888
commit 55cba8a
Showing
8 changed files
with
98 additions
and
4 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:fluttertoast/fluttertoast.dart'; | ||
|
||
enum ToastType { info, success, error } | ||
|
||
class ImmichToast { | ||
static show({ | ||
required BuildContext context, | ||
required String msg, | ||
ToastType toastType = ToastType.info, | ||
}) { | ||
FToast fToast; | ||
|
||
fToast = FToast(); | ||
fToast.init(context); | ||
|
||
fToast.showToast( | ||
child: Container( | ||
padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0), | ||
decoration: BoxDecoration( | ||
borderRadius: BorderRadius.circular(5.0), | ||
color: Colors.grey[50], | ||
border: Border.all( | ||
color: Colors.black12, | ||
width: 1, | ||
), | ||
), | ||
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, | ||
color: Color.fromARGB(255, 104, 248, 140), | ||
) | ||
: Container(), | ||
(toastType == ToastType.error) | ||
? const Icon( | ||
Icons.error_outline_rounded, | ||
color: Color.fromARGB(255, 240, 162, 156), | ||
) | ||
: Container(), | ||
const SizedBox( | ||
width: 12.0, | ||
), | ||
Flexible( | ||
child: Text( | ||
msg, | ||
style: TextStyle( | ||
color: Theme.of(context).primaryColor, | ||
fontWeight: FontWeight.bold, | ||
fontSize: 15, | ||
), | ||
), | ||
), | ||
], | ||
), | ||
), | ||
gravity: ToastGravity.TOP, | ||
toastDuration: const Duration(seconds: 2), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters