customizada rotas com nomes das bases
This commit is contained in:
@@ -1,25 +1,54 @@
|
||||
import 'package:educa_controle_acesso/models/aluno_model.dart';
|
||||
import 'package:educa_controle_acesso/screens/home_screen.dart';
|
||||
import 'package:educa_controle_acesso/screens/login_screen.dart';
|
||||
import 'package:educa_controle_acesso/screens/responsible_register_screen.dart';
|
||||
import 'package:educa_controle_acesso/widgets/text_custom.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_web_plugins/url_strategy.dart';
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
import 'models/aluno_model.dart';
|
||||
|
||||
void main() {
|
||||
Uri uri = Uri.parse(html.window.location.href);
|
||||
cidade = uri.queryParameters['cidade']??'';
|
||||
usePathUrlStrategy();
|
||||
runApp(const MyApp());
|
||||
}
|
||||
|
||||
String cidade = '';
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double height = MediaQuery.of(context).size.height;
|
||||
double width = MediaQuery.of(context).size.width;
|
||||
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
title: 'CONTROLE DE ACESSO',
|
||||
initialRoute: '/',
|
||||
onUnknownRoute: (RouteSettings settings) {
|
||||
return MaterialPageRoute(
|
||||
builder: (context) => Scaffold(
|
||||
body: Center(
|
||||
child: Container(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
child: Image.asset("assets/images/logoEduca.png",width:width * 0.15,height: height * 0.12)
|
||||
),
|
||||
TextCustom(text: 'Base não inserida ou não encontrada'),
|
||||
],
|
||||
),
|
||||
)
|
||||
)
|
||||
),
|
||||
);
|
||||
},
|
||||
routes: {
|
||||
'/': (_)=> LoginScreen(),
|
||||
'/cidade?cidade=${cidade}': (context)=> LoginScreen(cidade: cidade),
|
||||
'/home':(context)=> HomeScreen(dados: ModalRoute.of(context)!.settings.arguments as List),
|
||||
'/cadastro':(context)=>ResponsibleRegisterScreen(ModalRoute.of(context)!.settings.arguments as AlunoModel),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user