Created
July 2, 2018 06:03
-
-
Save Blasanka/264510a0e7e5aaa151f02ada19fd466d to your computer and use it in GitHub Desktop.
This is a very long text used to demonstrate how to wrap text inside a Column or Row widget. And also to show how to add another row of icon button next to these text widget without going overflow and be center of text widget in main axis
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(new MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new MaterialApp( | |
title: 'LogIn n SignUp', | |
theme: ThemeData( | |
primaryColor: Colors.green, | |
), | |
home: Scaffold( | |
body: SafeArea( | |
child: new Row(children: <Widget>[ | |
new Flexible( // to wrap text widget | |
flex: 2, // to wrap text widget | |
child: new Column( | |
mainAxisSize: MainAxisSize.min, // to wrap text widget | |
crossAxisAlignment: CrossAxisAlignment.start, // to wrap text widget | |
children: <Widget>[ | |
new Text("This is a very long text used to demonstrate how to wrap text inside a Column or Row widget"), | |
new Text("And also to show how to add another row of icon button next to these text widget without going overflow and be senter of text widget in main axis", | |
overflow: TextOverflow.ellipsis), // add dots to show this is a longer text | |
], | |
), | |
), | |
new Expanded( | |
child: new Row( | |
children: <Widget>[ | |
new Container( | |
child: new IconButton( | |
icon: new Icon(Icons.check, | |
color: Colors.green, size: 35.0), | |
onPressed: () {}), | |
margin: new EdgeInsets.only(right: 10.0), | |
), | |
new IconButton( | |
icon: new Icon(Icons.remove, color: Colors.red, size: 35.0), | |
onPressed: () {}), | |
], | |
)), | |
]), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment