i made comment box with flutter with comment_box package but i tried change the 'userImage' to local img but it seems doesn't work. anyone have any solution to change it?
here's my code:
Expanded(
child: CommentBox(
userImage: 'assets/profile_icon.png',
child: commentChild(filedata),
labelText: 'Write a comment...',
withBorder: false,
errorText: 'Comment cannot be blank',
sendButtonMethod: () {
if (formKey.currentState!.validate()) {
print(commentController.text);
setState(() {
addComment();
});
FocusScope.of(context).unfocus();
} else {
print("Not validated");
}
},
formKey: formKey,
commentController: commentController,
backgroundColor: Color.fromARGB(255, 255, 255, 255),
textColor: Color.fromARGB(255, 0, 0, 0),
sendWidget: Icon(Icons.send_sharp, size: 30, color: Colors.grey),
),
),
CodePudding user response:
Unfortunately, there is no way to use your local image for userImage
parameter. In comment_box 0.0.17
package configuration, it uses Network Image
to display userImage
in UI, and it accepts only URL text (String userImage)
. In this case, you have to configure a custom comment box for your UI or you can continue to search for another package for your UI implementation.
dependencies:
comment_box: ^0.0.17