showToast method

void showToast(
  1. String message,
  2. IconData icon,
  3. Color color, {
  4. int duration = 2,
})

Implementation

void showToast(
  String message,
  IconData icon,
  Color color, {
  int duration = 2,
}) {
  BotToast.showCustomText(
    duration: Duration(seconds: duration),
    onlyOne: true,
    align: Alignment.center,
    // margin: const EdgeInsets.fromLTRB(12, 0, 12, 200),
    toastBuilder: (_) => Card(
      color: color,
      elevation: 0,
      margin: const EdgeInsets.symmetric(horizontal: 12),
      clipBehavior: Clip.antiAlias,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(10),
      ),
      child: Container(
        padding: const EdgeInsets.symmetric(
          horizontal: 15,
          vertical: 10,
        ),
        child: Row(
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            FaIcon(
              icon,
              color: AppColors.white,
            ),
            const SizedBox(width: 10),
            Expanded(
              child: Container(
                margin: const EdgeInsets.only(bottom: 5),
                child: Text(
                  message,
                  textAlign: TextAlign.center,
                  softWrap: true,
                  style: const TextStyle(
                    fontSize: 15,
                    color: AppColors.white,
                    fontWeight: FontWeight.normal,
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    ),
  );
}