[NewGroupChatScreen] Maintain selectedUsersList when going back and forward in the flow
This commit is contained in:
@@ -53,7 +53,12 @@ class _GroupChatDetailsScreenState extends State<GroupChatDetailsScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return WillPopScope(
|
||||||
|
onWillPop: () async {
|
||||||
|
Navigator.pop(context, _selectedUsers);
|
||||||
|
return false;
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
backgroundColor: Color.fromRGBO(252, 252, 252, 1),
|
backgroundColor: Color.fromRGBO(252, 252, 252, 1),
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
elevation: 1,
|
elevation: 1,
|
||||||
@@ -205,7 +210,7 @@ class _GroupChatDetailsScreenState extends State<GroupChatDetailsScreen> {
|
|||||||
_selectedUsers.remove(user);
|
_selectedUsers.remove(user);
|
||||||
});
|
});
|
||||||
if (_selectedUsers.isEmpty) {
|
if (_selectedUsers.isEmpty) {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context, _selectedUsers);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@@ -215,6 +220,7 @@ class _GroupChatDetailsScreenState extends State<GroupChatDetailsScreen> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,8 +69,8 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
|
|||||||
StreamIcons.arrow_right,
|
StreamIcons.arrow_right,
|
||||||
color: Color(0xFF006CFF),
|
color: Color(0xFF006CFF),
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () async {
|
||||||
Navigator.push(
|
final updatedList = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (_) => GroupChatDetailsScreen(
|
builder: (_) => GroupChatDetailsScreen(
|
||||||
@@ -78,6 +78,13 @@ class _NewGroupChatScreenState extends State<NewGroupChatScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
if (updatedList != null) {
|
||||||
|
setState(() {
|
||||||
|
_selectedUsers
|
||||||
|
..clear()
|
||||||
|
..addAll(updatedList);
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class StreamBackButton extends StatelessWidget {
|
|||||||
if (onPressed != null) {
|
if (onPressed != null) {
|
||||||
onPressed();
|
onPressed();
|
||||||
} else {
|
} else {
|
||||||
Navigator.of(context).pop();
|
Navigator.maybePop(context);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Icon(
|
child: Icon(
|
||||||
|
|||||||
Reference in New Issue
Block a user