diff --git a/assets/images/forest_cloudy.png b/assets/images/forest_cloudy.png new file mode 100644 index 0000000..961fe87 Binary files /dev/null and b/assets/images/forest_cloudy.png differ diff --git a/assets/images/forest_rainy.png b/assets/images/forest_rainy.png new file mode 100644 index 0000000..ea0e353 Binary files /dev/null and b/assets/images/forest_rainy.png differ diff --git a/assets/images/forest_sunny.png b/assets/images/forest_sunny.png new file mode 100644 index 0000000..70bba6e Binary files /dev/null and b/assets/images/forest_sunny.png differ diff --git a/assets/images/sea_cloudy.png b/assets/images/sea_cloudy.png new file mode 100644 index 0000000..85c6654 Binary files /dev/null and b/assets/images/sea_cloudy.png differ diff --git a/assets/images/sea_rainy.png b/assets/images/sea_rainy.png new file mode 100644 index 0000000..70b4a8a Binary files /dev/null and b/assets/images/sea_rainy.png differ diff --git a/assets/images/sea_sunnypng.png b/assets/images/sea_sunnypng.png new file mode 100644 index 0000000..9598f8b Binary files /dev/null and b/assets/images/sea_sunnypng.png differ diff --git a/ios/Flutter/Debug.xcconfig b/ios/Flutter/Debug.xcconfig index 592ceee..ec97fc6 100644 --- a/ios/Flutter/Debug.xcconfig +++ b/ios/Flutter/Debug.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Flutter/Release.xcconfig b/ios/Flutter/Release.xcconfig index 592ceee..c4855bf 100644 --- a/ios/Flutter/Release.xcconfig +++ b/ios/Flutter/Release.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "Generated.xcconfig" diff --git a/ios/Podfile b/ios/Podfile new file mode 100644 index 0000000..fdcc671 --- /dev/null +++ b/ios/Podfile @@ -0,0 +1,44 @@ +# Uncomment this line to define a global platform for your project +# platform :ios, '11.0' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_ios_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + end +end diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index d86ec66..b87352b 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -45,5 +45,7 @@ UIApplicationSupportsIndirectInputEvents + NSLocationWhenInUseUsageDescription + Your location is required for the weather app diff --git a/lib/main.dart b/lib/main.dart index e8a7b5c..802a630 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:weather_app/presentation/views/rainy.dart'; void main() { runApp(const MyApp()); @@ -16,86 +17,8 @@ class MyApp extends StatelessWidget { colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true, ), - home: const MyHomePage(title: 'Flutter Demo Home Page'), + home: const RainyView(), ); } } -class MyHomePage extends StatefulWidget { - const MyHomePage({super.key, required this.title}); - - final String title; - - @override - State createState() => _MyHomePageState(); -} - -class _MyHomePageState extends State { - int _counter = 0; - - void _incrementCounter() { - setState(() { - // This call to setState tells the Flutter framework that something has - // changed in this State, which causes it to rerun the build method below - // so that the display can reflect the updated values. If we changed - // _counter without calling setState(), then the build method would not be - // called again, and so nothing would appear to happen. - _counter++; - }); - } - - @override - Widget build(BuildContext context) { - // This method is rerun every time setState is called, for instance as done - // by the _incrementCounter method above. - // - // The Flutter framework has been optimized to make rerunning build methods - // fast, so that you can just rebuild anything that needs updating rather - // than having to individually change instances of widgets. - return Scaffold( - appBar: AppBar( - // TRY THIS: Try changing the color here to a specific color (to - // Colors.amber, perhaps?) and trigger a hot reload to see the AppBar - // change color while the other colors stay the same. - backgroundColor: Theme.of(context).colorScheme.inversePrimary, - // Here we take the value from the MyHomePage object that was created by - // the App.build method, and use it to set our appbar title. - title: Text(widget.title), - ), - body: Center( - // Center is a layout widget. It takes a single child and positions it - // in the middle of the parent. - child: Column( - // Column is also a layout widget. It takes a list of children and - // arranges them vertically. By default, it sizes itself to fit its - // children horizontally, and tries to be as tall as its parent. - // - // Column has various properties to control how it sizes itself and - // how it positions its children. Here we use mainAxisAlignment to - // center the children vertically; the main axis here is the vertical - // axis because Columns are vertical (the cross axis would be - // horizontal). - // - // TRY THIS: Invoke "debug painting" (choose the "Toggle Debug Paint" - // action in the IDE, or press "p" in the console), to see the - // wireframe for each widget. - mainAxisAlignment: MainAxisAlignment.center, - children: [ - const Text( - 'You have pushed the button this many times:', - ), - Text( - '$_counter', - style: Theme.of(context).textTheme.headlineMedium, - ), - ], - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: _incrementCounter, - tooltip: 'Increment', - child: const Icon(Icons.add), - ), // This trailing comma makes auto-formatting nicer for build methods. - ); - } -} diff --git a/lib/presentation/views/rainy.dart b/lib/presentation/views/rainy.dart new file mode 100644 index 0000000..243cab3 --- /dev/null +++ b/lib/presentation/views/rainy.dart @@ -0,0 +1,165 @@ +import 'package:flutter/material.dart'; +import 'package:weather_app/presentation/widgets/consts/theme.dart'; + +class RainyView extends StatefulWidget { + const RainyView({super.key}); + + @override + State createState() => _RainyView(); +} + +class _RainyView extends State { + @override + Widget build(BuildContext context) { + return const Scaffold( + backgroundColor: AppThemes.rainy, + body: Column( + children: [ImageWidget(), Expanded(child: DaysWeatherView())], + ), + ); + } +} + +class ImageWidget extends StatelessWidget { + const ImageWidget({super.key}); + + @override + Widget build(BuildContext context) { + return Container( + height: 400, + width: MediaQuery.of(context).size.width, + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage('assets/images/forest_rainy.png'), + fit: BoxFit.fitHeight), + ), + child: const Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + '15°', + style: TextStyle( + fontSize: 60, fontWeight: FontWeight.bold, color: Colors.white), + ), + Text( + 'RAINY', + style: TextStyle( + fontSize: 32, + fontWeight: FontWeight.normal, + color: Colors.white), + ), + ], + ), + ); + } +} + +class DaysWeatherView extends StatelessWidget { + const DaysWeatherView({super.key}); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + // title + const Row( + children: [ + // min + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + "10°", + style: TextStyle(color: Colors.white), + ), + Text( + "min", + style: TextStyle(color: Colors.white), + ), + ], + )), + //curent + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + "19°", + style: TextStyle(color: Colors.white), + ), + Text( + "current", + style: TextStyle(color: Colors.white), + ), + ], + )), + // max + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + "19°", + style: TextStyle(color: Colors.white), + ), + Text( + "max", + style: TextStyle(color: Colors.white), + ), + ], + )) + ], + ), + const Divider(color: Colors.white), + ...[ + DayWeather(day: "Monday", temperature: 23), + DayWeather(day: "Tuesday", temperature: 23), + DayWeather(day: "Wednesday", temperature: 23), + DayWeather(day: "Thursday", temperature: 23), + DayWeather(day: "Friday", temperature: 23), + DayWeather(day: "Saturday", temperature: 23), + DayWeather(day: "Sunday", temperature: 23), + ] + .map((e) => Padding( + padding: const EdgeInsets.all(8.0), + child: + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Expanded( + child: Text( + e.day, + style: const TextStyle(color: Colors.white), + )), + const Expanded( + child: Icon( + Icons.sunny, + color: Colors.white, + ), + ), + Expanded( + child: Text( + "${e.temperature} °", + style: const TextStyle(color: Colors.white), + )), + ], + ), + )) + .toList() + ], + ); + } +} + +class DayWeather { + final String day; + final num temperature; + + DayWeather({ + required this.day, + required this.temperature, + }); +} diff --git a/lib/presentation/widgets/consts/theme.dart b/lib/presentation/widgets/consts/theme.dart new file mode 100644 index 0000000..32383bd --- /dev/null +++ b/lib/presentation/widgets/consts/theme.dart @@ -0,0 +1,7 @@ +import 'package:flutter/material.dart'; + +class AppThemes { + static const sunny = Color(0xFF47AB2F); + static const rainy = Color(0xFF57575D); + static const cloudy = Color(0xFF54717A); +} \ No newline at end of file diff --git a/lib/services/weather_service.dart b/lib/services/weather_service.dart new file mode 100644 index 0000000..c3b0253 --- /dev/null +++ b/lib/services/weather_service.dart @@ -0,0 +1,8 @@ +import 'package:location/location.dart'; + +class WeatherService { + static Future getWeather() async { + final String key = ''; + LocationData location = await Location().getLocation(); + } +} diff --git a/macos/Flutter/Flutter-Debug.xcconfig b/macos/Flutter/Flutter-Debug.xcconfig index c2efd0b..4b81f9b 100644 --- a/macos/Flutter/Flutter-Debug.xcconfig +++ b/macos/Flutter/Flutter-Debug.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/Flutter-Release.xcconfig b/macos/Flutter/Flutter-Release.xcconfig index c2efd0b..5caa9d1 100644 --- a/macos/Flutter/Flutter-Release.xcconfig +++ b/macos/Flutter/Flutter-Release.xcconfig @@ -1 +1,2 @@ +#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" #include "ephemeral/Flutter-Generated.xcconfig" diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index cccf817..6b401e5 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,6 +5,8 @@ import FlutterMacOS import Foundation +import location func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin")) } diff --git a/macos/Podfile b/macos/Podfile new file mode 100644 index 0000000..c795730 --- /dev/null +++ b/macos/Podfile @@ -0,0 +1,43 @@ +platform :osx, '10.14' + +# CocoaPods analytics sends network stats synchronously affecting flutter build latency. +ENV['COCOAPODS_DISABLE_STATS'] = 'true' + +project 'Runner', { + 'Debug' => :debug, + 'Profile' => :release, + 'Release' => :release, +} + +def flutter_root + generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__) + unless File.exist?(generated_xcode_build_settings_path) + raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first" + end + + File.foreach(generated_xcode_build_settings_path) do |line| + matches = line.match(/FLUTTER_ROOT\=(.*)/) + return matches[1].strip if matches + end + raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\"" +end + +require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) + +flutter_macos_podfile_setup + +target 'Runner' do + use_frameworks! + use_modular_headers! + + flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__)) + target 'RunnerTests' do + inherit! :search_paths + end +end + +post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_macos_build_settings(target) + end +end diff --git a/pubspec.lock b/pubspec.lock index 59f98da..8934e61 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -75,6 +75,27 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" lints: dependency: transitive description: @@ -83,6 +104,30 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" + location: + dependency: "direct main" + description: + name: location + sha256: "06be54f682c9073cbfec3899eb9bc8ed90faa0e17735c9d9fa7fe426f5be1dd1" + url: "https://pub.dev" + source: hosted + version: "5.0.3" + location_platform_interface: + dependency: transitive + description: + name: location_platform_interface + sha256: "8aa1d34eeecc979d7c9fe372931d84f6d2ebbd52226a54fe1620de6fdc0753b1" + url: "https://pub.dev" + source: hosted + version: "3.1.2" + location_web: + dependency: transitive + description: + name: location_web + sha256: ec484c66e8a4ff1ee5d044c203f4b6b71e3a0556a97b739a5bc9616de672412b + url: "https://pub.dev" + source: hosted + version: "4.2.0" matcher: dependency: transitive description: @@ -115,6 +160,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.3" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: da3fdfeccc4d4ff2da8f8c556704c08f912542c5fb3cf2233ed75372384a034d + url: "https://pub.dev" + source: hosted + version: "2.1.6" sky_engine: dependency: transitive description: flutter @@ -168,6 +221,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.0" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" vector_math: dependency: transitive description: @@ -186,3 +247,4 @@ packages: version: "0.1.4-beta" sdks: dart: ">=3.1.1 <4.0.0" + flutter: ">=3.3.0" diff --git a/pubspec.yaml b/pubspec.yaml index 013603f..0f42396 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,32 +1,11 @@ name: weather_app description: A new Flutter project. -# The following line prevents the package from being accidentally published to -# pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev -# The following defines the version and build number for your application. -# A version number is three numbers separated by dots, like 1.2.43 -# followed by an optional build number separated by a +. -# Both the version and the builder number may be overridden in flutter -# build by specifying --build-name and --build-number, respectively. -# In Android, build-name is used as versionName while build-number used as versionCode. -# Read more about Android versioning at https://developer.android.com/studio/publish/versioning -# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion. -# Read more about iOS versioning at -# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -# In Windows, build-name is used as the major, minor, and patch parts -# of the product and file versions while build-number is used as the build suffix. version: 1.0.0+1 environment: sdk: '>=3.1.1 <4.0.0' -# Dependencies specify other packages that your package needs in order to work. -# To automatically upgrade your package dependencies to the latest versions -# consider running `flutter pub upgrade --major-versions`. Alternatively, -# dependencies can be manually updated by changing the version numbers below to -# the latest version available on pub.dev. To see which dependencies have newer -# versions available, run `flutter pub outdated`. dependencies: flutter: sdk: flutter @@ -35,33 +14,23 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 + location: ^5.0.3 dev_dependencies: flutter_test: sdk: flutter - # The "flutter_lints" package below contains a set of recommended lints to - # encourage good coding practices. The lint set provided by the package is - # activated in the `analysis_options.yaml` file located at the root of your - # package. See that file for information about deactivating specific lint - # rules and activating additional ones. flutter_lints: ^2.0.0 -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter packages. flutter: - # The following line ensures that the Material Icons font is - # included with your application, so that you can use the icons in - # the material Icons class. uses-material-design: true # To add assets to your application, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg + assets: + - assets/images/forest_cloudy.png + - assets/images/forest_rainy.png + - assets/images/forest_sunny.png # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware