-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Text widget doesn't change it's size when line break happened #26585
Text widget doesn't change it's size when line break happened #26585
Comments
|
I believe the issue is a bit different here. The issue is the extra white space at end of text. Example code final String message = 'It is a long established fact that a reader will be dist';
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.only(bottom: 8.0, left: 8.0, right: 8.0),
padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Colors.teal,
borderRadius: BorderRadius.only(
topRight: Radius.circular(15.0),
topLeft: Radius.circular(15.0),
bottomLeft: Radius.circular(15.0),
bottomRight: Radius.circular(0.0),
)
),
child: Text(message)
);
} Now if the message is changed to Notice the extra white space at end of the text. |
yes that's a problem |
I see. Thanks for the clarification @Renesanse @Kartik1607 ! |
@Kartik1607 |
@kangwang1988 Can confirm the issue exists on latest master. Code void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(context) {
return MaterialApp(
theme: ThemeData(
brightness: Brightness.light,
primarySwatch: Colors.deepOrange,
accentColor: Colors.deepPurple),
home: Scaffold(
body: Center(
child: CardPage(),
),
));
}
}
class CardPage extends StatelessWidget {
final String message = 'It is a long established fact that a reader byethereadablecontent';
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.only(bottom: 8.0, left: 8.0, right: 8.0),
padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Colors.teal,
borderRadius: BorderRadius.only(
topRight: Radius.circular(15.0),
topLeft: Radius.circular(15.0),
bottomLeft: Radius.circular(15.0),
bottomRight: Radius.circular(0.0),
)
),
child: Text(message)
);
}
} Flutter doctor
|
just write a string with 70 percent of screen width and add word with 35 percent width, and you will see that issue |
My colleague tells me that problem can be inside paragraph builder |
Actually I'm going to keep this open until the other PR goes in: #30988 |
Reopening since the PR was reverted. This should be fixed soon, there's just some weird build error... |
Alright this is merged and should be good to go. Here's how you accomplish the chat bubble effect:
Text(
string,
textWidthBasis: TextWidthBasis.longestLine,
) |
Good job!) Thanks |
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of |
Same problem from android, there I override onMeasure to change Text widget size when line break happened.
Here is code
The text was updated successfully, but these errors were encountered: