custom_page_route 0.0.3
custom_page_route: ^0.0.3 copied to clipboard

A cutom page transition left to right, bottom to top and add your own Route Navigation Transitions in Flutter..

example/lib/main.dart

import 'package:custom_page_route/custom_page_route.dart';
import 'package:example/page1.dart';
import 'package:example/page2.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Home(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("Animated Page Route"),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              MaterialButton(
                color: Theme.of(context).primaryColor,
                onPressed: () {
                  Navigator.push(
                    context,
                    CustomPageRoute(
                      axisDirection: AxisDirection.left,
                      child: Page1(),
                    ),
                  );
                },
                child: Text("Go to Page 1"),
              ),
              const SizedBox(height: 20),
              MaterialButton(
                color: Theme.of(context).primaryColor,
                onPressed: () {
                  Navigator.push(
                    context,
                    CustomPageRoute(
                      transitionDuration: Duration(seconds: 5),
                      reverseTransitionDuration: Duration(seconds: 5),
                      axisDirection: AxisDirection.up,
                      child: Page2(),
                    ),
                  );
                },
                child: Text("Go to Page 2"),
              ),
              const SizedBox(height: 20),
              MaterialButton(
                color: Theme.of(context).primaryColor,
                onPressed: () {
                  Navigator.push(
                    context,
                    CustomPageRoute(
                      transitionDuration: Duration(seconds: 5),
                      reverseTransitionDuration: Duration(seconds: 5),
                      axisDirection: AxisDirection.down,
                      child: Page2(),
                    ),
                  );
                },
                child: Text("Go to Page 3"),
              ),
              const SizedBox(height: 20),
              MaterialButton(
                color: Theme.of(context).primaryColor,
                onPressed: () {
                  Navigator.push(
                    context,
                    CustomPageRoute(
                      transitionDuration: Duration(seconds: 5),
                      reverseTransitionDuration: Duration(seconds: 5),
                      axisDirection: AxisDirection.right,
                      child: Page2(),
                    ),
                  );
                },
                child: Text("Go to Page 4"),
              ),
            ],
          ),
        ));
  }
}
3
likes
130
pub points
41%
popularity

Publisher

shibu.dev

A cutom page transition left to right, bottom to top and add your own Route Navigation Transitions in Flutter..

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on custom_page_route