app_features 0.5.0 app_features: ^0.5.0 copied to clipboard
This package help you to Organize folders Structure by feature scope.
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
- 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,
);
}
}
New Feature #
to create new feature you need to:
- feature class
- feature page as view
lets create Auth feature example:
- create new folder
auth
infeatures
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(), ), ] }
- Register new feature to
AppFeatures
config:void main() { AppFeatures.config( features: [ SplashFeature(), AuthFeature() ], ); runApp(const MyApp()); }
- 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();