Skip to content

Instantly share code, notes, and snippets.

@stephaniefash
Last active August 10, 2020 17:37
Show Gist options
  • Save stephaniefash/ff21333e3f2670cce63601d2a064db3c to your computer and use it in GitHub Desktop.
Save stephaniefash/ff21333e3f2670cce63601d2a064db3c to your computer and use it in GitHub Desktop.
class _MyHomePageState extends State<MyHomePage> {
String myText = "0123456789";
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black,
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Wrap(
alignment: WrapAlignment.center,
direction: Axis.vertical, //stack individual text widgets on top of each other
children: _arrayOfText(),
),
),
);
}
List<Text> _arrayOfText() { // split our text into individual text widgets
return myText
.split("")
.map((letter) => Text(
letter,
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 40,
color: Colors.white),
))
.toList();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment