From d86a35027ea1337fff8e73e9c8f0069443c6f83e Mon Sep 17 00:00:00 2001 From: Shivam Goyal Date: Tue, 5 May 2020 06:58:38 +0530 Subject: [PATCH 1/4] force portrait orientation fix issue #3 --- lib/main.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index 18ad7a5..18c990d 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -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 From e1012d4c0b3a477c5052e171c3805c61d1774166 Mon Sep 17 00:00:00 2001 From: Shivam Goyal Date: Tue, 5 May 2020 07:01:47 +0530 Subject: [PATCH 2/4] delete false unit tests --- test/widget_test.dart | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/test/widget_test.dart b/test/widget_test.dart index 4d3d9b1..ae40864 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -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 {}); } From ef3297fe193452188f00c1ea08a72786665355c8 Mon Sep 17 00:00:00 2001 From: Shivam Goyal Date: Tue, 5 May 2020 08:34:25 +0530 Subject: [PATCH 3/4] fix location permission issue fix issue #1 --- lib/screens/homeScreen.dart | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/screens/homeScreen.dart b/lib/screens/homeScreen.dart index d45394f..fd8bf20 100644 --- a/lib/screens/homeScreen.dart +++ b/lib/screens/homeScreen.dart @@ -24,7 +24,6 @@ class _HomeScreenState extends State { @override void initState() { - dataState.getWeather(); super.initState(); } From 1e496776666e570e4a619ac6b01e5ed5e4bde958 Mon Sep 17 00:00:00 2001 From: Shivam Goyal Date: Tue, 5 May 2020 09:56:17 +0530 Subject: [PATCH 4/4] fix responsiveness for different ppi fix issue #2 [x] feels like is now visible on larger screens [x] visibility shows N/A instead of null [x] weather description is now responsive i.e, fix overflow [x] longer city names now end with ellipsis [x] add some padding where required [x] round wind speed --- lib/screens/homeScreen.dart | 68 ++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 20 deletions(-) diff --git a/lib/screens/homeScreen.dart b/lib/screens/homeScreen.dart index fd8bf20..a251d0a 100644 --- a/lib/screens/homeScreen.dart +++ b/lib/screens/homeScreen.dart @@ -119,7 +119,6 @@ class _HomeScreenState extends State { image: AssetImage('assets/images/header.png'), alignment: Alignment.centerRight), ), - height: 240.0, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 40.0), @@ -134,6 +133,7 @@ class _HomeScreenState extends State { fontSize: 45.0, fontWeight: FontWeight.w700, ), + overflow: TextOverflow.ellipsis, ), SizedBox(height: 10.0), Text( @@ -169,7 +169,7 @@ class _HomeScreenState extends State { ), ), Container( - child: Row( + child: Column( mainAxisAlignment: MainAxisAlignment.center, mainAxisSize: MainAxisSize.min, @@ -181,18 +181,45 @@ class _HomeScreenState extends State { '.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) ], ), @@ -214,8 +241,7 @@ class _HomeScreenState extends State { ), )), Container( - padding: EdgeInsets.symmetric( - vertical: 10.0, horizontal: 40.0), + padding: EdgeInsets.fromLTRB(40, 20, 40, 5), alignment: Alignment.centerLeft, child: Text( 'Details', @@ -224,10 +250,8 @@ class _HomeScreenState extends State { ), ), 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: [ @@ -349,8 +373,12 @@ class _HomeScreenState extends State { 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), @@ -418,7 +446,7 @@ class _HomeScreenState extends State { SizedBox(height: 6.0), Text( snapshot.data.wind.speed - .toString() + + .toStringAsFixed(1) + " km/h", style: TextStyle( fontWeight: FontWeight.w700,