Skip to content

Commit 24f5ac9

Browse files
committed
Build the UI
1 parent e4a2b9c commit 24f5ac9

7 files changed

Lines changed: 283 additions & 130 deletions

File tree

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/workspace.xml

Lines changed: 173 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ios/Runner.xcodeproj/project.pbxproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@
9191
9740EEB11CF90186004384FC /* Flutter */,
9292
97C146F01CF9000F007C117D /* Runner */,
9393
97C146EF1CF9000F007C117D /* Products */,
94-
CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
9594
);
9695
sourceTree = "<group>";
9796
};
@@ -161,6 +160,7 @@
161160
TargetAttributes = {
162161
97C146ED1CF9000F007C117D = {
163162
CreatedOnToolsVersion = 7.3.1;
163+
DevelopmentTeam = ND65F85746;
164164
};
165165
};
166166
};
@@ -371,6 +371,7 @@
371371
buildSettings = {
372372
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
373373
CURRENT_PROJECT_VERSION = 1;
374+
DEVELOPMENT_TEAM = ND65F85746;
374375
ENABLE_BITCODE = NO;
375376
FRAMEWORK_SEARCH_PATHS = (
376377
"$(inherited)",
@@ -382,7 +383,7 @@
382383
"$(inherited)",
383384
"$(PROJECT_DIR)/Flutter",
384385
);
385-
PRODUCT_BUNDLE_IDENTIFIER = com.dragosholban.flutterWeather;
386+
PRODUCT_BUNDLE_IDENTIFIER = com.dragosholban.flutterWeather2;
386387
PRODUCT_NAME = "$(TARGET_NAME)";
387388
VERSIONING_SYSTEM = "apple-generic";
388389
};
@@ -394,6 +395,7 @@
394395
buildSettings = {
395396
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
396397
CURRENT_PROJECT_VERSION = 1;
398+
DEVELOPMENT_TEAM = ND65F85746;
397399
ENABLE_BITCODE = NO;
398400
FRAMEWORK_SEARCH_PATHS = (
399401
"$(inherited)",
@@ -405,7 +407,7 @@
405407
"$(inherited)",
406408
"$(PROJECT_DIR)/Flutter",
407409
);
408-
PRODUCT_BUNDLE_IDENTIFIER = com.dragosholban.flutterWeather;
410+
PRODUCT_BUNDLE_IDENTIFIER = com.dragosholban.flutterWeather2;
409411
PRODUCT_NAME = "$(TARGET_NAME)";
410412
VERSIONING_SYSTEM = "apple-generic";
411413
};
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>IDEDidComputeMac32BitWarning</key>
6+
<true/>
7+
</dict>
8+
</plist>

lib/main.dart

Lines changed: 51 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,64 @@
11
import 'package:flutter/material.dart';
22

3+
import 'package:flutter_weather/widgets/Weather.dart';
4+
import 'package:flutter_weather/widgets/WeatherItem.dart';
5+
36
void main() => runApp(new MyApp());
47

