buildPresetPasswordWarning for android
This commit is contained in:
		
							parent
							
								
									bdf8bbe26f
								
							
						
					
					
						commit
						4e8cbe3db1
					
				| @ -3176,3 +3176,41 @@ bool isInHomePage() { | |||||||
|   final controller = Get.find<DesktopTabController>(); |   final controller = Get.find<DesktopTabController>(); | ||||||
|   return controller.state.value.selected == 0; |   return controller.state.value.selected == 0; | ||||||
| } | } | ||||||
|  | 
 | ||||||
|  | Widget buildPresetPasswordWarning() { | ||||||
|  |   return FutureBuilder<bool>( | ||||||
|  |     future: bind.isPresetPassword(), | ||||||
|  |     builder: (BuildContext context, AsyncSnapshot<bool> snapshot) { | ||||||
|  |       if (snapshot.connectionState == ConnectionState.waiting) { | ||||||
|  |         return CircularProgressIndicator(); // Show a loading spinner while waiting for the Future to complete | ||||||
|  |       } else if (snapshot.hasError) { | ||||||
|  |         return Text( | ||||||
|  |             'Error: ${snapshot.error}'); // Show an error message if the Future completed with an error | ||||||
|  |       } else if (snapshot.hasData && snapshot.data == true) { | ||||||
|  |         return Container( | ||||||
|  |           color: Colors.yellow, | ||||||
|  |           child: Column( | ||||||
|  |             children: [ | ||||||
|  |               Align( | ||||||
|  |                   child: Text( | ||||||
|  |                 translate("Security Alert"), | ||||||
|  |                 style: TextStyle( | ||||||
|  |                   color: Colors.red, | ||||||
|  |                   fontSize: 20, | ||||||
|  |                   fontWeight: FontWeight.bold, | ||||||
|  |                 ), | ||||||
|  |               )).paddingOnly(bottom: 8), | ||||||
|  |               Text( | ||||||
|  |                 translate("preset_password_warning"), | ||||||
|  |                 style: TextStyle(color: Colors.red), | ||||||
|  |               ) | ||||||
|  |             ], | ||||||
|  |           ).paddingAll(8), | ||||||
|  |         ); // Show a warning message if the Future completed with true | ||||||
|  |       } else { | ||||||
|  |         return SizedBox | ||||||
|  |             .shrink(); // Show nothing if the Future completed with false or null | ||||||
|  |       } | ||||||
|  |     }, | ||||||
|  |   ); | ||||||
|  | } | ||||||
|  | |||||||
| @ -69,44 +69,6 @@ class _DesktopHomePageState extends State<DesktopHomePage> | |||||||
|     ); |     ); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   Widget buildPresetPasswordWarning() { |  | ||||||
|     return FutureBuilder<bool>( |  | ||||||
|       future: bind.isPresetPassword(), |  | ||||||
|       builder: (BuildContext context, AsyncSnapshot<bool> snapshot) { |  | ||||||
|         if (snapshot.connectionState == ConnectionState.waiting) { |  | ||||||
|           return CircularProgressIndicator(); // Show a loading spinner while waiting for the Future to complete |  | ||||||
|         } else if (snapshot.hasError) { |  | ||||||
|           return Text( |  | ||||||
|               'Error: ${snapshot.error}'); // Show an error message if the Future completed with an error |  | ||||||
|         } else if (snapshot.hasData && snapshot.data == true) { |  | ||||||
|           return Container( |  | ||||||
|             color: Colors.yellow, |  | ||||||
|             child: Column( |  | ||||||
|               children: [ |  | ||||||
|                 Align( |  | ||||||
|                     child: Text( |  | ||||||
|                   translate("Security Alert"), |  | ||||||
|                   style: TextStyle( |  | ||||||
|                     color: Colors.red, |  | ||||||
|                     fontSize: 20, |  | ||||||
|                     fontWeight: FontWeight.bold, |  | ||||||
|                   ), |  | ||||||
|                 )).paddingOnly(bottom: 8), |  | ||||||
|                 Text( |  | ||||||
|                   translate("preset_password_warning"), |  | ||||||
|                   style: TextStyle(color: Colors.red), |  | ||||||
|                 ) |  | ||||||
|               ], |  | ||||||
|             ).paddingAll(8), |  | ||||||
|           ); // Show a warning message if the Future completed with true |  | ||||||
|         } else { |  | ||||||
|           return SizedBox |  | ||||||
|               .shrink(); // Show nothing if the Future completed with false or null |  | ||||||
|         } |  | ||||||
|       }, |  | ||||||
|     ); |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   Widget buildLeftPane(BuildContext context) { |   Widget buildLeftPane(BuildContext context) { | ||||||
|     final isIncomingOnly = bind.isIncomingOnly(); |     final isIncomingOnly = bind.isIncomingOnly(); | ||||||
|     final isOutgoingOnly = bind.isOutgoingOnly(); |     final isOutgoingOnly = bind.isOutgoingOnly(); | ||||||
|  | |||||||
| @ -158,6 +158,7 @@ class _ServerPageState extends State<ServerPage> { | |||||||
|                     child: Column( |                     child: Column( | ||||||
|                       mainAxisAlignment: MainAxisAlignment.start, |                       mainAxisAlignment: MainAxisAlignment.start, | ||||||
|                       children: [ |                       children: [ | ||||||
|  |                         buildPresetPasswordWarning(), | ||||||
|                         gFFI.serverModel.isStart |                         gFFI.serverModel.isStart | ||||||
|                             ? ServerInfo() |                             ? ServerInfo() | ||||||
|                             : ServiceNotRunningNotification(), |                             : ServiceNotRunningNotification(), | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user