Ejemplo n.º 1
0
 public static void createView(CustomToastItem toastItem)
 {
     _overlayState = Overlay.of(context: toastItem.context);
     _overlayEntry = new OverlayEntry(
         _context => new CustomToastWidget(
             gravity: toastItem.gravity,
             new Container(
                 width: MediaQuery.of(context: _context).size.width,
                 alignment: Alignment.center,
                 child: new Container(
                     decoration: new BoxDecoration(
                         color: toastItem.backgroundColor,
                         borderRadius: BorderRadius.circular(radius: toastItem.radius)
                         ),
                     margin: EdgeInsets.symmetric(horizontal: 20),
                     padding: EdgeInsets.fromLTRB(16, 10, 16, 10),
                     child: new Text(
                         data: toastItem.message,
                         style: CTextStyle.PLargeTitle.copyWith(color: toastItem.textColor)
                         )
                     )
                 )
             )
         );
     _isVisible = true;
     _overlayState.insert(entry: _overlayEntry);
     _timer = Window.instance.run((TimeSpan)toastItem.duration, callback: dismiss);
 }
Ejemplo n.º 2
0
 public static void show(CustomToastItem toastItem)
 {
     CustomToastView.dismiss();
     CustomToastView.createView(toastItem: toastItem);
 }