mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-03 19:54:12 +00:00 
			
		
		
		
	Show friends list as a dialog
This commit is contained in:
		@@ -43,7 +43,6 @@ class _FriendsListScreenState extends SafeState<FriendsListScreen> {
 | 
			
		||||
    error = _friendsList == null ? _ErrorsLevel.MAJOR : _ErrorsLevel.MINOR;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  void didChangeDependencies() {
 | 
			
		||||
    super.didChangeDependencies();
 | 
			
		||||
@@ -69,7 +68,7 @@ class _FriendsListScreenState extends SafeState<FriendsListScreen> {
 | 
			
		||||
    final list = await _friendsHelper.getList(online: online);
 | 
			
		||||
 | 
			
		||||
    // Check if there is no cache yet
 | 
			
		||||
    if(!online && list.isEmpty) return;
 | 
			
		||||
    if (!online && list.isEmpty) return;
 | 
			
		||||
 | 
			
		||||
    // Check for errors
 | 
			
		||||
    if (list == null) return _gotError();
 | 
			
		||||
@@ -103,7 +102,14 @@ class _FriendsListScreenState extends SafeState<FriendsListScreen> {
 | 
			
		||||
      );
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Widget build(BuildContext context) {
 | 
			
		||||
  Widget build(BuildContext context) => Scaffold(
 | 
			
		||||
        appBar: AppBar(
 | 
			
		||||
          title: Text(tr("Your friends list")),
 | 
			
		||||
        ),
 | 
			
		||||
        body: _buildBody(),
 | 
			
		||||
      );
 | 
			
		||||
 | 
			
		||||
  Widget _buildBody() {
 | 
			
		||||
    if (_error == _ErrorsLevel.MAJOR) return _buildError();
 | 
			
		||||
    if (_friendsList == null) return buildCenteredProgressBar();
 | 
			
		||||
 | 
			
		||||
@@ -161,23 +167,23 @@ class _FriendsListScreenState extends SafeState<FriendsListScreen> {
 | 
			
		||||
    final choice = await showDialog<bool>(
 | 
			
		||||
      context: context,
 | 
			
		||||
      builder: (b) => AlertDialog(
 | 
			
		||||
            title: Text(tr("Delete friend")),
 | 
			
		||||
            content: Text(tr(
 | 
			
		||||
                "Are you sure do you want to remove this friend from your list of friends ? A friendship request will have to be sent to get this user back to your list!")),
 | 
			
		||||
            actions: <Widget>[
 | 
			
		||||
              FlatButton(
 | 
			
		||||
                onPressed: () => Navigator.pop(context, false),
 | 
			
		||||
                child: Text(tr("Cancel").toUpperCase()),
 | 
			
		||||
              ),
 | 
			
		||||
              FlatButton(
 | 
			
		||||
                onPressed: () => Navigator.pop(context, true),
 | 
			
		||||
                child: Text(
 | 
			
		||||
                  tr("Confirm").toUpperCase(),
 | 
			
		||||
                  style: TextStyle(color: Colors.red),
 | 
			
		||||
                ),
 | 
			
		||||
              ),
 | 
			
		||||
            ],
 | 
			
		||||
        title: Text(tr("Delete friend")),
 | 
			
		||||
        content: Text(tr(
 | 
			
		||||
            "Are you sure do you want to remove this friend from your list of friends ? A friendship request will have to be sent to get this user back to your list!")),
 | 
			
		||||
        actions: <Widget>[
 | 
			
		||||
          FlatButton(
 | 
			
		||||
            onPressed: () => Navigator.pop(context, false),
 | 
			
		||||
            child: Text(tr("Cancel").toUpperCase()),
 | 
			
		||||
          ),
 | 
			
		||||
          FlatButton(
 | 
			
		||||
            onPressed: () => Navigator.pop(context, true),
 | 
			
		||||
            child: Text(
 | 
			
		||||
              tr("Confirm").toUpperCase(),
 | 
			
		||||
              style: TextStyle(color: Colors.red),
 | 
			
		||||
            ),
 | 
			
		||||
          ),
 | 
			
		||||
        ],
 | 
			
		||||
      ),
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    if (choice == null || !choice) return;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user