Skip to content

Commit fbcca94

Browse files
committed
chore: update v10-migration.md
1 parent aca4ba3 commit fbcca94

File tree

1 file changed

+190
-0
lines changed

1 file changed

+190
-0
lines changed

migrations/v10-migration.md

Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88

99
This guide includes breaking changes grouped by release phase:
1010

11+
### 🚧 v10.0.0-beta.3
12+
13+
- [AttachmentPickerType](#-attachmentpickertype)
14+
- [StreamAttachmentPickerOption](#-streamattachmentpickeroption)
15+
- [showStreamAttachmentPickerModalBottomSheet](#-showstreamattachmentpickermodalbottomsheet)
16+
- [AttachmentPickerBottomSheet](#-attachmentpickerbottomsheet)
17+
1118
### 🚧 v10.0.0-beta.1
1219

1320
- [StreamReactionPicker](#-streamreactionpicker)
@@ -17,6 +24,183 @@ This guide includes breaking changes grouped by release phase:
1724

1825
---
1926

27+
## 🧪 Migration for v10.0.0-beta.3
28+
29+
### 🛠 AttachmentPickerType
30+
31+
#### Key Changes:
32+
33+
- `AttachmentPickerType` enum replaced with sealed class hierarchy
34+
- Now supports extensible custom types like contact and location pickers
35+
- Use built-in types like `AttachmentPickerType.images` or define your own via `CustomAttachmentPickerType`
36+
37+
#### Migration Steps:
38+
39+
**Before:**
40+
```dart
41+
// Using enum-based attachment types
42+
final attachmentType = AttachmentPickerType.images;
43+
```
44+
45+
**After:**
46+
```dart
47+
// Using sealed class attachment types
48+
final attachmentType = AttachmentPickerType.images;
49+
50+
// For custom types
51+
class LocationAttachmentPickerType extends CustomAttachmentPickerType {
52+
const LocationAttachmentPickerType();
53+
}
54+
```
55+
56+
> ⚠️ **Important:**
57+
> The enum is now a sealed class, but the basic usage remains the same for built-in types.
58+
59+
---
60+
61+
### 🛠 StreamAttachmentPickerOption
62+
63+
#### Key Changes:
64+
65+
- `StreamAttachmentPickerOption` replaced with two sealed classes:
66+
- `SystemAttachmentPickerOption` for system pickers (camera, files)
67+
- `TabbedAttachmentPickerOption` for tabbed pickers (gallery, polls, location)
68+
69+
#### Migration Steps:
70+
71+
**Before:**
72+
```dart
73+
final option = AttachmentPickerOption(
74+
title: 'Gallery',
75+
icon: Icon(Icons.photo_library),
76+
supportedTypes: [AttachmentPickerType.images, AttachmentPickerType.videos],
77+
optionViewBuilder: (context, controller) {
78+
return GalleryPickerView(controller: controller);
79+
},
80+
);
81+
82+
final webOrDesktopOption = WebOrDesktopAttachmentPickerOption(
83+
title: 'File Upload',
84+
icon: Icon(Icons.upload_file),
85+
type: AttachmentPickerType.files,
86+
);
87+
```
88+
89+
**After:**
90+
```dart
91+
// For custom UI pickers (gallery, polls)
92+
final tabbedOption = TabbedAttachmentPickerOption(
93+
title: 'Gallery',
94+
icon: Icon(Icons.photo_library),
95+
supportedTypes: [AttachmentPickerType.images, AttachmentPickerType.videos],
96+
optionViewBuilder: (context, controller) {
97+
return GalleryPickerView(controller: controller);
98+
},
99+
);
100+
101+
// For system pickers (camera, file dialogs)
102+
final systemOption = SystemAttachmentPickerOption(
103+
title: 'Camera',
104+
icon: Icon(Icons.camera_alt),
105+
supportedTypes: [AttachmentPickerType.images],
106+
onTap: (context, controller) => pickFromCamera(),
107+
);
108+
```
109+
110+
> ⚠️ **Important:**
111+
> - Use `SystemAttachmentPickerOption` for system pickers (camera, file dialogs)
112+
> - Use `TabbedAttachmentPickerOption` for custom UI pickers (gallery, polls)
113+
114+
---
115+
116+
### 🛠 showStreamAttachmentPickerModalBottomSheet
117+
118+
#### Key Changes:
119+
120+
- Now returns `StreamAttachmentPickerResult` instead of `AttachmentPickerValue`
121+
- Improved type safety and clearer intent handling
122+
123+
#### Migration Steps:
124+
125+
**Before:**
126+
```dart
127+
final result = await showStreamAttachmentPickerModalBottomSheet(
128+
context: context,
129+
controller: controller,
130+
);
131+
132+
// result is AttachmentPickerValue
133+
```
134+
135+
**After:**
136+
```dart
137+
final result = await showStreamAttachmentPickerModalBottomSheet(
138+
context: context,
139+
controller: controller,
140+
);
141+
142+
// result is StreamAttachmentPickerResult
143+
switch (result) {
144+
case AttachmentsPicked():
145+
// Handle picked attachments
146+
case PollCreated():
147+
// Handle created poll
148+
case AttachmentPickerError():
149+
// Handle error
150+
case CustomAttachmentPickerResult():
151+
// Handle custom result
152+
}
153+
```
154+
155+
> ⚠️ **Important:**
156+
> Always handle the new `StreamAttachmentPickerResult` return type with proper switch cases.
157+
158+
---
159+
160+
### 🛠 AttachmentPickerBottomSheet
161+
162+
#### Key Changes:
163+
164+
- `StreamMobileAttachmentPickerBottomSheet``StreamTabbedAttachmentPickerBottomSheet`
165+
- `StreamWebOrDesktopAttachmentPickerBottomSheet``StreamSystemAttachmentPickerBottomSheet`
166+
167+
#### Migration Steps:
168+
169+
**Before:**
170+
```dart
171+
StreamMobileAttachmentPickerBottomSheet(
172+
context: context,
173+
controller: controller,
174+
customOptions: [option],
175+
);
176+
177+
StreamWebOrDesktopAttachmentPickerBottomSheet(
178+
context: context,
179+
controller: controller,
180+
customOptions: [option],
181+
);
182+
```
183+
184+
**After:**
185+
```dart
186+
StreamTabbedAttachmentPickerBottomSheet(
187+
context: context,
188+
controller: controller,
189+
customOptions: [tabbedOption],
190+
);
191+
192+
StreamSystemAttachmentPickerBottomSheet(
193+
context: context,
194+
controller: controller,
195+
customOptions: [systemOption],
196+
);
197+
```
198+
199+
> ⚠️ **Important:**
200+
> The new names better reflect their respective layouts and functionality.
201+
202+
---
203+
20204
## 🧪 Migration for v10.0.0-beta.1
21205

22206
### 🛠 StreamReactionPicker
@@ -182,6 +366,12 @@ StreamMessageWidget(
182366

183367
## 🎉 You're Ready to Migrate!
184368

369+
### For v10.0.0-beta.3:
370+
- ✅ Update attachment picker options to use `SystemAttachmentPickerOption` or `TabbedAttachmentPickerOption`
371+
- ✅ Handle new `StreamAttachmentPickerResult` return type from attachment picker
372+
- ✅ Use renamed bottom sheet classes (`StreamTabbedAttachmentPickerBottomSheet`, `StreamSystemAttachmentPickerBottomSheet`)
373+
374+
### For v10.0.0-beta.1:
185375
- ✅ Use `StreamReactionPicker.builder` or supply `onReactionPicked`
186376
- ✅ Convert all `StreamMessageAction` instances to type-safe generic usage
187377
- ✅ Centralize handling with `onCustomActionTap`

0 commit comments

Comments
 (0)