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

A versatile Flutter alert dialog with lotties, images, animations, countdown timer, Loading and open duration 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 SmartPopupExample(),
    );
  }
}

class SmartPopupExample extends StatelessWidget {
  const SmartPopupExample({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(
                  buttonAlignment: ButtonAlignment.vertical,
                  title: "Smart Popup",
                  subTitle: "This is a smart popup. It can display alerts and messages",
                  primaryButtonText: "Ok",
                  secondaryButtonText: "Cancel",
                  primaryButtonTap: () {
                    Navigator.of(context).pop();
                  },
                  secondaryButtonTap: () {
                    Navigator.of(context).pop();
                  },
                  // loading: true,
                  // popType: PopType.info,
                  imagePath: "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS-C_UAhXq9GfuGO452EEzfbKnh1viQB9EDBQ&s",

                  // openDuration: Duration(seconds: 2),
                  // showButtons: false,
                  // timerDelay: 5,
                  // lottiePath: "assets/lottie/info.json",
                  // 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 lotties, images, animations, countdown timer, Loading and open duration state for buttons etc.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_animate, flutter_hooks, flutter_timer_countdown, lottie, smart_wrap

More

Packages that depend on smart_popup