Untitled
unknown
plain_text
4 years ago
1.8 kB
10
Indexable
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
main() => runApp(MaterialApp(home: MyPageView()));
class ClimateData {
static List info = [
"from climate.gov.id",
"Since 1980, the U.S. has sustained 241 weather and climate disasters where the overall damage costs reached or exceeded 1 billion USD",
"The cumulative cost for these 241 events exceeds 1.6 trillion USD.",
"Reference:",
"https://www.climate.gov/news-features/blogs/beyond-data/2018s-billion-dollar-disasters-context"];
}
class MyPageView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.red[900],
title: Text("Billion Dollar Disasters (US)"),
),
body: Container(
padding: EdgeInsets.all(4.0),
color: Colors.grey[800],
child: PageView.builder(
itemCount: ClimateData.info.length,
itemBuilder: (BuildContext context, index) {
return _buildPageItem(context, index);
},
)
)
);
}
Widget _buildPageItem(BuildContext context, int itemIndex) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 4.0),
margin: EdgeInsets.all(2.0),
alignment: Alignment.center,
child: Container(
constraints: BoxConstraints(
maxHeight: 300.0,
maxWidth: 400.0,
minWidth: 150.0,
minHeight: 200.0
),
padding: EdgeInsets.all(4.0),
alignment: Alignment.center,
child: Text(ClimateData.info[itemIndex],
style: TextStyle(
wordSpacing: 2.0,
color: Colors.white,
fontSize: 20.0),
),
),
);
}
}Editor is loading...