ajuste da url query

This commit is contained in:
Reginaldo
2023-08-08 08:55:11 -03:00
parent 347b965423
commit f077fdd580
2 changed files with 16 additions and 17 deletions

View File

@@ -8,13 +8,12 @@ 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 = '';
String urlCompleta = '';
class MyApp extends StatelessWidget {
const MyApp({super.key});
@@ -24,10 +23,12 @@ class MyApp extends StatelessWidget {
double height = MediaQuery.of(context).size.height;
double width = MediaQuery.of(context).size.width;
Uri? uri = Uri.parse(html.window.location.href);
cidade = uri.pathSegments.isNotEmpty ? uri.pathSegments.last : '';
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'CONTROLE DE ACESSO',
initialRoute: '/',
onUnknownRoute: (RouteSettings settings) {
return MaterialPageRoute(
builder: (context) => Scaffold(
@@ -48,10 +49,14 @@ class MyApp extends StatelessWidget {
);
},
routes: {
'/cidade?cidade=${cidade}': (context)=> LoginScreen(cidade: cidade),
'/$cidade': (_)=> LoginScreen(cidade: cidade),
'/home':(context)=> HomeScreen(dados: ModalRoute.of(context)!.settings.arguments as List),
'/cadastro':(context)=>ResponsibleRegisterScreen(ModalRoute.of(context)!.settings.arguments as AlunoModel),
},
);
}
}
//http://localhost:63123/cidade?cidade=iracemapolis
//https://homol-controle-educa.rkmsistemas.com.br/cidade?cidade=iracemapolis
//https://homol-controle-educa.rkmsistemas.com.br/