some bugfixes
This commit is contained in:
		
							parent
							
								
									21e130b6f6
								
							
						
					
					
						commit
						48e4f8eea4
					
				
					 3 changed files with 36 additions and 31 deletions
				
			
		|  | @ -1,8 +1,6 @@ | |||
| import 'package:flutter/material.dart'; | ||||
| import 'package:http/http.dart'; | ||||
| import 'package:slothmu/business_logic/user.dart'; | ||||
| import 'package:localization/localization.dart'; | ||||
| import 'package:http/http.dart' as http; | ||||
| import '../business_logic/auth/oauth.dart' as oauth; | ||||
| import '../business_logic/settings.dart' as settings; | ||||
| import '../business_logic/user.dart' as user; | ||||
|  | @ -109,12 +107,35 @@ class _AuthPageState extends State<AuthPage> { | |||
|         child: Column( | ||||
|           mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||||
|           children: [ | ||||
|             Text("copy-code-from-browser".i18n()), | ||||
|             TextFormField( | ||||
|                 decoration: InputDecoration( | ||||
|                     hintText: "123-ABC", | ||||
|                     icon: const Icon(Icons.password), | ||||
|                     labelText: "code-hint".i18n())), | ||||
|             FutureBuilder<int>( | ||||
|               future: oauth.handleFullOauth(), | ||||
|               builder: (context, snapshot) { | ||||
|                 if (snapshot.hasError) { | ||||
|                   return Text("login-failed-snackbar-text".i18n()); | ||||
|                 } else if (snapshot.hasData) { | ||||
|                   if (snapshot.data != null) { | ||||
|                     if (snapshot.data != 200) { | ||||
|                       return Row( | ||||
|                         mainAxisAlignment: MainAxisAlignment.center, | ||||
|                         children: [ | ||||
|                           const Icon(Icons.error), | ||||
|                           const SizedBox( | ||||
|                             width: 24, | ||||
|                           ), | ||||
|                           Text("error ${snapshot.data}"), | ||||
|                         ], | ||||
|                       ); | ||||
|                     } | ||||
|                   } | ||||
|                   return TextButton.icon( | ||||
|                       onPressed: null, | ||||
|                       icon: const Icon(Icons.check), | ||||
|                       label: Text("confirm-button".i18n())); | ||||
|                 } else { | ||||
|                   return const CircularProgressIndicator(); | ||||
|                 } | ||||
|               }, | ||||
|             ), | ||||
|             Row( | ||||
|               mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||||
|               children: [ | ||||
|  | @ -124,28 +145,6 @@ class _AuthPageState extends State<AuthPage> { | |||
|                     }, | ||||
|                     icon: const Icon(Icons.arrow_back), | ||||
|                     label: Text("back-button".i18n())), | ||||
|                 FutureBuilder<int>( | ||||
|                   future: oauth.handleFullOauth(), | ||||
|                   builder: (context, snapshot) { | ||||
|                     if (snapshot.hasError) { | ||||
|                       return Text("login-failed-snackbar-text".i18n()); | ||||
|                     } else if (snapshot.hasData) { | ||||
|                       if (snapshot.data != null) { | ||||
|                         if (snapshot.data != 200) { | ||||
|                           return Row( | ||||
|                             children: [Text("error ${snapshot.data}")], | ||||
|                           ); | ||||
|                         } | ||||
|                       } | ||||
|                       return TextButton.icon( | ||||
|                           onPressed: null, | ||||
|                           icon: const Icon(Icons.check), | ||||
|                           label: Text("confirm-button".i18n())); | ||||
|                     } else { | ||||
|                       return const CircularProgressIndicator(); | ||||
|                     } | ||||
|                   }, | ||||
|                 ), | ||||
|               ], | ||||
|             ) | ||||
|           ], | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue