Created
October 22, 2020 16:45
-
-
Save timsneath/4e6fa1f0131adee15dd236d8cab9c88d 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
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
// Get data from services. Note: in a real application, | |
// these would be async calls, but we're using sync calls | |
// for simplicity. | |
final localizedAppName = Config.getAppName(); | |
final temperatures = WeatherService.getTemperatures(); | |
return MaterialApp( | |
home: Scaffold( | |
appBar: AppBar(title: Text(localizedAppName)), | |
body: Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
Text('Temperature next 3 days:'), | |
for (final t in temperatures) | |
Text(t.round().toString()), | |
], | |
), | |
), | |
), | |
); | |
} | |
} | |
class Config { | |
static String getAppName() { ... } | |
} | |
class WeatherService { | |
static List<double> getTemperatures() { ...} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment