routerino 0.1.0 copy "routerino: ^0.1.0" to clipboard
routerino: ^0.1.0 copied to clipboard

outdated

Add names to routes without a declarative pattern and without build_runner

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Example',
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: [
            const Text('Home Page'),
            ElevatedButton(
              onPressed: () {
                context.push(() => LoginPage());
              },
              child: Text('Login'),
            ),
            ElevatedButton(
              onPressed: () {
                context.pushBottomSheet(() => NamedRoutesBottomSheet(
                      title: 'My Title',
                      backgroundColor: Colors.green,
                      child: Column(
                        children: [
                          Text('Hello World 1'),
                          Text('Hello World 2'),
                          Text('Hello World 3'),
                        ],
                      ),
                    ));
              },
              child: Text('Open Bottom Sheet'),
            ),
          ],
        ),
      ),
    );
  }
}

class LoginPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        children: [
          const Text('Login Page'),
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceEvenly,
            children: [
              ElevatedButton(
                onPressed: () {
                  context.popUntilRoot();
                },
                child: Text('Back to home page'),
              ),
              ElevatedButton(
                onPressed: () {
                  context.push(() => RegisterPage());
                },
                child: Text('Register'),
              ),
            ],
          ),
        ],
      ),
    );
  }
}

class RegisterPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: [
            const Text('Register Page'),
            ElevatedButton(
              onPressed: () {
                context.popUntilRoot();
              },
              child: Text('Back to home page'),
            ),
          ],
        ),
      ),
    );
  }
}
19
likes
0
points
1.01k
downloads

Publisher

verified publishertienisto.com

Weekly Downloads

Add names to routes without a declarative pattern and without build_runner

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on routerino