From e152b77f00993212469ddf2a1476fe82adfc663e Mon Sep 17 00:00:00 2001 From: MohammadTaha Basiri Date: Sat, 4 Dec 2021 20:51:20 +0330 Subject: [PATCH] basic structures (routing) --- lib/routes/route_generator.dart | 27 +++++++++++++++++++++++++++ lib/routes/routes.dart | 6 ++++++ pubspec.lock | 27 +++++++++++++++++++++++++++ pubspec.yaml | 3 +++ 4 files changed, 63 insertions(+) create mode 100644 lib/routes/route_generator.dart create mode 100644 lib/routes/routes.dart diff --git a/lib/routes/route_generator.dart b/lib/routes/route_generator.dart new file mode 100644 index 0000000..18b2839 --- /dev/null +++ b/lib/routes/route_generator.dart @@ -0,0 +1,27 @@ +import 'package:flutter/material.dart'; + +class RouteGenerator { + static Route generateRoute(RouteSettings settings) { + switch (settings.name) { + default: + return _errorRoute(); + } + } + + static Route _errorRoute() { + return MaterialPageRoute(builder: (_) { + return Scaffold( + appBar: AppBar( + title: const Text('Error'), + ), + body: const Center( + child: Text('ERROR'), + ), + ); + }); + } + + static materialPageRouteGenerator(pageWidget) => MaterialPageRoute( + builder: (context) => pageWidget, + ); +} diff --git a/lib/routes/routes.dart b/lib/routes/routes.dart new file mode 100644 index 0000000..31a76fe --- /dev/null +++ b/lib/routes/routes.dart @@ -0,0 +1,6 @@ +class Routes { + static const String splash = '/'; + static const String home = '/home'; + static const String authenticaion = '/authentication'; + static const String profile = '/profile'; +} diff --git a/pubspec.lock b/pubspec.lock index 18fcc0f..4b8b781 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -69,11 +69,23 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.4" + flutter_localizations: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + intl: + dependency: transitive + description: + name: intl + url: "https://pub.dartlang.org" + source: hosted + version: "0.17.0" lints: dependency: transitive description: @@ -95,6 +107,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.7.0" + nested: + dependency: transitive + description: + name: nested + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" path: dependency: transitive description: @@ -102,6 +121,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.0" + provider: + dependency: "direct main" + description: + name: provider + url: "https://pub.dartlang.org" + source: hosted + version: "6.0.1" sky_engine: dependency: transitive description: flutter @@ -165,3 +191,4 @@ packages: version: "2.1.0" sdks: dart: ">=2.12.0 <3.0.0" + flutter: ">=1.16.0" diff --git a/pubspec.yaml b/pubspec.yaml index 18c9bf7..407c7b7 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -29,11 +29,14 @@ environment: dependencies: flutter: sdk: flutter + flutter_localizations: + sdk: flutter # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 + provider: ^6.0.1 dev_dependencies: flutter_test: