Skip to main content

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

Modal bottom sheets and dialogs with their own internal navigation stack, animated transitions and a height that adapts to the visible page.

example/lib/main.dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:tn_bottom_sheet_navigator/tn_bottom_sheet_navigator.dart';

import 'bottom_sheet_pages/forgot_password_page.dart';
import 'bottom_sheet_pages/signin_page.dart';
import 'bottom_sheet_pages/signup_page.dart';

final authRoutes = [
  TnRoute(
    path: 'forgot-password',
    builder: (context, email) => ForgotPasswordPage(email: email as String),
  ),
  TnRoute(path: 'signin', builder: (_, __) => SignInPage()),
  TnRoute(path: 'signup', builder: (_, __) => const SignUpPage()),
];

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'TnBottomSheetNavigator Sample',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
        useMaterial3: true,
      ),
      home: const AppContent(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('TnBottomSheetNavigator')),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            ElevatedButton(
              child: const Text('Open Bottom Sheet Navigator'),
              onPressed: () => showTnBottomSheet<void>(
                context: context,
                routes: authRoutes,
                initialRoute: 'signin',
                showDragHandle: true,
              ),
            ),
            const SizedBox(height: 20),
            const Text('Custom Implementations',
                style: TextStyle(fontSize: 20)),
            const SizedBox(height: 20),
            ElevatedButton(
              child: const Text('Cupertino Dialog'),
              onPressed: () => showCupertinoDialog(
                context: context,
                builder: (context) => CupertinoAlertDialog(
                  content: Material(
                    // Avoids an odd background on the dialog
                    color: Colors.transparent,
                    child: TnNavigator(
                      routes: authRoutes,
                      initialRoute: 'signin',
                    ),
                  ),
                ),
              ),
            ),
            const SizedBox(height: 20),
            ElevatedButton(
              child: const Text('Dialog'),
              onPressed: () => showDialog(
                context: context,
                builder: (context) => AlertDialog(
                  content: Material(
                    color: Colors.transparent,
                    child: TnNavigator(
                      routes: authRoutes,
                      initialRoute: 'signin',
                    ),
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
7
likes
150
points
52
downloads

Documentation

API reference

Publisher

verified publisherturneat.com.mx

Weekly Downloads

Modal bottom sheets and dialogs with their own internal navigation stack, animated transitions and a height that adapts to the visible page.

Repository (GitHub)
View/report issues

Funding

Consider supporting this project:

buymeacoffee.com

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on tn_bottom_sheet_navigator