aptof_core 0.1.0-beta.1
aptof_core: ^0.1.0-beta.1 copied to clipboard
A Very Good Project created by Very Good CLI.
To Use utility: #
import 'package/aptof_core/utility.dart'
To use 'ui' #
import 'package/aptof_core/ui.dart'
To use auth, please follow the steps (guide for app created using very good cli) #
- In your MaterialApp (lib/app/view/app.dart in _AppView widget)
import 'package/aptof_core/l10n/l10n.dart';
...
localizationsDelegates: const [
...AppLocalizations.localizationsDelegates,
...AptofLocalizations.localizationsDelegates,
],
supportedLocales: {
...AppLocalizations.supportedLocales,
...AptofLocalizations.supportedLocales,
}.toList(),
...
Here AppLocalizations is your main app localization
- In your App widget class (lib/app/view/app.dart)
@override
Widget build(BuildContext context) {
return MultiProvider(
providers: [
Provider.value(value: FirebaseAuth.instance),
Provider(
create: (context) => AuthRepository(firebaseAuth: context.read()),
dispose: (_, provider) => provider.dispose(),
),
],
child: const _AppView(),
);
}
- Create a class named
AppRouterlike below
class AppRouter extends AptofRouter {
AppRouter(super.authRepository);
@override
List<StatefulShellBranch> branches() {
return [
StatefulShellBranch(
routes: [
GoRoute(
path: Routes.home,
builder: (context, state) => const HomeView(),
),
],
),
StatefulShellBranch(
routes: [
GoRoute(
path: '/home2',
builder: (context, state) => const PlaceholderView(title: 'Home 2'),
),
],
),
StatefulShellBranch(
routes: [
GoRoute(
path: '/home3',
builder: (context, state) => const PlaceholderView(title: 'Home 3'),
),
],
),
];
}
@override
List<NavigationDestination> destinations(BuildContext context) {
return [
const NavigationDestination(
icon: Icon(Icons.home),
label: 'Home',
),
const NavigationDestination(
icon: Icon(Icons.home),
label: 'Home',
),
const NavigationDestination(
icon: Icon(Icons.home),
label: 'Home',
),
];
}
}
- Setup firebase then In your app.dart
class App extends StatelessWidget {
const App({super.key});
@override
Widget build(BuildContext context) {
return MultiProvider(
providers: [
Provider.value(value: FirebaseAuth.instance),
Provider(
create: (context) => AuthRepository(firebaseAuth: context.read()),
dispose: (_, provider) => provider.dispose(),
),
],
child: const _AppView(),
);
}
}
class _AppView extends StatelessWidget {
const _AppView();
@override
Widget build(BuildContext context) {
final router = AppRouter(context.read());
return MaterialApp.router(
theme: AppTheme.light,
darkTheme: AppTheme.dark,
localizationsDelegates: const [
...AppLocalizations.localizationsDelegates,
...AptofLocalizations.localizationsDelegates,
],
supportedLocales: {
...AppLocalizations.supportedLocales,
...AptofLocalizations.supportedLocales,
}.toList(),
routerConfig: router.createRouter(),
);
}
}