Add error handling screen to view station page
This commit is contained in:
		
							parent
							
								
									8ddac141d7
								
							
						
					
					
						commit
						da983871e2
					
				
					 2 changed files with 37 additions and 1 deletions
				
			
		|  | @ -51,6 +51,8 @@ abstract class ViewStationPageShared extends StatelessWidget { | ||||||
|   static const departsTo = 'Pleacă către'; |   static const departsTo = 'Pleacă către'; | ||||||
|   static const departedTo = 'A plecat către'; |   static const departedTo = 'A plecat către'; | ||||||
|   static const cancelledDeparture = 'Anulat - către'; |   static const cancelledDeparture = 'Anulat - către'; | ||||||
|  |   static const errorText = 'A apărut o eroare'; | ||||||
|  |   static const retryText = 'Reîncearcă'; | ||||||
| 
 | 
 | ||||||
|   final ViewStationPageTab tab; |   final ViewStationPageTab tab; | ||||||
|   final void Function(ViewStationPageTab) setTab; |   final void Function(ViewStationPageTab) setTab; | ||||||
|  |  | ||||||
|  | @ -27,7 +27,41 @@ class ViewStationPageMaterial extends ViewStationPageShared { | ||||||
|       body: snapshot.state == RefreshFutureBuilderState.waiting  |       body: snapshot.state == RefreshFutureBuilderState.waiting  | ||||||
|         ? const Loading(text: ViewStationPageShared.loadingText,)  |         ? const Loading(text: ViewStationPageShared.loadingText,)  | ||||||
|         : snapshot.state == RefreshFutureBuilderState.error |         : snapshot.state == RefreshFutureBuilderState.error | ||||||
|         ? Container() |         ? Padding( | ||||||
|  |           padding: const EdgeInsets.all(8.0), | ||||||
|  |           child: Center( | ||||||
|  |             child: Column( | ||||||
|  |               mainAxisSize: MainAxisSize.min, | ||||||
|  |               children: [ | ||||||
|  |                 const Icon( | ||||||
|  |                   Icons.error_outline, | ||||||
|  |                   size: 32, | ||||||
|  |                   color: Colors.red, | ||||||
|  |                 ), | ||||||
|  |                 const Text( | ||||||
|  |                   ViewStationPageShared.errorText, | ||||||
|  |                   style: TextStyle( | ||||||
|  |                     inherit: true, | ||||||
|  |                     fontSize: 32, | ||||||
|  |                   ), | ||||||
|  |                 ), | ||||||
|  |                 Text( | ||||||
|  |                   snapshot.error.toString(), | ||||||
|  |                   style: Theme.of(context).textTheme.bodySmall, | ||||||
|  |                 ), | ||||||
|  |                 Padding( | ||||||
|  |                   padding: const EdgeInsets.all(8.0), | ||||||
|  |                   child: ElevatedButton( | ||||||
|  |                     onPressed: () { | ||||||
|  |                       refresh(); | ||||||
|  |                     }, | ||||||
|  |                     child: const Text(ViewStationPageShared.retryText), | ||||||
|  |                   ), | ||||||
|  |                 ), | ||||||
|  |               ], | ||||||
|  |             ), | ||||||
|  |           ), | ||||||
|  |         ) | ||||||
|         : CustomScrollView( |         : CustomScrollView( | ||||||
|           slivers: [ |           slivers: [ | ||||||
|             SliverToBoxAdapter(child: SafeArea(left: false, bottom: false, right: false,child: Container(),),), |             SliverToBoxAdapter(child: SafeArea(left: false, bottom: false, right: false,child: Container(),),), | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue