Last active
February 15, 2023 20:57
-
-
Save kostasoft/1b4b6168b44ea9428137bb26fafdfcb0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { | |
| Widget item(String title, String text, Color background) => ColoredBox( | |
| color: background, | |
| child: Column( | |
| mainAxisSize: MainAxisSize.min, | |
| crossAxisAlignment: CrossAxisAlignment.start, | |
| children: [ | |
| ColoredBox( | |
| color: Colors.blueGrey, | |
| child: Padding(padding: const EdgeInsets.all(8.0), child: Text(title)), | |
| ), | |
| Padding(padding: const EdgeInsets.all(8.0), child: Text(text)), | |
| ])); | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| title: 'Flutter App', | |
| home: Scaffold( | |
| backgroundColor: Colors.white, | |
| body: Column( | |
| crossAxisAlignment: CrossAxisAlignment.start, | |
| children: [ | |
| item('short title', 'looooooooooooooooong text', Colors.grey), | |
| const SizedBox(height: 8.0), | |
| item('loooooooooooooong title', 'short text', Colors.grey), | |
| ], | |
| ), | |
| ), | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment