diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 879e55e..37db7df 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,4 +1,8 @@ - + + + + + NSLocationWhenInUseUsageDescription +This app needs access to location when open. +NSLocationAlwaysUsageDescription + This app needs access to location when in the background. CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName diff --git a/lib/controller/global_controller.dart b/lib/controller/global_controller.dart new file mode 100644 index 0000000..90363c2 --- /dev/null +++ b/lib/controller/global_controller.dart @@ -0,0 +1,56 @@ +//checking for locationg permission & fetching location of the user's device + +import 'package:get/get.dart'; +import 'package:geolocator/geolocator.dart'; + +/*RxBool for creating reactive objects, allows you to store and update location coordinations and notify the listener of changes +setting isLoading to true so it start's loading until we get the location values*/ +class GlobalController extends GetxController { + final RxBool _isLoading = true.obs; + final RxDouble _lattitude = 0.0.obs; + final RxDouble _longitude = 0.0.obs; + + RxBool checkLoading() => _isLoading; + RxDouble getLattitude() => _lattitude; + RxDouble getLongitude() => _longitude; + + @override + //-event handler-initializing variables, you can use Init() + void onInit() { + if (_isLoading.isTrue) { + getLocation(); + } + super.onInit(); + } + + getLocation() async { + bool isServiceEnabled; + LocationPermission locationPermission; + //waiting for location permission before fetching locationg API + isServiceEnabled = await Geolocator.isLocationServiceEnabled(); + if (!isServiceEnabled) { + return Future.error('Location services are enabled'); + } + + //cheack permission + locationPermission = await Geolocator.checkPermission(); + //getting user's location permission + if (locationPermission == LocationPermission.deniedForever) { + return Future.error('Location permissions are denied'); + } else if (locationPermission == LocationPermission.denied) { + locationPermission = await Geolocator.requestPermission(); + if (locationPermission == LocationPermission.denied) { + return Future.error('Location permission is denied'); + } + } + + //update values and retrive user location + return await Geolocator.getCurrentPosition( + desiredAccuracy: LocationAccuracy.high) + .then((value) { + _lattitude.value = value.latitude; + _longitude.value = value.longitude; + _isLoading.value = false; + }); + } +} diff --git a/lib/main.dart b/lib/main.dart index a725658..2d327cf 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,20 +1,32 @@ import 'package:flutter/material.dart'; +import 'package:weather_app/screens/home_screen.dart'; +import 'package:weather_app/screens/login_page.dart'; void main() { - runApp(const MainApp()); + runApp(MyApp( + initialRoute: LoginPage.route, + routes: { + LoginPage.route: (context) => const LoginPage(), + HomeScreen.route: (context) => const HomeScreen(), + }, + )); } -class MainApp extends StatelessWidget { - const MainApp({super.key}); +class MyApp extends StatelessWidget { + const MyApp({super.key, required initialRoute, required routes}); @override Widget build(BuildContext context) { - return const MaterialApp( - home: Scaffold( - body: Center( - child: Text('Hello World!'), - ), - ), + return MaterialApp( + title: 'Weather App', + initialRoute: LoginPage.route, + routes: { + LoginPage.route: (context) => const LoginPage(), + HomeScreen.route: (context) => const HomeScreen(), + }, + home: const LoginPage(), + theme: ThemeData(), + debugShowCheckedModeBanner: false, ); } } diff --git a/lib/example/LoginPage/login_page_example.dart b/lib/models/example/LoginPage/login_page_example.dart similarity index 100% rename from lib/example/LoginPage/login_page_example.dart rename to lib/models/example/LoginPage/login_page_example.dart diff --git a/lib/example/MiCard/my_card_page_example.dart b/lib/models/example/MiCard/my_card_page_example.dart similarity index 95% rename from lib/example/MiCard/my_card_page_example.dart rename to lib/models/example/MiCard/my_card_page_example.dart index 009ebaa..807c5c8 100644 --- a/lib/example/MiCard/my_card_page_example.dart +++ b/lib/models/example/MiCard/my_card_page_example.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:weather_app/example/MiCard/widgets/details_row.dart'; +import 'package:weather_app/models/example/MiCard/widgets/details_row.dart'; class MiCardPageExample extends StatelessWidget { const MiCardPageExample({super.key}); diff --git a/lib/example/MiCard/widgets/details_row.dart b/lib/models/example/MiCard/widgets/details_row.dart similarity index 100% rename from lib/example/MiCard/widgets/details_row.dart rename to lib/models/example/MiCard/widgets/details_row.dart diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart new file mode 100644 index 0000000..b475f72 --- /dev/null +++ b/lib/screens/home_screen.dart @@ -0,0 +1,63 @@ +import 'package:flutter/material.dart'; +import 'package:get/get.dart'; +import 'package:weather_app/controller/global_controller.dart'; +import 'package:weather_app/widgets/current_weather.dart'; +import 'package:weather_app/widgets/daily_weather.dart'; +import 'package:weather_app/widgets/header.dart'; +import 'package:weather_app/widgets/hourly_weather.dart'; +import 'package:weather_app/widgets/style.dart'; + +class HomeScreen extends StatefulWidget { + const HomeScreen({super.key}); + static const String route = "/HomeScreen"; + @override + State createState() => _HomeScreenState(); +} + +class _HomeScreenState extends State { + final GlobalController globalController = + Get.put(GlobalController(), permanent: true); + void navigateNextPage(BuildContext ctx) { + Navigator.of(ctx).push(MaterialPageRoute(builder: (_) { + return const HomeScreen(); + })); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + //backgroundColor: const Color.fromARGB(255, 226, 238, 238), + body: Container( + decoration: const BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Color.fromARGB(255, 198, 205, 205), + Color.fromARGB(255, 225, 255, 251), + Color.fromARGB(255, 245, 255, 254), + ], + ), + ), + child: SafeArea( + child: Obx(() => globalController.checkLoading().isTrue + ? const Center( + child: CircularProgressIndicator(), + ) + : ListView( + scrollDirection: Axis.vertical, + children: const [ + SizedBox( + height: 20, + ), + Header(), + CurrentWeather(), + Style(), + HourlyData(), + DailyWeather(), + ], + ))), + ), + ); + } +} diff --git a/lib/screens/login_page.dart b/lib/screens/login_page.dart new file mode 100644 index 0000000..a7064e1 --- /dev/null +++ b/lib/screens/login_page.dart @@ -0,0 +1,114 @@ +//not complete + +import 'package:flutter/material.dart'; + +import 'package:google_fonts/google_fonts.dart'; +import 'package:weather_app/screens/home_screen.dart'; + +class LoginPage extends StatelessWidget { + const LoginPage({super.key}); + static const String route = "/LoginPage"; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text( + "Weather App", + style: TextStyle( + color: Colors.black87, + ), + ), + backgroundColor: const Color.fromARGB(255, 15, 99, 159), + ), + body: SafeArea( + child: Center( + child: Column(children: [ + const SizedBox(height: 60), + const Image( + image: AssetImage( + "assets/example/images/icons8-winter-64 (1).png")), + Text("Do You Wanna Build A Snow Man?", + style: GoogleFonts.exo2( + fontSize: 20, + color: Colors.black87, + )), + const SizedBox(height: 40), + const SizedBox(height: 30), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 25), + child: Container( + padding: const EdgeInsets.only(left: 10), + decoration: BoxDecoration( + color: const Color.fromARGB(255, 198, 205, 205), + border: Border.all(color: Colors.white), + borderRadius: BorderRadius.circular(12), + ), + child: const TextField( + decoration: InputDecoration( + border: InputBorder.none, + hintText: 'Email / Phone number'), + ), + ), + ), + const SizedBox(height: 10), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 25), + child: Container( + padding: const EdgeInsets.only(left: 10), + decoration: BoxDecoration( + color: const Color.fromARGB(255, 198, 205, 205), + border: Border.all(color: Colors.white), + borderRadius: BorderRadius.circular(12), + ), + child: const TextField( + obscureText: true, + decoration: InputDecoration( + border: InputBorder.none, hintText: 'Password'), + ), + ), + ), + const SizedBox(height: 20), + Padding( + padding: const EdgeInsets.symmetric(horizontal: 25), + child: Container( + padding: const EdgeInsets.all(28), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + ), + child: ElevatedButton( + onPressed: () { + Navigator.of(context).pushNamed(HomeScreen.route); + }, + child: Text( + "Sign In", + style: GoogleFonts.exo2( + fontSize: 18, + fontWeight: FontWeight.bold, + color: Colors.black87, + ), + )), + ), + ), + const SizedBox(height: 10), + Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "Forgot Password?", + style: GoogleFonts.exo2( + color: const Color.fromARGB(255, 20, 165, 217), + fontWeight: FontWeight.bold), + ), + const SizedBox(height: 80), + const Image( + image: AssetImage( + "assets/example/images/icons8-snowflake-48.png")), + ], + ) + ])), + )); + } + + void navigateNextPage(BuildContext context) {} +} diff --git a/lib/widgets/cards.dart b/lib/widgets/cards.dart new file mode 100644 index 0000000..1088097 --- /dev/null +++ b/lib/widgets/cards.dart @@ -0,0 +1,183 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; + +class ContainerBox extends StatelessWidget { + final String text; + + const ContainerBox({ + super.key, + required this.text, + }); + + @override + Widget build(BuildContext context) { + return Container( + height: 100, + margin: const EdgeInsets.only(top: 80, left: 20, right: 20, bottom: 80), + padding: const EdgeInsets.all(15), + decoration: BoxDecoration( + color: const Color.fromARGB(255, 245, 253, 252), + borderRadius: BorderRadius.circular(15), + boxShadow: const [ + BoxShadow( + color: Color.fromARGB(255, 174, 185, 185), + offset: Offset(1, 2), + blurRadius: 15, + blurStyle: BlurStyle.outer), + ]), + child: Column( + children: [ + Container( + alignment: Alignment.topCenter, + margin: const EdgeInsets.only(bottom: 10), + child: Text(text, + style: GoogleFonts.exo2( + fontSize: 20, + fontWeight: FontWeight.bold, + )), + ), + ], + ), + ); + } +} + +class CurrentWeatherIconCard extends StatelessWidget { + final Image image; + + const CurrentWeatherIconCard({ + super.key, + required this.image, + }); + + @override + Widget build(BuildContext context) { + return Container( + height: 60, + width: 60, + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: const Color.fromARGB(255, 245, 253, 252), + borderRadius: BorderRadius.circular(15), + boxShadow: const [ + BoxShadow( + color: Color.fromARGB(255, 174, 185, 185), + offset: Offset(1, 2), + blurRadius: 15, + blurStyle: BlurStyle.outer), + ]), + child: Column( + children: [image], + ), + ); + } +} + +class CurrentWeathrtDataCard extends StatelessWidget { + final String text; + + const CurrentWeathrtDataCard({ + super.key, + required this.text, + }); + + @override + Widget build(BuildContext context) { + return Container( + margin: const EdgeInsets.only(top: 10), + height: 20, + width: 60, + alignment: Alignment.center, + child: Text( + text, + style: GoogleFonts.exo2( + fontSize: 12, fontWeight: FontWeight.w700, color: Colors.grey[700]), + ), + ); + } +} + +class HourlyWeatherCard extends StatelessWidget { + final String time; + final Image image; + final String temp; + const HourlyWeatherCard({ + super.key, + required this.time, + required this.image, + required this.temp, + }); + + @override + Widget build(BuildContext context) { + return Container( + height: 120, + width: 100, + padding: const EdgeInsets.only(top: 10, bottom: 10), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(15), + color: const Color.fromARGB(255, 245, 253, 252), + boxShadow: const [ + BoxShadow( + offset: Offset(1, -8), + blurRadius: 10, + spreadRadius: 1, + color: Color.fromARGB(255, 174, 185, 185), + ) + ], + ), + child: Column(children: [ + Text( + time, + style: GoogleFonts.exo2(), + ), + image, + Text( + temp, + style: GoogleFonts.exo2(), + ), + ]), + ), + ); + } +} + +class DailyWeatherCard extends StatelessWidget { + final String day; + final Image image; + final String temp; + const DailyWeatherCard({ + super.key, + required this.day, + required this.image, + required this.temp, + }); + + @override + Widget build(BuildContext context) { + return Container( + height: 80, + margin: const EdgeInsets.all(20), + padding: const EdgeInsets.all(15), + decoration: BoxDecoration( + color: const Color.fromARGB(255, 245, 253, 252), + borderRadius: BorderRadius.circular(15), + boxShadow: const [ + BoxShadow( + color: Color.fromARGB(255, 174, 185, 185), + offset: Offset(1, 2), + blurRadius: 15, + blurStyle: BlurStyle.outer), + ]), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text(day, style: GoogleFonts.exo2()), + image, + Text(temp, style: GoogleFonts.exo2()), + ], + ), + ); + } +} diff --git a/lib/widgets/current_weather.dart b/lib/widgets/current_weather.dart new file mode 100644 index 0000000..530a859 --- /dev/null +++ b/lib/widgets/current_weather.dart @@ -0,0 +1,86 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'cards.dart'; + +class CurrentWeather extends StatelessWidget { + const CurrentWeather({super.key}); + + @override + Widget build(BuildContext context) { + return Column( + children: [currentTemperature(), currentState(), dailyWeather()]); + } + + Widget currentTemperature() { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Image.asset( + "assets/example/images/icons8-snow-30.png", + scale: 0.5, + ), + Container( + //margin: const EdgeInsets.only(left: 20, right: 20), + alignment: Alignment.topRight, + child: Text( + "-16°C", + style: GoogleFonts.exo2( + color: Colors.black87, + fontSize: 40, + fontWeight: FontWeight.w500, + height: 1), + ), + ), + ], + ); + } + + Widget currentState() { + return Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Container( + margin: const EdgeInsets.only(bottom: 40), + child: Text( + "Winter Is Coming", + style: GoogleFonts.exo2( + color: Colors.grey[800], + fontSize: 20, + //fontWeight: FontWeight.w500, + height: 3, + ), + ), + ), + ], + ); + } + + Widget dailyWeather() { + return Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + CurrentWeatherIconCard( + image: Image.asset( + "assets/example/images/icons8-wind-48 (1).png")), + CurrentWeatherIconCard( + image: + Image.asset("assets/example/images/icons8-clouds-64.png")), + CurrentWeatherIconCard( + image: Image.asset( + "assets/example/images/icons8-hygrometer-64.png")), + ], + ), + const Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + CurrentWeathrtDataCard(text: "3.06km/h"), + CurrentWeathrtDataCard(text: "82%"), + CurrentWeathrtDataCard(text: "35%") + ], + ), + ], + ); + } +} diff --git a/lib/widgets/daily_weather.dart b/lib/widgets/daily_weather.dart new file mode 100644 index 0000000..d33e803 --- /dev/null +++ b/lib/widgets/daily_weather.dart @@ -0,0 +1,91 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:weather_app/widgets/cards.dart'; + +/* + Widget dailyWeather() { + return SizedBox( + child: ListView.builder( + scrollDirection: Axis.vertical, + itemCount: text.length, + itemBuilder: (context, index) { + return Column( + children: [ + Container( + height: 60, + padding: const EdgeInsets.only(left: 10, right: 10), + child: Text(text[index]), + ) + ], + ); + }, + ), + ); + } +}*/ +class DailyWeather extends StatelessWidget { + const DailyWeather({super.key}); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + head(), + dailyWeather(), + ], + ); + } + + Widget head() { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + Text( + "Week Forecast", + style: GoogleFonts.exo2(fontSize: 18), + ), + Container( + margin: const EdgeInsets.only(top: 10), + child: Image.asset( + "assets/example/images/icons8-winter-61.png", + scale: 1.5, + ), + ) + ], + ); + } + + Widget dailyWeather() { + return SingleChildScrollView( + scrollDirection: Axis.vertical, + child: Column( + children: [ + DailyWeatherCard( + day: "Sun", + image: Image.asset("assets/example/images/icons8-cloud-50.png"), + temp: "6°"), + DailyWeatherCard( + day: "Mon", + image: Image.asset( + "assets/example/images/icons8-windy-weather-50.png"), + temp: "3°"), + DailyWeatherCard( + day: "Tue", + image: Image.asset( + "assets/example/images/icons8-windy-weather-50.png"), + temp: "3°"), + DailyWeatherCard( + day: "Wed", + image: + Image.asset("assets/example/images/icons8-sleet-50 (1).png"), + temp: "-1°"), + DailyWeatherCard( + day: "Fri", + image: + Image.asset("assets/example/images/icons8-snow-50 (1).png"), + temp: "-8°"), + ], + ), + ); + } +} diff --git a/lib/widgets/header.dart b/lib/widgets/header.dart new file mode 100644 index 0000000..0bd4ad5 --- /dev/null +++ b/lib/widgets/header.dart @@ -0,0 +1,72 @@ +import 'package:flutter/material.dart'; +import 'package:geocoding/geocoding.dart'; +import 'package:get/get.dart'; +import 'package:intl/intl.dart'; +import 'package:weather_app/controller/global_controller.dart'; +import 'package:google_fonts/google_fonts.dart'; + +class Header extends StatefulWidget { + const Header({super.key}); + + @override + State
createState() => _HeadertState(); + Widget build(BuildContext context) { + return const SizedBox( + child: DecoratedBox( + decoration: BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/example/images/snow.png"))), + ), + ); + } +} + +class _HeadertState extends State
{ + String city = ""; + String date = DateFormat('EEE, MMM d').format(DateTime.now()); + + final GlobalController globalController = + Get.put(GlobalController(), permanent: true); + + @override + void initState() { + getAddress(globalController.getLattitude().value, + globalController.getLongitude().value); + super.initState(); + } + + getAddress(lat, lon) async { + List placemark = await placemarkFromCoordinates(lat, lon); + Placemark place = placemark[0]; + setState(() { + city = place.locality!; + }); + } + + @override + Widget build(BuildContext context) { + return Column(children: [ + Container( + margin: const EdgeInsets.only(left: 20, right: 20), + alignment: Alignment.topCenter, + child: Text( + city, + style: + GoogleFonts.exo2(height: 2, color: Colors.black87, fontSize: 30), + ), + ), + Container( + margin: const EdgeInsets.only(left: 22, right: 20, bottom: 20), + alignment: Alignment.topCenter, + child: Text( + date, + style: GoogleFonts.exo2( + fontSize: 18, + height: 1.5, + color: Colors.grey[700], + ), + ), + ), + ]); + } +} diff --git a/lib/widgets/hourly_weather.dart b/lib/widgets/hourly_weather.dart new file mode 100644 index 0000000..37b95c9 --- /dev/null +++ b/lib/widgets/hourly_weather.dart @@ -0,0 +1,60 @@ +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'package:weather_app/widgets/cards.dart'; + +class HourlyData extends StatelessWidget { + const HourlyData({super.key}); + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Container( + margin: const EdgeInsets.symmetric(vertical: 10, horizontal: 20), + alignment: Alignment.topCenter, + child: Text("Today", style: GoogleFonts.exo2(fontSize: 18)), + ), + hourlyList(), + ], + ); + } + + Widget hourlyList() { + return SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: Row( + children: [ + HourlyWeatherCard( + time: "11:30 PM", + image: Image.asset("assets/example/images/icons8-cloud-50.png"), + temp: "6°"), + HourlyWeatherCard( + time: "12:00 AM", + image: Image.asset( + "assets/example/images/icons8-windy-weather-50.png"), + temp: "3°"), + HourlyWeatherCard( + time: "12:30 AM", + image: Image.asset( + "assets/example/images/icons8-windy-weather-50.png"), + temp: "3°"), + HourlyWeatherCard( + time: "1:00 PM", + image: + Image.asset("assets/example/images/icons8-sleet-50 (1).png"), + temp: "-1°"), + HourlyWeatherCard( + time: "1:30 PM", + image: + Image.asset("assets/example/images/icons8-snow-50 (1).png"), + temp: "-8°"), + HourlyWeatherCard( + time: "2:00 PM", + image: + Image.asset("assets/example/images/icons8-snow-50 (1).png"), + temp: "-12°"), + ], + ), + ); + } +} diff --git a/lib/widgets/style.dart b/lib/widgets/style.dart new file mode 100644 index 0000000..ba6c19f --- /dev/null +++ b/lib/widgets/style.dart @@ -0,0 +1,17 @@ +import 'package:flutter/material.dart'; + +class Style extends StatelessWidget { + const Style({super.key}); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Expanded( + child: Image.asset("assets/example/images/snow.png", + fit: BoxFit.contain), + ), + ], + ); + } +} diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index cccf817..32aadf6 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,6 +5,10 @@ import FlutterMacOS import Foundation +import geolocator_apple +import path_provider_foundation func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + GeolocatorPlugin.register(with: registry.registrar(forPlugin: "GeolocatorPlugin")) + PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) } diff --git a/models.jsonc b/models.jsonc new file mode 100644 index 0000000..c21c889 --- /dev/null +++ b/models.jsonc @@ -0,0 +1,32 @@ +// GENERATED BY JSON TO DART MODEL +[ + // Useful links to work with this file: + // About jsonc: https://github.com/onury/jsonc + // Try jsonc: https://komkom.github.io + // + // To configure generator, go to Settings/Extensions/JSON To Dart Model + // + // Add your json objects here separated by commas. + // Note that you add class names to each object with key "__className": + // And avoid duplicate class names in this list for best results. + // FOR EXAMPLE: + /* + // Uncomment this to test and run builder with Shift + Ctrl + Alt + B + { + // To add enhancemed name to all generated files add new name after dot. + // Example: user_post.model. Result: user_post.model.dart + "__className": "user_post", // <- The base class name of the object. + // It's possible to override the default path with a new one by adding "__path" key. + // - it's useful if you want split your models to different workspace directories. + "__path": "/lib/models/user", // <- this is not required. + "userId": 1, + "id": 1, // To mark as required value, change "id" to "r@id". + "title": "Json To Dart Model", // To mark as a default value, change "title" to "d@title". + "body": "Json to Dart advanced..." + // Force new type by adding new one after dot. + // Note: it works only with not primitive values. + // "type": {...} // <- Example: "type.post_type". Result: PostType type; + } + + */ +] \ No newline at end of file diff --git a/pubspec.lock b/pubspec.lock index 2b23063..db29ae6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -41,6 +41,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.17.2" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" fake_async: dependency: transitive description: @@ -49,6 +57,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + ffi: + dependency: transitive + description: + name: ffi + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + url: "https://pub.dev" + source: hosted + version: "2.1.0" flutter: dependency: "direct main" description: flutter @@ -58,23 +74,148 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: a25a15ebbdfc33ab1cd26c63a6ee519df92338a9c10f122adda92938253bef04 + sha256: ad76540d21c066228ee3f9d1dad64a9f7e46530e8bb7c85011a88bc1fd874bc5 url: "https://pub.dev" source: hosted - version: "2.0.3" + version: "3.0.0" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + geocoding: + dependency: "direct main" + description: + name: geocoding + sha256: e1dc0ac56666d9ed1d5a9ae5543ce9eb5986db6209cc7600103487d09192059c + url: "https://pub.dev" + source: hosted + version: "2.1.1" + geocoding_android: + dependency: transitive + description: + name: geocoding_android + sha256: "609db1d71bc364dd9d0616f72a41c01e0c74f3a3807efb85e0d5a67e57baf50f" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + geocoding_ios: + dependency: transitive + description: + name: geocoding_ios + sha256: c85495ce8fb34e4fbd2dd8fc5f79263d622d9f88c4af948c965daf6b27a7f3a1 + url: "https://pub.dev" + source: hosted + version: "2.1.0" + geocoding_platform_interface: + dependency: transitive + description: + name: geocoding_platform_interface + sha256: "8848605d307d844d89937cdb4b8ad7dfa880552078f310fa24d8a460f6dddab4" + url: "https://pub.dev" + source: hosted + version: "2.0.1" + geolocator: + dependency: "direct main" + description: + name: geolocator + sha256: e946395fc608842bb2f6c914807e9183f86f3cb787f6b8f832753e5251036f02 + url: "https://pub.dev" + source: hosted + version: "10.1.0" + geolocator_android: + dependency: transitive + description: + name: geolocator_android + sha256: "93906636752ea4d4e778afa981fdfe7409f545b3147046300df194330044d349" + url: "https://pub.dev" + source: hosted + version: "4.3.1" + geolocator_apple: + dependency: transitive + description: + name: geolocator_apple + sha256: ab90ae811c42ec2f6021e01eca71df00dee6ff1e69d2c2dafd4daeb0b793f73d + url: "https://pub.dev" + source: hosted + version: "2.3.2" + geolocator_platform_interface: + dependency: transitive + description: + name: geolocator_platform_interface + sha256: b7aca62aa05d7e610c396a53a1936ff87fce2f735d76e93fde9269c341c46a25 + url: "https://pub.dev" + source: hosted + version: "4.1.1" + geolocator_web: + dependency: transitive + description: + name: geolocator_web + sha256: "59083f7e0871b78299918d92bf930a14377f711d2d1156c558cd5ebae6c20d58" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + geolocator_windows: + dependency: transitive + description: + name: geolocator_windows + sha256: "8725beaa00db2b52f53d9811584cb4488240b250b04a09763e80945017f65c9c" + url: "https://pub.dev" + source: hosted + version: "0.2.1" + get: + dependency: "direct main" + description: + name: get + sha256: e4e7335ede17452b391ed3b2ede016545706c01a02292a6c97619705e7d2a85e + url: "https://pub.dev" + source: hosted + version: "4.6.6" + google_fonts: + dependency: "direct main" + description: + name: google_fonts + sha256: f0b8d115a13ecf827013ec9fc883390ccc0e87a96ed5347a3114cac177ef18e8 + url: "https://pub.dev" + source: hosted + version: "6.1.0" + http: + dependency: "direct main" + description: + name: http + sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + intl: + dependency: "direct main" + description: + name: intl + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + url: "https://pub.dev" + source: hosted + version: "0.18.1" lints: dependency: transitive description: name: lints - sha256: "0a217c6c989d21039f1498c3ed9f3ed71b354e69873f13a8dfc3c9fe76f1b452" + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290 url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "3.0.0" matcher: dependency: transitive description: @@ -107,11 +248,83 @@ packages: url: "https://pub.dev" source: hosted version: "1.8.3" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa + url: "https://pub.dev" + source: hosted + version: "2.1.1" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "6b8b19bd80da4f11ce91b2d1fb931f3006911477cec227cce23d3253d80df3f1" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + url: "https://pub.dev" + source: hosted + version: "2.2.1" + platform: + dependency: transitive + description: + name: platform + sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59" + url: "https://pub.dev" + source: hosted + version: "3.1.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 source: sdk version: "0.0.99" + sleek_circular_slider: + dependency: "direct main" + description: + name: sleek_circular_slider + sha256: "8844d036269a13e60dda4e16534d30d27cacaff8d2f10d042d9d61d111468b13" + url: "https://pub.dev" + source: hosted + version: "2.0.1" source_span: dependency: transitive description: @@ -160,6 +373,22 @@ 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" + uuid: + dependency: transitive + description: + name: uuid + sha256: "648e103079f7c64a36dc7d39369cabb358d377078a051d6ae2ad3aa539519313" + url: "https://pub.dev" + source: hosted + version: "3.0.7" vector_math: dependency: transitive description: @@ -176,5 +405,22 @@ packages: url: "https://pub.dev" source: hosted version: "0.1.4-beta" + win32: + dependency: transitive + description: + name: win32 + sha256: "350a11abd2d1d97e0cc7a28a81b781c08002aa2864d9e3f192ca0ffa18b06ed3" + url: "https://pub.dev" + source: hosted + version: "5.0.9" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2" + url: "https://pub.dev" + source: hosted + version: "1.0.3" sdks: dart: ">=3.1.2 <4.0.0" + flutter: ">=3.13.0" diff --git a/pubspec.yaml b/pubspec.yaml index 6bac6b8..5e8f043 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -19,7 +19,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=3.1.2 <4.0.0" + sdk: ">=3.1.2 <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 @@ -28,51 +28,59 @@ environment: # the latest version available on pub.dev. To see which dependencies have newer # versions available, run `flutter pub outdated`. dependencies: - flutter: - sdk: flutter + get: ^4.6.6 + geolocator: + flutter: + sdk: flutter + google_fonts: ^6.1.0 + geocoding: ^2.1.1 + sleek_circular_slider: ^2.0.1 + http: ^1.1.0 + intl: ^0.18.1 dev_dependencies: - # 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 - 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: ^3.0.0 + flutter_test: + sdk: flutter # 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 + # 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: - - assets/example/images/ - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages + # To add assets to your application, add an assets section, like this: + assets: + - assets/example/images/ + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware + # For details regarding adding assets from package dependencies, see + # https://flutter.dev/assets-and-images/#from-packages + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.dev/custom-fonts/#from-packages diff --git a/web/manifest.json b/web/manifest.json index bc26e5d..6709511 100644 --- a/web/manifest.json +++ b/web/manifest.json @@ -1,3 +1,4 @@ + { "name": "weather_app", "short_name": "weather_app", diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 8b6d468..1ece8f2 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,6 +6,9 @@ #include "generated_plugin_registrant.h" +#include void RegisterPlugins(flutter::PluginRegistry* registry) { + GeolocatorWindowsRegisterWithRegistrar( + registry->GetRegistrarForPlugin("GeolocatorWindows")); } diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index b93c4c3..7f101a7 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,6 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST + geolocator_windows ) list(APPEND FLUTTER_FFI_PLUGIN_LIST