Roi Peker
Committed by GitHub

Merge pull request #1171 from iMrLopez/master

@@ -246,6 +246,22 @@ print(Get.parameters['user']); @@ -246,6 +246,22 @@ print(Get.parameters['user']);
246 // out: 34954 246 // out: 34954
247 ``` 247 ```
248 248
  249 +or send multiple parameters like this
  250 +
  251 +```dart
  252 +Get.toNamed("/profile/34954?flag=true");
  253 +```
  254 +
  255 +On second screen take the data by parameters as usually
  256 +
  257 +```dart
  258 +print(Get.parameters['user']);
  259 +print(Get.parameters['flag']);
  260 +// out: 34954 true
  261 +```
  262 +
  263 +
  264 +
249 And now, all you need to do is use Get.toNamed() to navigate your named routes, without any context (you can call your routes directly from your BLoC or Controller class), and when your app is compiled to the web, your routes will appear in the url <3 265 And now, all you need to do is use Get.toNamed() to navigate your named routes, without any context (you can call your routes directly from your BLoC or Controller class), and when your app is compiled to the web, your routes will appear in the url <3
250 266
251 ### Middleware 267 ### Middleware
@@ -242,7 +242,21 @@ Y en la segunda pantalla tome los datos por parámetro @@ -242,7 +242,21 @@ Y en la segunda pantalla tome los datos por parámetro
242 242
243 ```dart 243 ```dart
244 print(Get.parameters['user']); 244 print(Get.parameters['user']);
245 -// out: 34954 245 +// salida: 34954
  246 +```
  247 +
  248 +o envie multiples parametros de la siguiente manera
  249 +
  250 +```dart
  251 +Get.toNamed("/profile/34954?flag=true");
  252 +```
  253 +
  254 +En la segunda pantalla tome los parametros como lo haria normalmente
  255 +
  256 +```dart
  257 +print(Get.parameters['user']);
  258 +print(Get.parameters['flag']);
  259 +// salida: 34954 true
246 ``` 260 ```
247 261
248 Y ahora, todo lo que necesita hacer es usar Get.toNamed() para navegar por sus rutas nombradas, sin ningún contexto (puede llamar a sus rutas directamente desde su clase BLoC o Controller), y cuando su aplicación se compila para web, sus rutas aparecerán en la url del navegador <3 262 Y ahora, todo lo que necesita hacer es usar Get.toNamed() para navegar por sus rutas nombradas, sin ningún contexto (puede llamar a sus rutas directamente desde su clase BLoC o Controller), y cuando su aplicación se compila para web, sus rutas aparecerán en la url del navegador <3
@@ -247,6 +247,20 @@ print(Get.parameters['user']); @@ -247,6 +247,20 @@ print(Get.parameters['user']);
247 // donne: 34954 247 // donne: 34954
248 ``` 248 ```
249 249
  250 +ou envoyer plusieurs paramètres comme celui-ci
  251 +
  252 +```dart
  253 +Get.toNamed("/profile/34954?flag=true");
  254 +```
  255 +
  256 +Sur le deuxième écran, prenez les données par paramètres comme d'habitude
  257 +
  258 +```dart
  259 +print(Get.parameters['user']);
  260 +print(Get.parameters['flag']);
  261 +// donne: 34954 true
  262 +```
  263 +
250 Et maintenant, tout ce que vous avez à faire est d'utiliser Get.toNamed() pour parcourir vos routes nommées, sans aucun contexte (vous pouvez appeler vos routes directement à partir de votre classe BLoC ou Controller), et lorsque votre application est compilée sur le Web, vos routes apparaîtront dans l'url <3 264 Et maintenant, tout ce que vous avez à faire est d'utiliser Get.toNamed() pour parcourir vos routes nommées, sans aucun contexte (vous pouvez appeler vos routes directement à partir de votre classe BLoC ou Controller), et lorsque votre application est compilée sur le Web, vos routes apparaîtront dans l'url <3
251 265
252 ### Middleware 266 ### Middleware
@@ -248,6 +248,21 @@ print(Get.parameters['user']); @@ -248,6 +248,21 @@ print(Get.parameters['user']);
248 // keluaran: 34954 248 // keluaran: 34954
249 ``` 249 ```
250 250
  251 +atau kirim beberapa parameter seperti ini
  252 +
  253 +```dart
  254 +Get.toNamed("/profile/34954?flag=true");
  255 +```
  256 +
  257 +Pada layar kedua, ambil data berdasarkan parameter seperti biasanya
  258 +
  259 +```dart
  260 +print(Get.parameters['user']);
  261 +print(Get.parameters['flag']);
  262 +// keluaran: 34954 true
  263 +```
  264 +
  265 +
