Last active
December 23, 2020 20:56
-
-
Save patryk-sredzinski/aa393c54639630868ee131a75f744cd5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
body: Center( | |
child: MyWidget(), | |
), | |
), | |
); | |
} | |
} | |
class MyWidget extends StatelessWidget { | |
final lorem = | |
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam euismod quam ut orci semper, quis convallis libero venenatis. Aliquam erat volutpat. Curabitur imperdiet tellus velit, ac tincidunt urna pellentesque ut.'; | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
width: 200, | |
height: 100, | |
color: Colors.green, | |
child: Text( | |
lorem, | |
overflow: TextOverflow.ellipsis, | |
/* | |
* Thats the place where the problem is, Ellipsis forces to use one line | |
* while having more space there to display. I'd love to get the 3/4 lines | |
* of text and at the end of the last possible line '...' | |
*/ | |
), | |
); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment