99 lines
3.1 KiB
Dart
99 lines
3.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:ticket_booth/screen/initial/initial_screen.dart';
|
|
import 'package:ticket_booth/screen/queue/queue_screen.dart';
|
|
import 'package:ticket_booth/screen/settings/setting_screen.dart';
|
|
import 'package:ticket_booth/screen/splash/splash_screen.dart';
|
|
|
|
const splashScreen = "/splashScreen";
|
|
const settingRoute = "/settingRoute";
|
|
const displayRoute = "/displayScreenRoute";
|
|
const queueRoute = "/queueRoute";
|
|
const tvRoute = "/tvRoute";
|
|
|
|
class AppRoute {
|
|
static Route<dynamic>? generateRoute(RouteSettings settings) {
|
|
// initial screen
|
|
if (settings.name == displayRoute) {
|
|
return MaterialPageRoute(builder: (context) {
|
|
return MediaQuery(
|
|
data: MediaQuery.of(context).copyWith(
|
|
textScaleFactor: 1.0,
|
|
padding: const EdgeInsets.all(0),
|
|
),
|
|
child: const InitialScreen());
|
|
});
|
|
}
|
|
if (settings.name == settingRoute) {
|
|
return PageRouteBuilder(
|
|
pageBuilder: (context, animation, secondaryAnimation) =>
|
|
const SettingScreen(),
|
|
transitionsBuilder: (context, animation, secondaryAnimation, child) {
|
|
const begin = Offset(0.0, 1.0);
|
|
const end = Offset.zero;
|
|
const curve = Curves.ease;
|
|
|
|
var tween =
|
|
Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
|
|
|
|
return SlideTransition(
|
|
position: animation.drive(tween),
|
|
child: child,
|
|
);
|
|
},
|
|
);
|
|
}
|
|
//Queue screen
|
|
if (settings.name == queueRoute) {
|
|
return PageRouteBuilder(
|
|
pageBuilder: (context, animation, secondaryAnimation) =>
|
|
const QueueScreen(),
|
|
transitionsBuilder: (context, animation, secondaryAnimation, child) {
|
|
const begin = Offset(0.0, 1.0);
|
|
const end = Offset.zero;
|
|
const curve = Curves.ease;
|
|
|
|
var tween =
|
|
Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
|
|
|
|
return SlideTransition(
|
|
position: animation.drive(tween),
|
|
child: child,
|
|
);
|
|
},
|
|
);
|
|
}
|
|
// //Queue screen
|
|
// if (settings.name == tvRoute) {
|
|
// return PageRouteBuilder(
|
|
// pageBuilder: (context, animation, secondaryAnimation) =>
|
|
// const TvTemplate(),
|
|
// transitionsBuilder: (context, animation, secondaryAnimation, child) {
|
|
// const begin = Offset(0.0, 1.0);
|
|
// const end = Offset.zero;
|
|
// const curve = Curves.ease;
|
|
|
|
// var tween =
|
|
// Tween(begin: begin, end: end).chain(CurveTween(curve: curve));
|
|
|
|
// return SlideTransition(
|
|
// position: animation.drive(tween),
|
|
// child: child,
|
|
// );
|
|
// },
|
|
// );
|
|
// }
|
|
|
|
//splash screen
|
|
if (settings.name == splashScreen) {
|
|
return MaterialPageRoute(builder: (context) {
|
|
return MediaQuery(
|
|
data: MediaQuery.of(context).copyWith(
|
|
textScaleFactor: 1.0,
|
|
padding: const EdgeInsets.all(0),
|
|
),
|
|
child: const SplashScreen());
|
|
});
|
|
}
|
|
}
|
|
}
|