Changed customising attachment guide to use controller
This commit is contained in:
@@ -184,10 +184,10 @@ To do this, we will:
|
|||||||
First, we add the attachment when the location button is clicked:
|
First, we add the attachment when the location button is clicked:
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
GlobalKey<StreamMessageInputState> _messageInputKey = GlobalKey();
|
StreamMessageInputController _messageInputController = StreamMessageInputController();
|
||||||
|
|
||||||
StreamMessageInput(
|
StreamMessageInput(
|
||||||
key: _messageInputKey,
|
messageInputController: _messageInputController,
|
||||||
actions: [
|
actions: [
|
||||||
InkWell(
|
InkWell(
|
||||||
child: Icon(
|
child: Icon(
|
||||||
@@ -197,7 +197,7 @@ First, we add the attachment when the location button is clicked:
|
|||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_determinePosition().then((value) {
|
_determinePosition().then((value) {
|
||||||
_messageInputKey.currentState.addAttachment(
|
_messageInputController.addAttachment(
|
||||||
Attachment(
|
Attachment(
|
||||||
uploadState: UploadState.success(),
|
uploadState: UploadState.success(),
|
||||||
type: 'location',
|
type: 'location',
|
||||||
@@ -220,7 +220,7 @@ After this, we can build the thumbnail:
|
|||||||
|
|
||||||
```dart
|
```dart
|
||||||
StreamMessageInput(
|
StreamMessageInput(
|
||||||
key: _messageInputKey,
|
messageInputController: _messageInputController,
|
||||||
actions: [
|
actions: [
|
||||||
InkWell(
|
InkWell(
|
||||||
child: Icon(
|
child: Icon(
|
||||||
@@ -230,7 +230,7 @@ StreamMessageInput(
|
|||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_determinePosition().then((value) {
|
_determinePosition().then((value) {
|
||||||
_messageInputKey.currentState.addAttachment(
|
_messageInputController.addAttachment(
|
||||||
Attachment(
|
Attachment(
|
||||||
uploadState: UploadState.success(),
|
uploadState: UploadState.success(),
|
||||||
type: 'location',
|
type: 'location',
|
||||||
|
|||||||
Reference in New Issue
Block a user