basic structures (routing)

This commit is contained in:
MohammadTaha Basiri 2021-12-04 20:51:20 +03:30
parent c26303e879
commit e152b77f00
4 changed files with 63 additions and 0 deletions

View File

@ -0,0 +1,27 @@
import 'package:flutter/material.dart';
class RouteGenerator {
static Route<dynamic> generateRoute(RouteSettings settings) {
switch (settings.name) {
default:
return _errorRoute();
}
}
static Route<dynamic> _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,
);
}

6
lib/routes/routes.dart Normal file
View File

@ -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';
}

View File

@ -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"

View File

@ -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: