smart_popup 2.0.1 copy "smart_popup: ^2.0.1" to clipboard
smart_popup: ^2.0.1 copied to clipboard

A versatile Flutter alert dialog with videos, images, animations, countdown timer, and Loading state for buttons etc.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:smart_popup/smart_popup.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Smart Popup Demo',
      theme: ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true),
      home: const CustomAlertPopupExample(),
    );
  }
}

class CustomAlertPopupExample extends StatelessWidget {
  const CustomAlertPopupExample({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: Container(
        height: MediaQuery.of(context).size.height,
        width: MediaQuery.of(context).size.width,
        decoration: const BoxDecoration(color: Colors.white, image: DecorationImage(image: AssetImage("assets/images/bg_image.png"), fit: BoxFit.fill)),
        child: Center(
          child: ElevatedButton(
            onPressed: () {
              showDialog(
                context: context,
                builder: (context) => SmartPopup(
                  title: "Smart Popup",
                  subTitle: "This is a smart popup. It can display alerts and messages",
                  firstButtonText: "Ok",
                  secondButtonText: "Cancel",
                  firstButtonTap: () {
                    Navigator.of(context).pop();
                  },
                  secondButtonTap: () {
                    Navigator.of(context).pop();
                  },
                  // Do not pass image and video path 5simultaneously; pass one at a time.
                  imagePath: "assets/images/demo_image.png",
                  // videoPath: "assets/videos/demo_video.mp4",
                  // videoVolume: 100,
                  // videoPlayBackSpeed: 2.5,
                  // hideFirstButton: true,
                  // showCloseButton: false,
                  // showButtons: false,
                ),
              );
            },
            child: const Text("Tap Here"),
          ),
        ),
      ),
    );
  }
}
17
likes
0
points
186
downloads

Publisher

verified publisherfazilkp.in

Weekly Downloads

A versatile Flutter alert dialog with videos, images, animations, countdown timer, and Loading state for buttons etc.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_animate, flutter_hooks, flutter_timer_countdown, video_player, video_player_win

More

Packages that depend on smart_popup