ui: Make going back minimize the app
This commit is contained in:
		
							parent
							
								
									757e0be5ef
								
							
						
					
					
						commit
						074381ff67
					
				| @ -1,7 +1,9 @@ | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:flutter_bloc/flutter_bloc.dart'; | ||||
| import 'package:get_it/get_it.dart'; | ||||
| import 'package:move_to_background/move_to_background.dart'; | ||||
| import 'package:moxxyv2/shared/constants.dart'; | ||||
| import 'package:moxxyv2/ui/bloc/navigation_bloc.dart' as navigation; | ||||
| import 'package:moxxyv2/ui/bloc/sendfiles_bloc.dart'; | ||||
| import 'package:moxxyv2/ui/bloc/share_selection_bloc.dart'; | ||||
| import 'package:moxxyv2/ui/constants.dart'; | ||||
| @ -24,9 +26,19 @@ class ShareSelectionPage extends StatelessWidget { | ||||
| 
 | ||||
|     return WillPopScope( | ||||
|       onWillPop: () async { | ||||
|         context.read<ShareSelectionBloc>().add(ResetEvent()); | ||||
|         GetIt.I.get<ShareSelectionBloc>().add(ResetEvent()); | ||||
| 
 | ||||
|         return true; | ||||
|         // Put the app back into the background... | ||||
|         await MoveToBackground.moveTaskToBack(); | ||||
|         // ...and navigate to the conversations page | ||||
|         GetIt.I.get<navigation.NavigationBloc>().add( | ||||
|           navigation.PushedNamedAndRemoveUntilEvent( | ||||
|             const navigation.NavigationDestination(conversationsRoute), | ||||
|             (_) => false, | ||||
|           ), | ||||
|         ); | ||||
| 
 | ||||
|         return false; | ||||
|       }, | ||||
|       child: BlocBuilder<ShareSelectionBloc, ShareSelectionState>( | ||||
|         builder: (context, state) => Scaffold( | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user