island_msg 0.0.1 copy "island_msg: ^0.0.1" to clipboard
island_msg: ^0.0.1 copied to clipboard

A minimalist, beautiful Dynamic Island notification system for Flutter apps. Simple, springy, and premium.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Island Msg Demo',
      theme: ThemeData(
        useMaterial3: true,
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        scaffoldBackgroundColor: const Color(0xFFF2F2F7), // iOS-like gray
      ),
      home: const DemoPage(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Island Msg"),
        backgroundColor: Colors.transparent,
        elevation: 0,
      ),
      body: Center(
        child: SingleChildScrollView(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              const Text(
                "Tap to test notifications",
                style: TextStyle(fontSize: 16, color: Colors.grey),
              ),
              const SizedBox(height: 30),

              // Success
              _Button(
                color: Colors.green,
                label: "Success",
                onTap: () => IslandMsg.success(context, "AirPods Connected"),
              ),

              // Error
              _Button(
                color: Colors.red,
                label: "Error",
                onTap: () => IslandMsg.error(context, "Face ID Failed"),
              ),

              // Info
              _Button(
                color: Colors.blue,
                label: "Info",
                onTap: () => IslandMsg.info(context, "Silent Mode On"),
              ),

              // Custom with Expansion
              _Button(
                color: Colors.black,
                label: "Music (Hold to Expand)",
                onTap: () {
                  IslandMsg.show(
                    context,
                    duration: const Duration(seconds: 4),
                    content: const Row(
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        Text(
                          "Music Playing",
                          style: TextStyle(fontWeight: FontWeight.bold),
                        ),
                        SizedBox(width: 8),
                        Icon(
                          Icons.graphic_eq,
                          color: Colors.pinkAccent,
                          size: 16,
                        ),
                      ],
                    ),
                    icon: const Icon(
                      Icons.music_note,
                      color: Colors.pinkAccent,
                    ),
                    expandedContent: Column(
                      mainAxisSize: MainAxisSize.min,
                      children: [
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            const Row(
                              children: [
                                Icon(
                                  Icons.music_note,
                                  color: Colors.pinkAccent,
                                ),
                                SizedBox(width: 10),
                                Text(
                                  "Starboy",
                                  style: TextStyle(
                                    fontSize: 18,
                                    fontWeight: FontWeight.bold,
                                  ),
                                ),
                              ],
                            ),
                            Icon(Icons.graphic_eq, color: Colors.pinkAccent),
                          ],
                        ),
                        const SizedBox(height: 16),
                        const Text(
                          "The Weeknd • Daft Punk",
                          style: TextStyle(color: Colors.grey),
                        ),
                        const SizedBox(height: 16),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
                          children: [
                            IconButton(
                              icon: const Icon(
                                Icons.skip_previous,
                                color: Colors.white,
                              ),
                              onPressed: () {},
                            ),
                            IconButton(
                              icon: const Icon(
                                Icons.pause_circle_filled,
                                size: 40,
                                color: Colors.white,
                              ),
                              onPressed: () {},
                            ),
                            IconButton(
                              icon: const Icon(
                                Icons.skip_next,
                                color: Colors.white,
                              ),
                              onPressed: () {},
                            ),
                          ],
                        ),
                      ],
                    ),
                  );
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}

class _Button extends StatelessWidget {
  final Color color;
  final String label;
  final VoidCallback onTap;

  const _Button({
    required this.color,
    required this.label,
    required this.onTap,
  });

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 20),
      child: SizedBox(
        width: double.infinity,
        height: 55,
        child: ElevatedButton(
          style: ElevatedButton.styleFrom(
            backgroundColor: color,
            foregroundColor: Colors.white,
            elevation: 0,
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(16),
            ),
          ),
          onPressed: onTap,
          child: Text(
            label,
            style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
          ),
        ),
      ),
    );
  }
}
1
likes
150
points
107
downloads

Publisher

unverified uploader

Weekly Downloads

A minimalist, beautiful Dynamic Island notification system for Flutter apps. Simple, springy, and premium.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on island_msg