Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[upgrade]-lib\ChatBotPage.dart- Updated the background color of the c… #255

Merged

Conversation

Vedanshi27vishu
Copy link
Contributor

[upgrade]-lib\ChatBotPage.dart- Updated the background color of the chatbox according to theme.

Problem / Issue No.

  • The problem was that when we switch to darkmode theme the text of chatbox of user was not visible.

Describe Problem / Root Cause

  • The root cause was that the color was switching according to user message and bot message but we need to switch according to the theme.

Solution proposed

  • The solution was to switch the color according to the adaptive theme. Here is the code for same.
    BoxDecoration(
    color:isUser
    ? (AdaptiveTheme.of(context).mode.isDark ? Color.fromARGB(255, 31, 49, 70) : Colors.blue[100])
    : (AdaptiveTheme.of(context).mode.isDark ? Colors.grey[700] : Colors.grey[300]),
    borderRadius: BorderRadius.circular(10.0),
    ),

==>User Messages (isUser == true):
In dark mode: Color.fromARGB(255, 31, 49, 70)
In light mode: Colors.blue[100]
==>Bot Messages (isUser == false):
In dark mode: Colors.grey[700]
In light mode: Colors.grey[300]

Additional Information

  • Just added AdaptiveTheme.of(context).mode.isDark to solve the issue.

Screenshots

  • Original Screenshot (Problem/Issue)

Problem

  • Updated Screenshot (Fixes/Solution)

Solved-In dark mode
Solved-In light mode

Copy link

Thank you for submitting your pull request! We'll review it as soon as possible.

@andoriyaprashant andoriyaprashant merged commit aa581b9 into andoriyaprashant:main Jul 21, 2024
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants