Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to change comment_box userImage on flutter with local img?

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),
          ),
        ),

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading