diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite index efaa37a..6ba80db 100644 Binary files a/.vs/slnx.sqlite and b/.vs/slnx.sqlite differ diff --git a/.vs/weather-alert-app/v16/.suo b/.vs/weather-alert-app/v16/.suo index 778e6a7..f7b9b03 100644 Binary files a/.vs/weather-alert-app/v16/.suo and b/.vs/weather-alert-app/v16/.suo differ diff --git a/.vs/weather-alert-app/v16/Browse.VC.db b/.vs/weather-alert-app/v16/Browse.VC.db index 543a550..38b6d27 100644 Binary files a/.vs/weather-alert-app/v16/Browse.VC.db and b/.vs/weather-alert-app/v16/Browse.VC.db differ diff --git a/lib/src/screens/alert_rescue.dart b/lib/src/screens/alert_rescue.dart index 1d2ffe7..824ee04 100644 --- a/lib/src/screens/alert_rescue.dart +++ b/lib/src/screens/alert_rescue.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; -import 'package:weather_alert_app/config/app_config.dart' as config; import 'package:weather_alert_app/provider/base_view.dart'; +import 'package:weather_alert_app/src/widgets/search_bar.dart'; import 'package:weather_alert_app/views/weatherinfo_viewmodel.dart'; class AlertRescue extends StatelessWidget { @@ -18,6 +18,7 @@ class AlertRescue extends StatelessWidget { child: Scaffold( body: Column( children: [ + SearchBar(), Center( child: Container( child: Column( diff --git a/lib/src/screens/forecast_screen.dart b/lib/src/screens/forecast_screen.dart index 9671d06..97fae3c 100644 --- a/lib/src/screens/forecast_screen.dart +++ b/lib/src/screens/forecast_screen.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:weather_alert_app/config/app_config.dart' as config; import 'package:weather_alert_app/provider/base_view.dart'; +import 'package:weather_alert_app/src/widgets/search_bar.dart'; import 'package:weather_alert_app/views/weatherinfo_viewmodel.dart'; class ForecastScreen extends StatelessWidget { @@ -13,78 +14,24 @@ class ForecastScreen extends StatelessWidget { double width = MediaQuery.of(context).size.width; return BaseView( - onModelReady: (model) => model.getWeatherData(), - builder: (ctx, model, child) => SafeArea( - child: Scaffold( + onModelReady: (model) => model.getWeatherData(), + builder: (ctx, model, child) => SafeArea( + child: Scaffold( body: SingleChildScrollView( child: Container( child: Column( children: [ - Padding( - padding: const EdgeInsets.fromLTRB(15, 20, 15, 10), - child: Container( - height: height / 15, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(15.0)), - color: const Color.fromRGBO(58, 74, 88, 1), - ), - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Icon( - Icons.article, - size: height / 25, - color: Color.fromRGBO(181, 205, 242, 1), - ), - // Text( - // 'Patna, India', - // style: TextStyle( - // color: Colors.white, - // fontSize: height / 34, - // fontWeight: FontWeight.w400), - // ), - IconButton( - onPressed: () { - // setState(() { - // TextField( - // decoration: InputDecoration( - // hintText: 'Patna, India', - // hintStyle: TextStyle( - // color: Colors.white, - // fontSize: 18, - // fontStyle: FontStyle.italic, - // ), - // border: InputBorder.none, - // ), - // style: TextStyle( - // color: Colors.white, - // ), - // ); - // } - // ); - }, - icon: Icon( - Icons.search, - size: height / 25, - ), - color: Colors.white, - ) - ], - ), - ), - ), - ), + // SizedBox(height: 90), + SearchBar(), Container( height: 30, width: width, - child: Center( + child: Center( child: Text("No alert now", style: TextStyle( color: Colors.green, fontWeight: FontWeight.w500, - fontSize: width/17, + fontSize: width / 17, ))), ), Container( @@ -94,7 +41,8 @@ class ForecastScreen extends StatelessWidget { shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(12.0), ), - child: Center(child: Text(model.dateP0 + " - " + model.dateP3)), + child: + Center(child: Text("December 29 - January 10")), elevation: 43, ), ), @@ -127,7 +75,8 @@ class ForecastScreen extends StatelessWidget { fontSize: width / 27.5, )), const SizedBox(height: 20), - Icon(Icons.wb_sunny, color: Colors.yellow[500]), + Icon(Icons.wb_sunny, + color: Colors.yellow[500]), const SizedBox(height: 20), Text(model.maxTemp0, style: TextStyle( @@ -174,7 +123,8 @@ class ForecastScreen extends StatelessWidget { fontSize: width / 27.5, )), const SizedBox(height: 20), - Icon(Icons.wb_sunny, color: Colors.yellow[500]), + Icon(Icons.wb_sunny, + color: Colors.yellow[500]), const SizedBox(height: 20), Text(model.maxTemp1, style: TextStyle( @@ -221,7 +171,8 @@ class ForecastScreen extends StatelessWidget { fontSize: width / 27.5, )), const SizedBox(height: 20), - Icon(Icons.wb_sunny, color: Colors.yellow[500]), + Icon(Icons.wb_sunny, + color: Colors.yellow[500]), const SizedBox(height: 20), Text(model.maxTemp2, style: TextStyle( @@ -268,7 +219,8 @@ class ForecastScreen extends StatelessWidget { fontSize: width / 27.5, )), const SizedBox(height: 20), - Icon(Icons.wb_sunny, color: Colors.yellow[500]), + Icon(Icons.wb_sunny, + color: Colors.yellow[500]), const SizedBox(height: 20), Text(model.maxTemp3, style: TextStyle( @@ -295,98 +247,105 @@ class ForecastScreen extends StatelessWidget { ), Container( width: width / 1.1, - child: Column( - children: [ - Container( - height: 105, - width: width / 1.1, - child: Card( - color: const Color.fromRGBO(255, 255, 255, 1), - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topLeft: Radius.circular(11), - topRight: Radius.circular(11))), - child: Column( + child: Column(children: [ + Container( + height: 105, + width: width / 1.1, + child: Card( + color: const Color.fromRGBO(255, 255, 255, 1), + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topLeft: Radius.circular(11), + topRight: Radius.circular(11))), + child: Column( + children: [ + Row( children: [ - Row( - children: [ - SizedBox(width: width / 44), - Text( - "Day", - style: TextStyle( - color: Color.fromRGBO(0, 0, 0, 1), - fontWeight: FontWeight.w400, - fontSize: width / 22, - ), - ), - SizedBox(width: width / 4.4), - Icon(Icons.wb_sunny, color: Colors.yellow), - SizedBox(width: width / 4.4), - Text("19"), - SizedBox(width: width / 22), - Icon(Icons.arrow_upward, color: Colors.black54), - ], - ), - Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text(model.desc + "," + "High"), - Text("......................."), - Text("............"), - ], + SizedBox(width: width / 44), + Text( + "Day", + style: TextStyle( + color: Color.fromRGBO(0, 0, 0, 1), + fontWeight: FontWeight.w400, + fontSize: width / 22, ), - ) + ), + SizedBox(width: width / 4.4), + Icon(Icons.wb_sunny, + color: Colors.yellow), + SizedBox(width: width / 4.4), + Text("19"), + SizedBox(width: width / 22), + Icon(Icons.arrow_upward, + color: Colors.black54), ], - )), - ), - Container( - height: 105, - width: width / 1.1, - child: Card( - color: Color.fromRGBO(55, 86, 116, 1), - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(11), - bottomRight: Radius.circular(11))), - child: Column( + ), + Container( + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: const [ + Text("Sunny,High"), + Text("......................."), + Text("............"), + ], + ), + ) + ], + )), + ), + Container( + height: 105, + width: width / 1.1, + child: Card( + color: Color.fromRGBO(55, 86, 116, 1), + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + bottomLeft: Radius.circular(11), + bottomRight: Radius.circular(11))), + child: Column( + children: [ + Row( children: [ - Row( - children: [ - SizedBox(width: width / 44), - Text( - "Night", - style: TextStyle( - color: Color.fromRGBO(255, 255, 255, 1), - fontWeight: FontWeight.w400, - fontSize: width / 22, - ), - ), - SizedBox(width: width / 4.4), - Icon(Icons.wb_cloudy_outlined, - color: Colors.yellow[500]), - SizedBox(width: width / 4.4), - Text("19"), - SizedBox(width: width / 22), - Icon(Icons.arrow_downward_sharp, - color: Colors.black54), - ], - ), - Container( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( model.desc + "," + "High"), - Text("......................."), - Text("............"), - ], + SizedBox(width: width / 44), + Text( + "Night", + style: TextStyle( + color: Color.fromRGBO( + 255, 255, 255, 1), + fontWeight: FontWeight.w400, + fontSize: width / 22, ), - ) + ), + SizedBox(width: width / 4.4), + Icon(Icons.wb_cloudy_outlined, + color: Colors.yellow[500]), + SizedBox(width: width / 4.4), + Text("19"), + SizedBox(width: width / 22), + Icon(Icons.arrow_downward_sharp, + color: Colors.black54), ], - )), - ),]), + ), + Container( + child: Column( + mainAxisAlignment: + MainAxisAlignment.start, + crossAxisAlignment: + CrossAxisAlignment.start, + children: const [ + Text("Sunny,High"), + Text("......................."), + Text("............"), + ], + ), + ) + ], + )), + ), + ]), ), ], ), diff --git a/lib/src/screens/weather_info_screen.dart b/lib/src/screens/weather_info_screen.dart index 0266bcc..ef13ed8 100644 --- a/lib/src/screens/weather_info_screen.dart +++ b/lib/src/screens/weather_info_screen.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:weather_alert_app/provider/getit.dart'; import 'package:weather_alert_app/config/app_config.dart' as config; import 'package:weather_alert_app/provider/base_view.dart'; +import 'package:weather_alert_app/src/widgets/search_bar.dart'; import 'package:weather_alert_app/views/weatherinfo_viewmodel.dart'; class WeatherInfoScreen extends StatelessWidget { @@ -13,48 +14,49 @@ class WeatherInfoScreen extends StatelessWidget { double width = MediaQuery.of(context).size.width; return BaseView( builder: (ctx, model, child) => SafeArea( - child : Scaffold( + child: Scaffold( body: SingleChildScrollView( child: Container( width: width, - decoration: const BoxDecoration( - - ), + decoration: const BoxDecoration(), child: Column( - crossAxisAlignment :CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox(height: 90), + // SizedBox(height: 90), + SearchBar(), Container( height: 223, - width: width/1, + width: width / 1, child: Card( color: Color.fromRGBO(255, 255, 255, 1), child: Column( children: [ Row( - children: [ + children: [ SizedBox( - width: width/8, + width: width / 8, ), Text( "29-Dec-2021", style: TextStyle( fontWeight: FontWeight.w400, - fontSize: width/20, - color: Color.fromRGBO(101, 98, 98, 1)), + fontSize: width / 20, + color: + Color.fromRGBO(101, 98, 98, 1)), ), SizedBox( - width: width/4, + width: width / 4, ), Text( "9:02 PM", style: TextStyle( fontWeight: FontWeight.w400, - fontSize: width/20, - color: Color.fromRGBO(101, 98, 98, 1)), + fontSize: width / 20, + color: + Color.fromRGBO(101, 98, 98, 1)), ), SizedBox( - width: width/8.3, + width: width / 8.3, ), ], ), @@ -62,7 +64,7 @@ class WeatherInfoScreen extends StatelessWidget { children: [ Container( height: 98, - width: width/7.5, + width: width / 7.5, child: Icon(Icons.wb_cloudy, color: Colors.blue)), Column( @@ -73,7 +75,7 @@ class WeatherInfoScreen extends StatelessWidget { Text( "12 C", style: TextStyle( - fontSize: width/11.8, + fontSize: width / 11.8, fontWeight: FontWeight.w400, color: Color.fromRGBO(0, 0, 0, 1), ), @@ -81,23 +83,24 @@ class WeatherInfoScreen extends StatelessWidget { Text( "Thunderstorm", style: TextStyle( - fontSize: width/22, + fontSize: width / 22, fontWeight: FontWeight.w400, - color: Color.fromRGBO(20, 48, 90, 1), + color: + Color.fromRGBO(20, 48, 90, 1), ), ), SizedBox( height: 10, ), Row( - children: [ + children: [ Text( "19 C", style: TextStyle( - fontSize: width/22, + fontSize: width / 22, fontWeight: FontWeight.w400, - color: - Color.fromRGBO(20, 48, 90, 1), + color: Color.fromRGBO( + 20, 48, 90, 1), ), ), Icon(Icons.arrow_upward_sharp, @@ -108,14 +111,14 @@ class WeatherInfoScreen extends StatelessWidget { height: 10, ), Row( - children: [ + children: [ Text( "9 C", style: TextStyle( - fontSize: width/22, + fontSize: width / 22, fontWeight: FontWeight.w400, - color: - Color.fromRGBO(20, 48, 90, 1), + color: Color.fromRGBO( + 20, 48, 90, 1), ), ), Icon(Icons.arrow_downward_sharp, @@ -125,19 +128,20 @@ class WeatherInfoScreen extends StatelessWidget { ], ), SizedBox( - width: width/11, + width: width / 11, ), SizedBox( - width: width/40, + width: width / 40, height: 180.0, child: DecoratedBox( decoration: BoxDecoration( - color: Color.fromRGBO(196, 196, 196, 1), + color: + Color.fromRGBO(196, 196, 196, 1), ), ), ), SizedBox( - width: width/22, + width: width / 22, ), Column( children: const [ @@ -149,7 +153,7 @@ class WeatherInfoScreen extends StatelessWidget { ], ), SizedBox( - width:width/22, + width: width / 22, ), Column( children: const [ @@ -172,12 +176,12 @@ class WeatherInfoScreen extends StatelessWidget { ), Container( height: 30, - child: Center( + child: Center( child: Text("No alert now", style: TextStyle( color: Colors.green, fontWeight: FontWeight.w500, - fontSize: width/16.9, + fontSize: width / 16.9, ))), ), SizedBox( @@ -185,7 +189,7 @@ class WeatherInfoScreen extends StatelessWidget { ), Container( height: 127, - width: width/1, + width: width / 1, child: Card( color: Color.fromRGBO(255, 255, 255, 1), shape: const RoundedRectangleBorder( @@ -197,7 +201,7 @@ class WeatherInfoScreen extends StatelessWidget { child: Row( children: [ SizedBox( - width: width/22, + width: width / 22, ), Column( children: const [ @@ -212,7 +216,7 @@ class WeatherInfoScreen extends StatelessWidget { ], ), SizedBox( - width: width/2.2, + width: width / 2.2, ), Column( children: const [ @@ -236,7 +240,7 @@ class WeatherInfoScreen extends StatelessWidget { ), Container( height: 187, - width: width/1, + width: width / 1, child: Card( color: Color.fromRGBO(255, 255, 255, 1), shape: const RoundedRectangleBorder( @@ -253,14 +257,14 @@ class WeatherInfoScreen extends StatelessWidget { Row( children: [ SizedBox( - width: width/29.3, + width: width / 29.3, ), Icon( Icons.wb_cloudy_rounded, color: Colors.cyanAccent, ), SizedBox( - width: width/29.3, + width: width / 29.3, ), Column( children: [ @@ -270,7 +274,7 @@ class WeatherInfoScreen extends StatelessWidget { Text("AQI", style: TextStyle( fontWeight: FontWeight.w500, - fontSize: width/22, + fontSize: width / 22, )), SizedBox( height: 15, @@ -278,28 +282,28 @@ class WeatherInfoScreen extends StatelessWidget { Text("70 | LOW", style: TextStyle( fontWeight: FontWeight.w400, - fontSize: width/29.3, + fontSize: width / 29.3, )), ], ), SizedBox( - width: width/3, + width: width / 3, ), const Icon( Icons.wb_cloudy_rounded, color: Colors.cyanAccent, ), Column( - children: [ + children: [ Text("Pressure", style: TextStyle( fontWeight: FontWeight.w500, - fontSize: width/22, + fontSize: width / 22, )), Text("1015 mbar", style: TextStyle( fontWeight: FontWeight.w400, - fontSize: width/22, + fontSize: width / 22, )), ], ), @@ -311,44 +315,44 @@ class WeatherInfoScreen extends StatelessWidget { Row( children: [ SizedBox( - width: width/29.3, + width: width / 29.3, ), Icon(Icons.wb_cloudy), Column( children: [ SizedBox( - width: width/29.3, + width: width / 29.3, ), Text("Chance of Rain", style: TextStyle( fontWeight: FontWeight.w500, - fontSize: width/22, + fontSize: width / 22, )), Text("1 %", style: TextStyle( fontWeight: FontWeight.w400, - fontSize: width/22, + fontSize: width / 22, )), ], ), SizedBox( - width: width/5, + width: width / 5, ), Icon( Icons.wb_sunny_rounded, color: Colors.yellow, ), Column( - children: [ + children: [ Text("UV Index", style: TextStyle( fontWeight: FontWeight.w500, - fontSize: width/22, + fontSize: width / 22, )), Text("1", style: TextStyle( fontWeight: FontWeight.w400, - fontSize:width/22, + fontSize: width / 22, )), ], ), diff --git a/lib/src/widgets/search_bar.dart b/lib/src/widgets/search_bar.dart index f14e2bd..297ede2 100644 --- a/lib/src/widgets/search_bar.dart +++ b/lib/src/widgets/search_bar.dart @@ -1,24 +1,20 @@ import 'package:flutter/material.dart'; -void main() => runApp(MaterialApp( - home: Search_bar(), - )); - -class Search_bar extends StatefulWidget { - const Search_bar({Key? key}) : super(key: key); +class SearchBar extends StatefulWidget { + const SearchBar({Key? key}) : super(key: key); @override - _Search_barState createState() => _Search_barState(); + _SearchBarState createState() => _SearchBarState(); } -class _Search_barState extends State { +class _SearchBarState extends State { @override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size; double height = MediaQuery.of(context).size.height; return SafeArea( - child: Scaffold( - body: Padding( + child: Container( + child: Padding( padding: const EdgeInsets.fromLTRB(15, 20, 15, 10), child: Container( height: height / 15, diff --git a/pubspec.lock b/pubspec.lock index 7a43186..de3127d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -14,7 +14,7 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.8.1" + version: "2.8.2" boolean_selector: dependency: transitive description: @@ -35,7 +35,7 @@ packages: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0" + version: "1.2.0" charcode: dependency: transitive description: @@ -157,7 +157,7 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10" + version: "0.12.11" meta: dependency: transitive description: @@ -260,7 +260,7 @@ packages: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.4.2" + version: "0.4.3" typed_data: dependency: transitive description: @@ -274,7 +274,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0" + version: "2.1.1" weather: dependency: "direct main" description: