localization support
This commit is contained in:
		
							parent
							
								
									40d57fb245
								
							
						
					
					
						commit
						bd3e05b354
					
				
					 11 changed files with 34 additions and 84 deletions
				
			
		|  | @ -1,5 +1,6 @@ | |||
| import 'package:flutter/material.dart'; | ||||
| import 'package:slothmu/api/user.dart'; | ||||
| import 'package:localization/localization.dart'; | ||||
| 
 | ||||
| class Login extends StatefulWidget { | ||||
|   const Login({Key? key}) : super(key: key); | ||||
|  | @ -40,18 +41,18 @@ class _LoginFormState extends State<LoginForm> { | |||
|       child: Column( | ||||
|         mainAxisAlignment: MainAxisAlignment.spaceAround, | ||||
|         children: [ | ||||
|           const Text("Welcome!", style: TextStyle(fontSize: 64)), | ||||
|           Text("greeting".i18n(), style: const TextStyle(fontSize: 64)), | ||||
|           TextFormField( | ||||
|             decoration: const InputDecoration( | ||||
|               labelText: "user id", | ||||
|               hintText: "user@example.com", | ||||
|               icon: Icon(Icons.person), | ||||
|             decoration: InputDecoration( | ||||
|               labelText: "user-id".i18n(), | ||||
|               hintText: "user-id-example".i18n(), | ||||
|               icon: const Icon(Icons.person), | ||||
|               prefixText: "@", | ||||
|             ), | ||||
|             autofocus: true, | ||||
|             validator: (value) { | ||||
|               if (value!.isEmpty || !isValidUsername(name: value)) { | ||||
|                 return "Sorry, this user id doesn't look quite right..."; | ||||
|                 return "user-id-not-valid".i18n(); | ||||
|               } else { | ||||
|                 return null; | ||||
|               } | ||||
|  | @ -61,8 +62,8 @@ class _LoginFormState extends State<LoginForm> { | |||
|               onPressed: () { | ||||
|                 final isValid = formKey.currentState!.validate(); | ||||
|               }, | ||||
|               icon: Icon(Icons.login), | ||||
|               label: Text("authorize in browser")) | ||||
|               icon: const Icon(Icons.login), | ||||
|               label: Text("authorize-in-browser".i18n())) | ||||
|         ], | ||||
|       ), | ||||
|     ); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue