import 'package:flutter/material.dart';
import 'package:grostore/configs/style_config.dart';
import 'package:grostore/configs/theme_config.dart';
import 'package:grostore/helpers/route.dart';
import 'package:grostore/screens/cart.dart';
import 'package:toast/toast.dart';


class ToastUi{
static simpleToast(context,message){
    ToastContext().init(context);
    return Toast.show(
        message,
        border: Border.all(color: ThemeConfig.fontColor,width: 1),
        backgroundColor: ThemeConfig.white,
        textStyle: StyleConfig.fs14fwNormal,
        duration: Toast.lengthLong,gravity: Toast.center);
  }

static show(BuildContext mainContext,message){
  showDialog(
      context: mainContext, builder: (context){
    Future.delayed(const Duration(milliseconds: 250)).then((value) => Navigator.pop(mainContext));
    return  AlertDialog(
      content: Text(message,style: StyleConfig.fs14fwNormal,),);
  });
}

static show3(BuildContext mainContext,message){
  showDialog(
      context: mainContext, builder: (context){
    Future.delayed(const Duration(milliseconds: 1200)).then((value) => Navigator.pop(mainContext));
    return  AlertDialog(
      backgroundColor: Colors.white,
      content: Text(message,style: StyleConfig.fs14fwNormal,),);
  });
}
static showAdd(BuildContext mainContext,message){
  showDialog(
    useSafeArea: false,
      barrierDismissible: true,
      barrierColor: Colors.transparent,
      context: mainContext, builder: (context){
    Future.delayed(const Duration(milliseconds: 250)).then((value) => Navigator.pop(mainContext));
    return  AlertDialog(
      elevation: 0,
      content: InkWell(
          onTap: (){
            Navigator.of(context).push(MaterialPageRoute(builder: (_)=> const Cart()));
          },
          child: SizedBox(
              height: 20,
              child: Text(message,style: StyleConfig.fs14fwNormal,))),);
  });
}
static showAdd2(BuildContext mainContext,message){
  showDialog(
      // useSafeArea: false,
      // barrierDismissible: true,
      // barrierColor: Colors.transparent,
      context: mainContext, builder: (context){
    // Future.delayed(const Duration(milliseconds: 200)).then((value) => Navigator.pop(mainContext));
    return  AlertDialog(
      // elevation: 0,
      content: InkWell(
          onTap: (){},
          child: Text(message,style: StyleConfig.fs14fwNormal,)),);
  });
}
}