Skip to content

Commit

Permalink
Using GoRouter
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoazvd17 committed Nov 30, 2023
1 parent 6fe06fc commit 96815a6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:eduardoazevedo/src/features/home/presentation/controllers/home_controller.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';

import 'src/core/utils/app_constants.dart';
import 'src/core/utils/app_themes.dart';
Expand All @@ -12,17 +13,22 @@ class MyApp extends StatelessWidget {

@override
Widget build(BuildContext context) {
return MaterialApp(
return MaterialApp.router(
debugShowCheckedModeBanner: false,
title: 'Eduardo Azevedo',
localizationsDelegates: AppConstants.localizationsDelegates,
supportedLocales: AppConstants.supportedLocales,
theme: AppThemes.light,
darkTheme: AppThemes.dark,
initialRoute: HomePage.route,
routes: {
HomePage.route: (_) => HomePage(controller: HomeController()),
},
routerConfig: GoRouter(
routes: [
GoRoute(
name: HomePage.route,
path: HomePage.route,
builder: (context, state) => HomePage(controller: HomeController()),
),
],
),
);
}
}
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.2"
go_router:
dependency: "direct main"
description:
name: go_router
sha256: c247a4f76071c3b97bb5ae8912968870d5565644801c5e09f3bc961b4d874895
url: "https://pub.dev"
source: hosted
version: "12.1.1"
google_nav_bar:
dependency: "direct main"
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dependencies:
flutter_mobx: ^2.2.0
mobx: ^2.2.1
google_nav_bar: ^5.0.6
go_router: ^12.1.1

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 96815a6

Please sign in to comment.