Skip to content

Commit

Permalink
Merge pull request #5 from ShivamGoyal1899/develop
Browse files Browse the repository at this point in the history
Issue Fix #1 #2 #3
  • Loading branch information
shyvum authored May 5, 2020
2 parents f4771c2 + 1e49677 commit f1ff95a
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 41 deletions.
9 changes: 8 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import 'package:EasyWeather/screens/splashScreen.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() => runApp(MyApp());
void main() {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitDown, DeviceOrientation.portraitUp]).then((_) {
runApp(MyApp());
});
}

class MyApp extends StatelessWidget {
@override
Expand Down
69 changes: 48 additions & 21 deletions lib/screens/homeScreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class _HomeScreenState extends State<HomeScreen> {

@override
void initState() {
dataState.getWeather();
super.initState();
}

Expand Down Expand Up @@ -120,7 +119,6 @@ class _HomeScreenState extends State<HomeScreen> {
image: AssetImage('assets/images/header.png'),
alignment: Alignment.centerRight),
),
height: 240.0,
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 40.0),
Expand All @@ -135,6 +133,7 @@ class _HomeScreenState extends State<HomeScreen> {
fontSize: 45.0,
fontWeight: FontWeight.w700,
),
overflow: TextOverflow.ellipsis,
),
SizedBox(height: 10.0),
Text(
Expand Down Expand Up @@ -170,7 +169,7 @@ class _HomeScreenState extends State<HomeScreen> {
),
),
Container(
child: Row(
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
Expand All @@ -182,18 +181,45 @@ class _HomeScreenState extends State<HomeScreen> {
'.png',
height: 40,
),
Text(
' ' +
snapshot.data.weather[0].description
.contains(' ')
? Text(
snapshot.data.weather[0]
.description[0]
.toUpperCase() +
.description
.split(' ')[0][0]
.toUpperCase() +
snapshot.data.weather[0]
.description
.split(' ')[0]
.substring(1) +
'\n' +
snapshot.data.weather[0]
.description
.split(' ')[1][0]
.toUpperCase() +
snapshot.data.weather[0]
.description
.split(' ')[1]
.substring(1),
style: TextStyle(
fontSize: 16.0,
fontWeight:
FontWeight.w500),
textAlign: TextAlign.center,
)
: Text(
snapshot.data.weather[0]
.description
.substring(1),
style: TextStyle(
fontSize: 20.0,
fontWeight:
FontWeight.w500)),
.description[0]
.toUpperCase() +
snapshot.data.weather[0]
.description
.substring(1),
style: TextStyle(
fontSize: 16.0,
fontWeight:
FontWeight.w500),
textAlign: TextAlign.center,
),
SizedBox(height: 5.0)
],
),
Expand All @@ -215,8 +241,7 @@ class _HomeScreenState extends State<HomeScreen> {
),
)),
Container(
padding: EdgeInsets.symmetric(
vertical: 10.0, horizontal: 40.0),
padding: EdgeInsets.fromLTRB(40, 20, 40, 5),
alignment: Alignment.centerLeft,
child: Text(
'Details',
Expand All @@ -225,10 +250,8 @@ class _HomeScreenState extends State<HomeScreen> {
),
),
Container(
height: 260.0,
child: Padding(
padding:
const EdgeInsets.symmetric(horizontal: 20.0),
padding: const EdgeInsets.fromLTRB(20, 5, 20, 20),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Expand Down Expand Up @@ -350,8 +373,12 @@ class _HomeScreenState extends State<HomeScreen> {
SizedBox(height: 6.0),
Text(
snapshot.data.visibility
.toString() +
' m',
.toString() ==
'null'
? 'N/A'
: snapshot.data.visibility
.toString() +
' m',
style: TextStyle(
fontWeight: FontWeight.w700,
fontSize: 24.0),
Expand Down Expand Up @@ -419,7 +446,7 @@ class _HomeScreenState extends State<HomeScreen> {
SizedBox(height: 6.0),
Text(
snapshot.data.wind.speed
.toString() +
.toStringAsFixed(1) +
" km/h",
style: TextStyle(
fontWeight: FontWeight.w700,
Expand Down
20 changes: 1 addition & 19 deletions test/widget_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,8 @@
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:EasyWeather/main.dart';

void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());

// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);

// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();

// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
testWidgets('Counter increments smoke test', (WidgetTester tester) async {});
}

0 comments on commit f1ff95a

Please sign in to comment.