Last updated:
0 purchases
app features
Feature By Feature #
This package help you to Organize folders Structure by feature scope. package in development
Features #
Feature scope routes and dependents.
Manage Routes by go_router.
Handle dialog and bottom sheet by routes.
Handle Snack Bar by ScaffoldMessenger.
Overlay Support.
Getting started #
Install package:
flutter pub add app_features
copied to clipboard
Config routes:
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp.router(
title: 'App Features Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
routerConfig: AppFeatures.router,
);
}
}
copied to clipboard
New Feature #
to create new feature you need to:
feature class
feature page as view
lets create Auth feature example:
create new folder auth in features folder.
create login_page.dart file as login view page.
create new class file name auth_feaure.dart:
import 'package:app_features/app_features.dart';
class AuthFeature extends Feature {
@override
String get name => '/login';
@override
List<GoRoute> get routes => [
GoRoute(
path: name,
name: name,
builder: (_, __) => const LoginPage(),
),
]
}
copied to clipboard
Register new feature to AppFeatures config:
void main() {
AppFeatures.config(
features: [
SplashFeature(),
AuthFeature()
],
);
runApp(const MyApp());
}
copied to clipboard
Navigate to AuthFeature:
// push to feature
AppFeatures.get<AuthFeature>().push();
// or go to feature
AppFeatures.get<AuthFeature>().go();
// or repleace feature
AppFeatures.get<AuthFeature>().replace();
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.