alive_picker 1.0.4 copy "alive_picker: ^1.0.4" to clipboard
alive_picker: ^1.0.4 copied to clipboard

A beautiful, animated, and fully customizable date & time picker package for Flutter. Features stunning seasonal animations, smooth transitions, and multi-language support.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:alive_picker/alive_picker.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:google_fonts/google_fonts.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Alive Picker Example',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.purple),
        useMaterial3: true,
      ),
      // Add localization delegates
      localizationsDelegates: [
        AlivePickerLocalizations.delegate,
        GlobalMaterialLocalizations.delegate,
        GlobalWidgetsLocalizations.delegate,
        GlobalCupertinoLocalizations.delegate,
      ],
      supportedLocales: const [Locale('en'), Locale('ar'), Locale('fr')],
      home: const HomeDemoScreen(),
    );
  }
}

// Main Screen
class HomeDemoScreen extends StatelessWidget {
  const HomeDemoScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        decoration: const BoxDecoration(
          gradient: LinearGradient(
            begin: Alignment.topLeft,
            end: Alignment.bottomRight,
            colors: [Color(0xFFF8FAFC), Color(0xFFEFF6FF)],
          ),
        ),
        child: SafeArea(
          child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Padding(
                padding: const EdgeInsets.fromLTRB(28, 60, 28, 20),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      'Alive Picker Package Demos',
                      style: GoogleFonts.outfit(
                        fontSize: 36,
                        fontWeight: FontWeight.w700,
                        color: const Color(0xFF0F172A),
                        height: 1.1,
                      ),
                    ),
                    const SizedBox(height: 12),
                    Text(
                      'Explore our collection of interactive\ncomponents and animations.',
                      style: GoogleFonts.inter(
                        fontSize: 16,
                        height: 1.5,
                        color: const Color(0xFF64748B),
                      ),
                    ),
                  ],
                ),
              ),
              Expanded(
                child: GridView.count(
                  crossAxisCount: 2,
                  padding: const EdgeInsets.symmetric(
                    horizontal: 24,
                    vertical: 12,
                  ),
                  mainAxisSpacing: 20,
                  crossAxisSpacing: 20,
                  childAspectRatio: 0.85,
                  children: [
                    _DemoCard(
                      title: 'Seasonal',
                      subtitle: 'Weather & Characters',
                      icon: Icons.cloud_outlined,
                      color: const Color(0xFF3B82F6),
                      onTap: () {
                        showDialog(
                          context: context,
                          barrierColor: Colors.black.withOpacity(0.6),
                          builder: (context) => const SeasonalSelectionDialog(),
                        );
                      },
                    ),
                    _DemoCard(
                      title: 'Time Picker',
                      subtitle: 'Fluid Selection',
                      icon: Icons.access_time_rounded,
                      color: const Color(0xFFF59E0B),
                      onTap: () {
                        showDialog(
                          context: context,
                          barrierColor: Colors.black.withOpacity(0.6),
                          builder: (context) => AnimatedTimePickerDialog(
                            initialTime: TimeOfDay.now(),
                            onTimeSelected: (time) {},
                          ),
                        );
                      },
                    ),
                    _DemoCard(
                      title: 'Date Picker',
                      subtitle: '3-Step Flow',
                      icon: Icons.calendar_today_rounded,
                      color: const Color(0xFF10B981), // Emerald Green
                      onTap: () {
                        showDialog(
                          context: context,
                          barrierColor: Colors.black.withOpacity(0.6),
                          builder: (context) => ModernDatePicker(
                            onDateSelected: (date) {
                              ScaffoldMessenger.of(context).showSnackBar(
                                SnackBar(
                                  content: Text(
                                    'Selected Date: ${date.day}/${date.month}/${date.year}',
                                  ),
                                ),
                              );
                            },
                          ),
                        );
                      },
                    ),
                    _DemoCard(
                      title: 'Coming Soon',
                      subtitle: 'More Demos',
                      icon: Icons.construction_rounded,
                      color: const Color(0xFF94A3B8),
                      onTap: () {},
                      isDisabled: true,
                    ),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

class _DemoCard extends StatefulWidget {
  final String title;
  final String subtitle;
  final IconData icon;
  final Color color;
  final VoidCallback onTap;
  final bool isDisabled;

  const _DemoCard({
    Key? key,
    required this.title,
    required this.subtitle,
    required this.icon,
    required this.color,
    required this.onTap,
    this.isDisabled = false,
  }) : super(key: key);

  @override
  State<_DemoCard> createState() => _DemoCardState();
}

class _DemoCardState extends State<_DemoCard>
    with SingleTickerProviderStateMixin {
  late AnimationController _controller;
  late Animation<double> _scaleAnimation;

  @override
  void initState() {
    super.initState();
    _controller = AnimationController(
      duration: const Duration(milliseconds: 150),
      vsync: this,
    );
    _scaleAnimation = Tween<double>(
      begin: 1.0,
      end: 0.95,
    ).animate(CurvedAnimation(parent: _controller, curve: Curves.easeInOut));
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    final opacity = widget.isDisabled ? 0.6 : 1.0;

    return GestureDetector(
      onTapDown: widget.isDisabled ? null : (_) => _controller.forward(),
      onTapUp: widget.isDisabled
          ? null
          : (_) {
              _controller.reverse();
              widget.onTap();
            },
      onTapCancel: widget.isDisabled ? null : () => _controller.reverse(),
      child: AnimatedBuilder(
        animation: _controller,
        builder: (context, child) {
          return Transform.scale(scale: _scaleAnimation.value, child: child);
        },
        child: Opacity(
          opacity: opacity,
          child: Container(
            decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.circular(28),
              boxShadow: [
                BoxShadow(
                  color: widget.color.withOpacity(0.12),
                  blurRadius: 24,
                  offset: const Offset(0, 12),
                  spreadRadius: 0,
                ),
                BoxShadow(
                  color: Colors.black.withOpacity(0.01),
                  blurRadius: 4,
                  offset: const Offset(0, 2),
                ),
              ],
            ),
            padding: const EdgeInsets.all(24),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Container(
                  padding: const EdgeInsets.all(14),
                  decoration: BoxDecoration(
                    color: widget.color.withOpacity(0.1),
                    borderRadius: BorderRadius.circular(20),
                  ),
                  child: Icon(widget.icon, color: widget.color, size: 30),
                ),
                const Spacer(),
                Text(
                  widget.title,
                  style: GoogleFonts.outfit(
                    fontSize: 20,
                    fontWeight: FontWeight.w600,
                    color: const Color(0xFF1E293B),
                    height: 1.2,
                  ),
                ),
                const SizedBox(height: 6),
                Text(
                  widget.subtitle,
                  style: GoogleFonts.inter(
                    fontSize: 14,
                    fontWeight: FontWeight.w500,
                    color: const Color(0xFF94A3B8),
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
4
likes
0
points
148
downloads

Publisher

unverified uploader

Weekly Downloads

A beautiful, animated, and fully customizable date & time picker package for Flutter. Features stunning seasonal animations, smooth transitions, and multi-language support.

Repository (GitHub)
View/report issues

Topics

#date-picker #time-picker #widget #ui #animations

License

unknown (license)

Dependencies

flutter, flutter_localizations, google_fonts, intl

More

Packages that depend on alive_picker