251 Dan sekarang, yang anda perlu lakukan adalah menggunakan Get.toNamed() untuk bernavigasi ke named route anda, tanpa konteks (anda bisa memanggil route secara langsung dari kelas BLoC atau Controller), dan ketika aplikasi anda di-compile di web, route anda akan muncul di url <3 266 Dan sekarang, yang anda perlu lakukan adalah menggunakan Get.toNamed() untuk bernavigasi ke named route anda, tanpa konteks (anda bisa memanggil route secara langsung dari kelas BLoC atau Controller), dan ketika aplikasi anda di-compile di web, route anda akan muncul di url <3
252 267
253 ### Middleware 268 ### Middleware
@@ -246,6 +246,23 @@ print(Get.parameters['user']); @@ -246,6 +246,23 @@ print(Get.parameters['user']);
246 // 출력: 34954 246 // 출력: 34954
247 ``` 247 ```
248 248
  249 +
  250 +또는 이와 같은 여러 매개 변수를 보냅니다.
  251 +
  252 +```dart
  253 +Get.toNamed("/profile/34954?flag=true");
  254 +```
  255 +
  256 +두 번째 화면에서 일반적으로 매개 변수별로 데이터를 가져옵니다.
  257 +
  258 +```dart
  259 +print(Get.parameters['user']);
  260 +print(Get.parameters['flag']);
  261 +// 출력: 34954 true
  262 +```
  263 +
  264 +
  265 +
249 이제 Get.toNamed()를 사용하여 어떤 context도 없이 명명된 라우트를 탐색하고 (BLoC 또는 Controller 클래스로 부터 직접 라우트를 호출할 수 있음) 앱이 웹으로 컴파일되면 경로는 url에 표시됩니다. <3 266 이제 Get.toNamed()를 사용하여 어떤 context도 없이 명명된 라우트를 탐색하고 (BLoC 또는 Controller 클래스로 부터 직접 라우트를 호출할 수 있음) 앱이 웹으로 컴파일되면 경로는 url에 표시됩니다. <3
250 267
251 ### 미들웨어 268 ### 미들웨어
@@ -322,9 +322,26 @@ Get.toNamed("/segunda/34954"); @@ -322,9 +322,26 @@ Get.toNamed("/segunda/34954");
322 Na segunda tela receba os dados usando `Get.parameters[]` 322 Na segunda tela receba os dados usando `Get.parameters[]`
323 323
324 ```dart 324 ```dart
325 -print(Get.parameters['user']); // valor: 34954 325 +print(Get.parameters['user']);
  326 +// valor: 34954
326 ``` 327 ```
327 328
  329 +
  330 +ou envie vários parâmetros como este
  331 +
  332 +```dart
  333 +Get.toNamed("/profile/34954?flag=true");
  334 +```
  335 +
  336 +Na segunda tela, pegue os dados por parâmetros normalmente
  337 +```dart
  338 +print(Get.parameters['user']);
  339 +print(Get.parameters['flag']);
  340 +// valor: 34954 true
  341 +```
  342 +
  343 +
  344 +
