animated_splash_themes 1.1.4 copy "animated_splash_themes: ^1.1.4" to clipboard
animated_splash_themes: ^1.1.4 copied to clipboard

Animated Flutter splash screens with 5 built-in styles (Particles, Neon, Grid, Bounce, Expand): random selection, custom colors, configurable duration.

example/lib/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      title: 'animated_splash_themes example',
      debugShowCheckedModeBanner: false,
      home: AnimatedSplashScreen(
        appName: 'My App',
        appSubtitle: 'POWERED BY AI',
        iconPath: 'assets/images/icon.png',
        theme: SplashStyle.random,
        nextScreen: _HomePage(),
      ),
    );
  }
}

class _HomePage extends StatefulWidget {
  const _HomePage();

  @override
  State<_HomePage> createState() => _HomePageState();
}

class _HomePageState extends State<_HomePage> {
  double _durationSeconds = 2.5;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('animated_splash_themes')),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            _DurationSlider(
              value: _durationSeconds,
              onChanged: (v) => setState(() => _durationSeconds = v),
            ),
            const SizedBox(height: 16),
            ...SplashStyle.values
                .where((s) => s != SplashStyle.random)
                .map((style) => Padding(
                      padding: const EdgeInsets.symmetric(vertical: 6),
                      child: ElevatedButton(
                        onPressed: () => _launch(context, style),
                        child: Text('Style: ${style.name}'),
                      ),
                    )),
            Padding(
              padding: const EdgeInsets.symmetric(vertical: 6),
              child: OutlinedButton(
                onPressed: () => _launch(context, SplashStyle.random),
                child: const Text('Style: random'),
              ),
            ),
          ],
        ),
      ),
    );
  }

  void _launch(BuildContext context, SplashStyle style) {
    Navigator.of(context).push(MaterialPageRoute(
      builder: (_) => AnimatedSplashScreen(
        appName: 'My App',
        appSubtitle: style.name.toUpperCase(),
        iconPath: 'assets/images/icon.png',
        theme: style,
        duration: Duration(milliseconds: (_durationSeconds * 1000).round()),
        nextScreen: const _HomePage(),
      ),
    ));
  }
}

class _DurationSlider extends StatelessWidget {
  final double value;
  final ValueChanged<double> onChanged;

  const _DurationSlider({required this.value, required this.onChanged});

  @override
  Widget build(BuildContext context) {
    return Padding(
      padding: const EdgeInsets.symmetric(horizontal: 24),
      child: Column(
        children: [
          Text(
            '表示時間: ${value.toStringAsFixed(1)}s',
            style: Theme.of(context).textTheme.titleSmall,
          ),
          Slider(
            value: value,
            min: 1.0,
            max: 6.0,
            divisions: 10,
            label: '${value.toStringAsFixed(1)}s',
            onChanged: onChanged,
          ),
        ],
      ),
    );
  }
}
2
likes
160
points
428
downloads

Documentation

API reference

Publisher

verified publisherwarashibetech.com

Weekly Downloads

Animated Flutter splash screens with 5 built-in styles (Particles, Neon, Grid, Bounce, Expand): random selection, custom colors, configurable duration.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

flutter

More

Packages that depend on animated_splash_themes