File tree 4 files changed +22
-5
lines changed
metadata/en-US/changelogs
4 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -127,8 +127,10 @@ final class ObjectIndexChanged extends HybridWorldEvent
127
127
final class TeamChanged extends HybridWorldEvent with TeamChangedMappable {
128
128
final String name;
129
129
final GameTeam team;
130
+ final String ? newName;
130
131
131
- TeamChanged (this .name, this .team);
132
+ TeamChanged (this .name, this .team) : newName = null ;
133
+ TeamChanged .rename (this .name, this .newName, this .team);
132
134
}
133
135
134
136
@MappableClass ()
Original file line number Diff line number Diff line change @@ -246,8 +246,20 @@ ServerProcessed processServerEvent(
246
246
..[event.cell.position] = cell.copyWith (objects: newObjects));
247
247
}));
248
248
case TeamChanged ():
249
- return ServerProcessed (
250
- state.copyWith.info.teams.put (event.name, event.team));
249
+ var info = state.info;
250
+ var newName = event.newName;
251
+ var teamMembers = Map <String , Set <int >>.from (state.teamMembers);
252
+ if (newName != null ) {
253
+ info = info.copyWith.teams.remove (event.name);
254
+ info = info.copyWith.teams.put (newName, event.team);
255
+ teamMembers[newName] = teamMembers.remove (event.name) ?? {};
256
+ } else {
257
+ info = info.copyWith.teams.put (event.name, event.team);
258
+ }
259
+ return ServerProcessed (state.copyWith (
260
+ info: info,
261
+ teamMembers: teamMembers,
262
+ ));
251
263
case TeamRemoved ():
252
264
return ServerProcessed (state.copyWith (
253
265
info: state.info.copyWith.teams.remove (event.team),
Original file line number Diff line number Diff line change @@ -112,8 +112,10 @@ class TeamDialogState extends State<TeamDialog> {
112
112
description: _descriptionController.text,
113
113
color: _color,
114
114
);
115
- _bloc.add (TeamChanged (
116
- widget.team ?? _nameController.text, team));
115
+ _bloc.add (TeamChanged .rename (
116
+ widget.team ?? _nameController.text,
117
+ _nameController.text,
118
+ team));
117
119
Navigator .of (context).pop ();
118
120
},
119
121
child: Text (_isCreate ()
Original file line number Diff line number Diff line change 8
8
* Add swamp multiplayer support
9
9
* Add scroll sensitivity setting
10
10
* Add remaining empty indicator to editor tabs
11
+ * Fix renaming teams not working ([#48](https://github.com/LinwoodDev/Setonix/issues/48))
11
12
* Migrate away from flutter_markdown
12
13
* Upgrade to flutter 3.29
13
14
* Update to agb 8.9
You can’t perform that action at this time.
0 commit comments