navme

Last updated:

0 purchases

navme Image
navme Images
Add to Cart

Description:

navme

navme by zfx.com #

A simple way to use Navigation 2.0 like Navigator 1.0 and simple config for each page
Navigation with focus on support web URL.
live demo: https://zfx-com.github.io/navme/
Import #
navme: 1.0.1
copied to clipboard
import 'package:navme/navme.dart';
import 'package:navme/helpers.dart';
copied to clipboard
Example use #
Example config for page:
class BooksListNavigate {
// base path
static String path = 'book';

// config for configurate Router
static RouteConfig routeConfig = RouteConfig(
state: (Uri uri) => RouteState(uri: path.toUri()),
// condition for using this page
isThisPage: (RouteState state) {
if (state?.firstPath == path) {
return true;
}
return false;
},
// settigs from url
settings: (RouteState state) {
return null;
},
// get Page for Router
page: ({RouteState state}) {
return MaterialPage(
key: const ValueKey('BooksListPage'),
child: BooksListScreen.all(),
name: 'BooksListScreen');
},
);
}
copied to clipboard
Implementation BaseRouterDelegate for your configuration
class NavmeRouterDelegate extends BaseRouterDelegate {
NavmeRouterDelegate(
{@required RouteConfig initialRoute,
@required List<RouteConfig> routes,
@required RouteConfig onUnknownRoute,
String nestedPrefixPath,
String debugLabel})
: super(
initialRoute: initialRoute,
routes: routes,
onUnknownRoute: onUnknownRoute,
nestedPrefixPath: nestedPrefixPath,
debugLabel: debugLabel,
);

factory NavmeRouterDelegate.main() {
return NavmeRouterDelegate(
initialRoute: HomeNavigate.routeConfig,
routes: [
HomeNavigate.routeConfig,
BookDetailsNavigate.routeConfig,
BooksListNavigate.routeConfig,
FadeNavigate.routeConfig,
NestedNavigate.routeConfig,
],
onUnknownRoute: UnknownNavigate.routeConfig,
debugLabel: 'main',
);
}


copied to clipboard
use Router:
final NavmeRouterDelegate _routerDelegate = NavmeRouterDelegate.main();
final StateRouteInformationParser _stateRouteInformation =
StateRouteInformationParser();

@override
Widget build(BuildContext context) {
return MaterialApp.router(
routerDelegate: _routerDelegate,
routeInformationParser: _stateRouteInformation,
);
}
copied to clipboard
Navigate to the new detail book page
NavmeRouterDelegate.of(context)
?.push(BookDetailsNavigate.getUri(book));
copied to clipboard
Todo: #

return url
nested url
open dialog

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.