58
class MyApp extends StatelessWidget {
6-
// This widget is the root of your application.
79
@override
810
Widget build(BuildContext context) {
9-
return new MaterialApp(
10-
title: 'Flutter Demo',
11-
theme: new ThemeData(
12-
// This is the theme of your application.
13-
//
14-
// Try running your application with "flutter run". You'll see the
15-
// application has a blue toolbar. Then, without quitting the app, try
16-
// changing the primarySwatch below to Colors.green and then invoke
17-
// "hot reload" (press "r" in the console where you ran "flutter run",
18-
// or press Run > Flutter Hot Reload in IntelliJ). Notice that the
19-
// counter didn't reset back to zero; the application is not restarted.
11+
return MaterialApp(
12+
title: 'Flutter Weather App',
13+
theme: ThemeData(
2014
primarySwatch: Colors.blue,
2115
),
22-
home: new MyHomePage(title: 'Flutter Demo Home Page'),
23-
);
24-
}
25-
}
26-
27-
class MyHomePage extends StatefulWidget {
28-
MyHomePage({Key key, this.title}) : super(key: key);
29-
30-
// This widget is the home page of your application. It is stateful, meaning
31-
// that it has a State object (defined below) that contains fields that affect
32-
// how it looks.
33-
34-
// This class is the configuration for the state. It holds the values (in this
35-
// case the title) provided by the parent (in this case the App widget) and
36-
// used by the build method of the State. Fields in a Widget subclass are
37-
// always marked "final".
38-
39-
final String title;
40-
41-
@override
42-
_MyHomePageState createState() => new _MyHomePageState();
43-
}
44-
45-
class _MyHomePageState extends State<MyHomePage> {
46-
int _counter = 0;
47-
48-
void _incrementCounter() {
49-
setState(() {
50-
// This call to setState tells the Flutter framework that something has
51-
// changed in this State, which causes it to rerun the build method below
52-
// so that the display can reflect the updated values. If we changed
53-
// _counter without calling setState(), then the build method would not be
54-
// called again, and so nothing would appear to happen.
55-
_counter++;
56-
});
57-
}
58-
59-
@override
60-
Widget build(BuildContext context) {
61-
// This method is rerun every time setState is called, for instance as done
62-
// by the _incrementCounter method above.
63-
//
64-
// The Flutter framework has been optimized to make rerunning build methods
65-
// fast, so that you can just rebuild anything that needs updating rather
66-
// than having to individually change instances of widgets.
67-
return new Scaffold(
68-
appBar: new AppBar(
69-
// Here we take the value from the MyHomePage object that was created by
70-
// the App.build method, and use it to set our appbar title.
71-
title: new Text(widget.title),
72-
),
73-
body: new Center(
74-
// Center is a layout widget. It takes a single child and positions it
75-
// in the middle of the parent.
76-
child: new Column(
77-
// Column is also layout widget. It takes a list of children and
78-
// arranges them vertically. By default, it sizes itself to fit its
79-
// children horizontally, and tries to be as tall as its parent.
80-
//
81-
// Invoke "debug paint" (press "p" in the console where you ran
82-
// "flutter run", or select "Toggle Debug Paint" from the Flutter tool
83-
// window in IntelliJ) to see the wireframe for each widget.
84-
//
85-
// Column has various properties to control how it sizes itself and
86-
// how it positions its children. Here we use mainAxisAlignment to
87-
// center the children vertically; the main axis here is the vertical
88-
// axis because Columns are vertical (the cross axis would be
89-
// horizontal).
90-
mainAxisAlignment: MainAxisAlignment.center,
91-
children: <Widget>[
92-
new Text(
93-
'You have pushed the button this many times:',
94-
),
95-
new Text(
96-
'$_counter',
97-
style: Theme.of(context).textTheme.display1,
98-
),
99-
],
16+
home: Scaffold(
17+
backgroundColor: Colors.blueGrey,
18+
appBar: AppBar(
19+
title: Text('Flutter Weather App'),
10020
),
21+
body: Center(
22+
child: Column(
23+
mainAxisSize: MainAxisSize.min,
24+
children: <Widget>[
25+
Expanded(
26+
child: Column(
27+
mainAxisAlignment: MainAxisAlignment.center,
28+
children: <Widget>[
29+
Padding(
30+
padding: const EdgeInsets.all(8.0),
31+
child: Weather(),
32+
),
33+
Padding(
34+
padding: const EdgeInsets.all(8.0),
35+
child: IconButton(
36+
icon: new Icon(Icons.refresh),
37+
tooltip: 'Refresh',
38+
onPressed: () => null,
39+
color: Colors.white,
40+
),
41+
),
42+
],
43+
),
44+
),
45+
SafeArea(
46+
child: Padding(
47+
padding: const EdgeInsets.all(8.0),
48+
child: Container(
49+
height: 200.0,
50+
child: ListView.builder(
51+
itemCount: 10,
52+
scrollDirection: Axis.horizontal,
53+
itemBuilder: (context, index) => WeatherItem()
54+
),
55+
),
56+
),
57+
)
58+
]
59+
)
60+
)
10161
),
102-
floatingActionButton: new FloatingActionButton(
103-
onPressed: _incrementCounter,
104-
tooltip: 'Increment',
105-
child: new Icon(Icons.add),
106-
), // This trailing comma makes auto-formatting nicer for build methods.
10762
);
10863
}
109-
}
64+
}

lib/widgets/Weather.dart

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import 'package:flutter/material.dart';
2+
3+
class Weather extends StatelessWidget {
4+
@override
5+
Widget build(BuildContext context) {
6+
return Column(
7+
children: <Widget>[
8+
Text('New York', style: new TextStyle(color: Colors.white)),
9+
Text('Rain', style: new TextStyle(color: Colors.white, fontSize: 32.0)),
10+
Text('72°F', style: new TextStyle(color: Colors.white)),
11+
Image.network('https://openweathermap.org/img/w/01d.png'),
12+
Text('Jun 28, 2018', style: new TextStyle(color: Colors.white)),
13+
Text('18:30', style: new TextStyle(color: Colors.white)),
14+
],
15+
);
16+
}
17+
}

lib/widgets/WeatherItem.dart

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import 'package:flutter/material.dart';
2+
3+
class WeatherItem extends StatelessWidget {
4+
@override
5+
Widget build(BuildContext context) {
6+
return Card(
7+
child: Padding(
8+
padding: const EdgeInsets.all(8.0),
9+
child: Column(
10+
mainAxisAlignment: MainAxisAlignment.center,
11+
children: <Widget>[
12+
Text('New York', style: new TextStyle(color: Colors.black)),
13+
Text('Rain', style: new TextStyle(color: Colors.black, fontSize: 24.0)),
14+
Text('72°F', style: new TextStyle(color: Colors.black)),
15+
Image.network('https://openweathermap.org/img/w/01d.png'),
16+
Text('Jun 28, 2018', style: new TextStyle(color: Colors.black)),
17+
Text('18:30', style: new TextStyle(color: Colors.black)),
18+
],
19+
),
20+
),
21+
);
22+
}
23+
}

0 commit comments

Comments
 (0)