328 E agora, tudo que você precisa fazer é usar `Get.toNamed)` para navegar por suas rotas nomeadas, sem nenhum `context` (você pode chamar suas rotas diretamente do seu BLoc ou do Controller), e quando seu aplicativo é compilado para a web, suas rotas vão aparecer na url ❤ 345 E agora, tudo que você precisa fazer é usar `Get.toNamed)` para navegar por suas rotas nomeadas, sem nenhum `context` (você pode chamar suas rotas diretamente do seu BLoc ou do Controller), e quando seu aplicativo é compilado para a web, suas rotas vão aparecer na url ❤
329 346
330 #### Middleware 347 #### Middleware
@@ -246,6 +246,22 @@ print(Get.parameters['user']); @@ -246,6 +246,22 @@ print(Get.parameters['user']);
246 // out: 34954 246 // out: 34954
247 ``` 247 ```
248 248
  249 +или отправьте несколько таких параметров
  250 +
  251 +```dart
  252 +Get.toNamed("/profile/34954?flag=true");
  253 +```
  254 +
  255 +На втором экране взять данные по параметрам как обычно.
  256 +
  257 +```dart
  258 +print(Get.parameters['user']);
  259 +print(Get.parameters['flag']);
  260 +// out: 34954 true
  261 +```
  262 +
  263 +
  264 +
249 И теперь все, что вам нужно сделать, это использовать Get.toNamed() для навигации по именованным маршрутам без какого-либо контекста (вы можете вызывать свои маршруты непосредственно из класса BLoC или контроллера), а когда ваше приложение будет скомпилировано в Интернете, ваше маршруты появятся в url <3 265 И теперь все, что вам нужно сделать, это использовать Get.toNamed() для навигации по именованным маршрутам без какого-либо контекста (вы можете вызывать свои маршруты непосредственно из класса BLoC или контроллера), а когда ваше приложение будет скомпилировано в Интернете, ваше маршруты появятся в url <3
250 266
251 ### Middleware 267 ### Middleware
@@ -243,6 +243,21 @@ print(Get.parameters['user']); @@ -243,6 +243,21 @@ print(Get.parameters['user']);
243 // out: 34954 243 // out: 34954
244 ``` 244 ```
245 245
  246 +或像这样发送多个参数
  247 +
  248 +```dart
  249 +Get.toNamed("/profile/34954?flag=true");
  250 +```
  251 +
  252 +在第二个屏幕上,通常按参数获取数据
  253 +
  254 +```dart
  255 +print(Get.parameters['user']);
  256 +print(Get.parameters['flag']);
  257 +// out: 34954 true
  258 +```
  259 +
  260 +
246 现在,你需要做的就是使用Get.toNamed()来导航你的别名路由,不需要任何context(你可以直接从你的BLoC或Controller类中调用你的路由),当你的应用程序被编译到web时,你的路由将出现在URL中。 261 现在,你需要做的就是使用Get.toNamed()来导航你的别名路由,不需要任何context(你可以直接从你的BLoC或Controller类中调用你的路由),当你的应用程序被编译到web时,你的路由将出现在URL中。
247 262
248 ### 中间件 263 ### 中间件
@@ -97,8 +97,13 @@ class ParseRouteTree { @@ -97,8 +97,13 @@ class ParseRouteTree {
97 97
98 Map<String, String> _parseParams(String path, PathDecoded routePath) { 98 Map<String, String> _parseParams(String path, PathDecoded routePath) {
99 final params = <String, String>{}; 99 final params = <String, String>{};
  100 + var idx = path.indexOf('?');
  101 + if (idx > -1) {
  102 + path = path.substring(0, idx);
  103 + final uri = Uri.tryParse(path);
  104 + params.addAll(uri.queryParameters);
  105 + }
100 Match paramsMatch = routePath.regex.firstMatch(path); 106 Match paramsMatch = routePath.regex.firstMatch(path);
101 -  
102 for (var i = 0; i < routePath.keys.length; i++) { 107 for (var i = 0; i < routePath.keys.length; i++) {
103 var param = Uri.decodeQueryComponent(paramsMatch[i + 1]); 108 var param = Uri.decodeQueryComponent(paramsMatch[i + 1]);
104 params[routePath.keys[i]] = param; 109 params[routePath.keys[i]] = param;