animated_switcher_plus 1.1.0 copy "animated_switcher_plus: ^1.1.0" to clipboard
animated_switcher_plus: ^1.1.0 copied to clipboard

Prebuilt transitions for AnimatedSwitcher such as flip, zoom and translation

example/lib/main.dart

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

import 'example_page.dart';

void main() => runApp(const App());

class App extends StatelessWidget {
  const App({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'AnimatedSwitcher Plus demo',
      theme: ThemeData(primarySwatch: Colors.teal),
      home: const ExamplePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

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

class _HomePageState extends State<HomePage> {
  bool _showFirstChild = true;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Sample')),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.center,
        children: [
          const Spacer(),
          AnimatedSwitcherPlus.flipY(
            duration: const Duration(milliseconds: 1000),
            child: Container(
              key: ValueKey(_showFirstChild),
              padding: const EdgeInsets.all(5),
              decoration: BoxDecoration(
                color:
                    _showFirstChild ? Colors.blue.shade50 : Colors.red.shade50,
                borderRadius: const BorderRadius.all(Radius.circular(5)),
              ),
              child: Text(
                _showFirstChild ? 'Primary Text' : 'Secondary Text',
              ),
            ),
          ),
          const Spacer(),
          Center(
            child: ElevatedButton(
              onPressed: () => setState(() {
                _showFirstChild = !_showFirstChild;
              }),
              child: const Text('Animate'),
            ),
          ),
        ],
      ),
    );
  }
}
39
likes
160
points
578
downloads

Publisher

verified publisherappgozar.com

Weekly Downloads

Prebuilt transitions for AnimatedSwitcher such as flip, zoom and translation

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on animated_switcher_plus