Last active
December 13, 2021 07:26
-
-
Save OnlyTarg/e4acaaa18939f6403d7a050009776760 to your computer and use it in GitHub Desktop.
Tear-off constructor on flutter_app
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(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: MyHomeScreen(), | |
); | |
} | |
} | |
class MyHomeScreen extends StatelessWidget { | |
MyHomeScreen({Key? key}) : super(key: key); | |
final List<String> stringList = ['S1', 'S2', 'S3']; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: const Text('Test App'), | |
), | |
body: Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: [ | |
Text('S1'), | |
Text('S2'), | |
Text('S3'), | |
] | |
), | |
), | |
); | |
} | |
} | |
//stringList.map((String s)=>Text(s)).toList(), | |
//stringList.map(Text.new).toList(), | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment