diff --git a/.gitignore b/.gitignore index d3e079c..763fc2d 100644 --- a/.gitignore +++ b/.gitignore @@ -47,4 +47,9 @@ app.*.map.json /android/app/release # Environment -.env.local \ No newline at end of file +.env.local + +# Generated files +lib/**/*.g.dart +lib/**/*.gr.dart +lib/**/*.freezed.dart \ No newline at end of file diff --git a/lib/app.dart b/lib/app.dart index fc7321a..9853e9a 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -1,14 +1,16 @@ import 'package:flutter/material.dart'; +import 'package:flutter_supabase_complete/core/routes/app_router.dart'; /// Entry widget of the app class App extends StatelessWidget { - const App({Key? key}) : super(key: key); + App({Key? key}) : super(key: key); + final _appRouter = AppRouter(); @override Widget build(BuildContext context) { - return const MaterialApp( - title: 'Flutter Supabase Complete', - home: Placeholder(), + return MaterialApp.router( + routerDelegate: _appRouter.delegate(), + routeInformationParser: _appRouter.defaultRouteParser(), ); } } diff --git a/lib/app/home_page.dart b/lib/app/home_page.dart new file mode 100644 index 0000000..70e6a7b --- /dev/null +++ b/lib/app/home_page.dart @@ -0,0 +1,12 @@ +import 'package:flutter/material.dart'; + +class HomePage extends StatelessWidget { + const HomePage({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return const Scaffold( + body: Placeholder(), + ); + } +} diff --git a/lib/core/routes/app_router.dart b/lib/core/routes/app_router.dart new file mode 100644 index 0000000..3cf5a21 --- /dev/null +++ b/lib/core/routes/app_router.dart @@ -0,0 +1,14 @@ +/// Make sure to import `auto_route` and `material` (required) +import 'package:auto_route/auto_route.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_supabase_complete/app/home_page.dart'; + +part 'app_router.gr.dart'; + +@MaterialAutoRouter( + replaceInRouteName: 'Page,Route', + routes: [ + AutoRoute(page: HomePage, initial: true), + ], +) +class AppRouter extends _$AppRouter {} diff --git a/lib/main_common.dart b/lib/main_common.dart index 7465fe2..30adc17 100644 --- a/lib/main_common.dart +++ b/lib/main_common.dart @@ -13,5 +13,5 @@ Future mainCommon() async { anonKey: Constants.supabaseAnnonKey, ); - runApp(const App()); + runApp(App()); } diff --git a/pubspec.lock b/pubspec.lock index b38c9a3..275579f 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,6 +1,20 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + url: "https://pub.dartlang.org" + source: hosted + version: "43.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + url: "https://pub.dartlang.org" + source: hosted + version: "4.3.1" app_links: dependency: transitive description: @@ -36,6 +50,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.1" async: dependency: transitive description: @@ -43,6 +64,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.8.2" + auto_route: + dependency: "direct main" + description: + name: auto_route + url: "https://pub.dartlang.org" + source: hosted + version: "4.2.1" + auto_route_generator: + dependency: "direct dev" + description: + name: auto_route_generator + url: "https://pub.dartlang.org" + source: hosted + version: "4.2.1" boolean_selector: dependency: transitive description: @@ -50,6 +85,62 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" + build: + dependency: transitive + description: + name: build + url: "https://pub.dartlang.org" + source: hosted + version: "2.3.0" + build_config: + dependency: transitive + description: + name: build_config + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + build_daemon: + dependency: transitive + description: + name: build_daemon + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.9" + build_runner: + dependency: "direct dev" + description: + name: build_runner + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.0" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + url: "https://pub.dartlang.org" + source: hosted + version: "7.2.3" + built_collection: + dependency: transitive + description: + name: built_collection + url: "https://pub.dartlang.org" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + url: "https://pub.dartlang.org" + source: hosted + version: "8.4.0" characters: dependency: transitive description: @@ -64,6 +155,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.1" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" clock: dependency: transitive description: @@ -71,6 +169,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + code_builder: + dependency: transitive + description: + name: code_builder + url: "https://pub.dartlang.org" + source: hosted + version: "4.2.0" collection: dependency: transitive description: @@ -78,6 +183,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.16.0" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.2" crypto: dependency: transitive description: @@ -85,6 +197,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.0.2" + csslib: + dependency: transitive + description: + name: csslib + url: "https://pub.dartlang.org" + source: hosted + version: "0.17.2" + dart_style: + dependency: transitive + description: + name: dart_style + url: "https://pub.dartlang.org" + source: hosted + version: "2.2.3" fake_async: dependency: transitive description: @@ -106,6 +232,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "6.1.2" + fixnum: + dependency: transitive + description: + name: fixnum + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" flutter: dependency: "direct main" description: flutter @@ -128,6 +261,13 @@ packages: description: flutter source: sdk version: "0.0.0" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.3" functions_client: dependency: transitive description: @@ -135,6 +275,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0-dev.1" + glob: + dependency: transitive + description: + name: glob + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" gotrue: dependency: transitive description: @@ -142,6 +289,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0-dev.1" + graphs: + dependency: transitive + description: + name: graphs + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" hive: dependency: transitive description: @@ -156,6 +310,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + html: + dependency: transitive + description: + name: html + url: "https://pub.dartlang.org" + source: hosted + version: "0.15.0" http: dependency: transitive description: @@ -163,6 +324,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.13.5" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + url: "https://pub.dartlang.org" + source: hosted + version: "3.2.1" http_parser: dependency: transitive description: @@ -170,6 +338,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.0.1" + io: + dependency: transitive + description: + name: io + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" js: dependency: transitive description: @@ -177,6 +352,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.6.4" + json_annotation: + dependency: transitive + description: + name: json_annotation + url: "https://pub.dartlang.org" + source: hosted + version: "4.6.0" jwt_decode: dependency: transitive description: @@ -191,6 +373,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.0" + logging: + dependency: transitive + description: + name: logging + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" matcher: dependency: transitive description: @@ -219,6 +408,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.2" + package_config: + dependency: transitive + description: + name: package_config + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" path: dependency: transitive description: @@ -275,6 +471,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.1" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.dartlang.org" + source: hosted + version: "5.0.0" platform: dependency: transitive description: @@ -289,6 +492,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.2" + pool: + dependency: transitive + description: + name: pool + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.1" postgrest: dependency: transitive description: @@ -303,6 +513,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.2.4" + pub_semver: + dependency: transitive + description: + name: pub_semver + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" realtime_client: dependency: transitive description: @@ -310,11 +534,32 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.1.15" + shelf: + dependency: transitive + description: + name: shelf + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.2" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" + source_gen: + dependency: transitive + description: + name: source_gen + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.2" source_span: dependency: transitive description: @@ -343,6 +588,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" + stream_transform: + dependency: transitive + description: + name: stream_transform + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" string_scanner: dependency: transitive description: @@ -378,6 +630,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.4.9" + timing: + dependency: transitive + description: + name: timing + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" typed_data: dependency: transitive description: @@ -385,6 +644,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.1" + universal_html: + dependency: transitive + description: + name: universal_html + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.8" universal_io: dependency: transitive description: @@ -455,6 +721,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.2" + watcher: + dependency: transitive + description: + name: watcher + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" web_socket_channel: dependency: transitive description: @@ -476,6 +749,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.2.0+1" + xml: + dependency: transitive + description: + name: xml + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.0" + yaml: + dependency: transitive + description: + name: yaml + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.1" sdks: dart: ">=2.17.6 <3.0.0" flutter: ">=3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index a67b45e..5b874ba 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,11 +12,14 @@ dependencies: sdk: flutter supabase_flutter: ^1.0.0-dev.2 + auto_route: ^4.2.1 dev_dependencies: flutter_test: sdk: flutter + build_runner: ^2.2.0 flutter_lints: ^2.0.0 + auto_route_generator: ^4.2.1 flutter: