as_route_transitions 0.0.7 copy "as_route_transitions: ^0.0.7" to clipboard
as_route_transitions: ^0.0.7 copied to clipboard

This package helps to handle transitions between screens easily.

example/main.dart

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

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Material App',
      initialRoute: 'pageone',
      routes: {
        'pageone': (_) => const PageOne(),
        'pagetwo': (_) => const PageTwo(),
      },
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Page one'),
        backgroundColor: Colors.transparent,
      ),
      backgroundColor: Colors.blue,
      body: Center(
        child: MaterialButton(
          color: Colors.white,
          child: const Text('Go to Page Two'),
          onPressed: () {
            RouteTransitions(
              context: context,
              child: const PageTwo(),
              animation: AnimationType.rotateIn,
              duration: const Duration(milliseconds: 600),
              reverseDuration: const Duration(milliseconds: 600),
              alignment: Alignment.center,
              replacement: true,
              curve: Curves.easeInOutBack,
            );
          },
        ),
      ),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Page Two'),
        centerTitle: true,
        backgroundColor: Colors.transparent,
      ),
      backgroundColor: Colors.blueGrey,
      body: const Center(
        child: Text('Page Two'),
      ),
    );
  }
}
1
likes
160
points
49
downloads

Publisher

verified publisherahunki.com

Weekly Downloads

This package helps to handle transitions between screens easily.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on as_route_transitions