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

outdated

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:example/example_page.dart';
import 'package:flutter/material.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(),
          AnimatedSwitcherFlip.flipY(
            duration: const Duration(milliseconds: 500),
            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
0
points
563
downloads

Publisher

verified publisherappgozar.com

Weekly Downloads

Prebuilt transitions for AnimatedSwitcher such as flip, zoom and translation

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on animated_switcher_plus