mb_route_transitions 0.1.1 copy "mb_route_transitions: ^0.1.1" to clipboard
mb_route_transitions: ^0.1.1 copied to clipboard

A Flutter package that allows developers to easily navigate between pages.

example/main.dart

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

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

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'MB Route Transitions',
      initialRoute: 'page1',
      routes: {
        'page1':(context) => Page1(),
        'page2':(context) => Page2(),
      },
      home: Page1(),
    );
  }
}

class Page1 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Page 1"),
        backgroundColor: Colors.transparent,
      ),
      backgroundColor: Colors.blue,
      body: Center(
        child: MaterialButton(
          color: Colors.white,
          onPressed: () {
            //Navigator.push(context, CupertinoPageRoute(builder: ((context) => Page2())));

            MBRouteTransitions(
              context: context,
              child: Page2(), 
              animation: AnimationType.fadeIn,
              replacement: false,
              duration: const Duration(seconds: 1),
              curve: Curves.bounceIn,
              fadeBegin: 0,
              fadeEnd: 1,
            );
          },
          child: const Text("Go to page 2"),
        ),
      ),
    );
  }
}

class Page2 extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Page 2"),
        backgroundColor: Colors.transparent,
      ),
      backgroundColor: Colors.amber,
      body: const Center(
        child: Text('page 2'),
     ),
   );
  }
}
1
likes
150
points
21
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package that allows developers to easily navigate between pages.

Homepage

Documentation

API reference

License

unknown (license)

Dependencies

flutter

More

Packages that depend on mb_route_transitions