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

PlatformAndroid

Detect Android navigation mode (gesture, 2-button, 3-button) and navigation bar height.

example/lib/main.dart

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

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

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

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  NavigationModeInfo? _mode;

  @override
  void initState() {
    super.initState();
    loadNavigationMode();
  }

  Future<void> loadNavigationMode() async {
    try {
      final mode = await FlutterNavigationMode.getNavigationMode();

      if (!mounted) return;

      setState(() {
        _mode = mode;
      });
    } catch (e) {
      debugPrint("Error: $e");
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Navigation Mode Example')),
        body: Center(
          child: _mode == null
              ? const CircularProgressIndicator()
              : Column(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: [
                    Text("Type: ${_mode!.type}"),
                    Text("Is Gesture: ${_mode!.isGestureNavigation}"),
                    Text("Height: ${_mode!.navigationBarHeight}"),
                    Text("Interaction Mode: ${_mode!.interactionMode}"),
                  ],
                ),
        ),
      ),
    );
  }
}
2
likes
150
points
141
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Detect Android navigation mode (gesture, 2-button, 3-button) and navigation bar height.

Repository (GitHub)
View/report issues

Topics

#android #navigation #system-ui #gesture

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_navigation_mode

Packages that implement flutter_navigation_mode