Skip to content

laurensk/platform_navigation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flutter Platform Navigation

Version Documentation Maintenance

This library allows you to implement navigation for iOS, Android and Web with ease! It is easy to use and intended to get started quickly. Please have a look at the example below.

Example

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    if (kIsWeb) return getMaterialApp();
    if (Platform.isIOS)
      return getCupertinoApp();
    else
      return getMaterialApp();
  }

  getMaterialApp() {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Platform Navigation',
      theme: ThemeData(brightness: Brightness.light, backgroundColor: Colors.white, accentColor: Colors.black),
      darkTheme: ThemeData(brightness: Brightness.dark, backgroundColor: Colors.black, accentColor: Colors.white),
      home: getNavigation(),
    );
  }

  getCupertinoApp() {
    return CupertinoApp(
      debugShowCheckedModeBanner: false,
      home: getNavigation(),
      theme: CupertinoThemeData(),
      title: 'Platform Navigation',
    );
  }

  getNavigation() {
    return PlatformNavigation(title: "My App", screens: [
      PlatformScreen(
          title: "Home",
          child: Container(color: Colors.white, child: Center(child: Text("Welcome at Home!"))),
          materialIcon: Icons.home,
          cupertinoIcon: CupertinoIcons.home),
      PlatformScreen(
          title: "Settings",
          child: Center(child: Text("This is the settings screen.")),
          materialIcon: Icons.settings,
          cupertinoIcon: CupertinoIcons.settings),
      PlatformScreen(
          title: "About",
          child: Center(child: Text("About this app!")),
          materialIcon: Icons.info,
          cupertinoIcon: CupertinoIcons.info)
    ]);
  }
}

Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ on GitHub if this project helped you!

License

Copyright © Laurens Kropf.
This project is MIT licensed.