Created
January 6, 2021 14:11
-
-
Save pbakondy/b68c042631ce7e78bf46af61c0e05142 to your computer and use it in GitHub Desktop.
Fluffer Divider thickness
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 { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Startup Name Generator', | |
home: RandomWords() | |
); | |
} | |
} | |
class RandomWords extends StatefulWidget { | |
@override | |
_RandomWordsState createState() => _RandomWordsState(); | |
} | |
class _RandomWordsState extends State<RandomWords> { | |
final _biggerFont = TextStyle(fontSize: 18.0); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('Startup Name Generator'), | |
), | |
body: _buildSuggestions(), | |
); | |
} | |
Widget _buildSuggestions() { | |
return ListView.builder( | |
padding: EdgeInsets.all(16.0), | |
itemBuilder: (context, i) { | |
// docs states | |
// "A divider with a [thickness] of 0.0 is always drawn as a line with a height of exactly one device pixel." | |
// this is not true. thickness is 0 by default and no line is drawn | |
if (i.isOdd) return Divider(thickness: 1,); | |
return _buildRow(); | |
}); | |
} | |
Widget _buildRow() { | |
return ListTile( | |
title: Text( | |
'AaaaBaaa', | |
style: _biggerFont, | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment