Skip to content

Instantly share code, notes, and snippets.

@iapicca
Last active December 30, 2019 17:53
Show Gist options
  • Save iapicca/2ce88e6f35fee8acda89bb77c8beba4d to your computer and use it in GitHub Desktop.
Save iapicca/2ce88e6f35fee8acda89bb77c8beba4d to your computer and use it in GitHub Desktop.
Lorem ipsum maxLines + extOverflow.ellipsis
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp( home: MyHomePage(),);
}
class MyHomePage extends StatelessWidget {
static const String _lorenIpsum = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec iaculis orci vel tempor dignissim. Praesent nisl neque, iaculis et euismod ut, dignissim non arcu. In vel convallis mauris, a viverra turpis. Curabitur ac erat pulvinar, mattis nisl eu, placerat risus. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis cursus, nisi eu molestie vulputate, libero tellus convallis purus, id cursus sapien orci at velit. Duis placerat et massa et molestie. Quisque id elit blandit, tempor nulla non, faucibus ex. Pellentesque elementum cursus neque, vitae ultricies massa molestie nec. Morbi a eros finibus, sagittis mi eget, gravida.';
@override
Widget build(BuildContext context) => Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(_lorenIpsum,
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
Container(
height: 40,
),
Text(_lorenIpsum,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],),);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment