zeba_academy_navigation 1.0.0 copy "zeba_academy_navigation: ^1.0.0" to clipboard
zeba_academy_navigation: ^1.0.0 copied to clipboard

Advanced Flutter navigation package with type-safe routing, guards, deep linking and nested navigation.

example/lib/main.dart

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

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

class MyApp extends StatelessWidget {
  final router = ZebaRouter([
    ZebaRoute(
      path: '/',
      builder: (_) => const HomePage(),
    ),
    ZebaRoute(
      path: '/profile',
      builder: (_) => const ProfilePage(),
    ),
  ]);

  MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Zeba Academy Navigation Demo',
      theme: ThemeData(
        primarySwatch: Colors.deepPurple,
        scaffoldBackgroundColor: Colors.grey[100],
        elevatedButtonTheme: ElevatedButtonThemeData(
          style: ElevatedButton.styleFrom(
            backgroundColor: Colors.deepPurple,
            padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 14),
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(12),
            ),
            textStyle: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
          ),
        ),
        cardTheme: CardThemeData(
          elevation: 4,
          shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
          margin: const EdgeInsets.all(12),
        ),
      ),      onGenerateRoute: router.generateRoute,
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Home"),
        centerTitle: true,
        elevation: 0,
      ),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          children: [
            Card(
              child: ListTile(
                leading: const Icon(Icons.person, color: Colors.deepPurple),
                title: const Text("Welcome to Zeba Academy!"),
                subtitle: const Text("Explore navigation with type-safe routes."),
              ),
            ),
            const SizedBox(height: 20),
            ElevatedButton.icon(
              icon: const Icon(Icons.arrow_forward),
              label: const Text("Go to Profile",style: TextStyle(
                color: Colors.white
              ),),
              onPressed: () => Navigator.pushNamed(context, "/profile"),
            ),
            const SizedBox(height: 20),
            Expanded(
              child: Center(
                child: Icon(
                  Icons.flutter_dash,
                  color: Colors.deepPurple[200],
                  size: 150,
                ),
              ),
            ),          ],
        ),
      ),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("Profile"),
        centerTitle: true,
      ),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          children: [
            Card(
              child: ListTile(
                leading: const CircleAvatar(
                  backgroundColor: Colors.deepPurple,
                  child: Icon(Icons.person, color: Colors.white),
                ),
                title: const Text("John Doe"),
                subtitle: const Text("Flutter Developer"),
              ),
            ),
            const SizedBox(height: 20),
            ElevatedButton.icon(
              icon: const Icon(Icons.home),
              label: const Text("Back to Home",style: TextStyle(
                color: Colors.white
              ),),
              onPressed: () => Navigator.pushNamed(context, "/"),
            ),
            const SizedBox(height: 20),
            Expanded(
              child: Center(
                child: Icon(
                  Icons.account_circle,
                  color: Colors.deepPurple[200],
                  size: 150,
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
150
points
100
downloads
screenshot

Documentation

API reference

Publisher

verified publisherzeba.academy

Weekly Downloads

Advanced Flutter navigation package with type-safe routing, guards, deep linking and nested navigation.

Homepage

License

GPL-3.0 (license)

Dependencies

collection, flutter

More

Packages that depend on zeba_academy_navigation