Skip to content

Instantly share code, notes, and snippets.

@pbakondy
Created January 6, 2021 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbakondy/b68c042631ce7e78bf46af61c0e05142 to your computer and use it in GitHub Desktop.
Save pbakondy/b68c042631ce7e78bf46af61c0e05142 to your computer and use it in GitHub Desktop.
Fluffer Divider thickness
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