diff --git a/.metadata b/.metadata index 0f055bf..cb12308 100644 --- a/.metadata +++ b/.metadata @@ -4,7 +4,7 @@ # This file should be version controlled and should not be manually edited. version: - revision: ffb2ecea5223acdd139a5039be2f9c796962833d + revision: 3595343e20a61ff16d14e8ecc25f364276bb1b8b channel: stable project_type: app diff --git a/README.md b/README.md index 9152445..f8d1217 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# Flutter Course Code +# test1 + +A new Flutter project. ## Getting Started diff --git a/android/app/build.gradle b/android/app/build.gradle index 617083c..220cd1f 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -43,7 +43,7 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.contacts_01" + applicationId "com.example.test1" minSdkVersion 16 targetSdkVersion 30 versionCode flutterVersionCode.toInteger() diff --git a/android/app/src/debug/AndroidManifest.xml b/android/app/src/debug/AndroidManifest.xml index 47d7ea9..1b89192 100644 --- a/android/app/src/debug/AndroidManifest.xml +++ b/android/app/src/debug/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.example.test1"> diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 609e8ad..5ca3667 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,41 +1,27 @@ - - - - - - - - - - - - - - - + + diff --git a/android/app/src/main/kotlin/com/example/test1/MainActivity.kt b/android/app/src/main/kotlin/com/example/test1/MainActivity.kt new file mode 100644 index 0000000..aa13a58 --- /dev/null +++ b/android/app/src/main/kotlin/com/example/test1/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.test1 + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/android/app/src/profile/AndroidManifest.xml b/android/app/src/profile/AndroidManifest.xml index 47d7ea9..1b89192 100644 --- a/android/app/src/profile/AndroidManifest.xml +++ b/android/app/src/profile/AndroidManifest.xml @@ -1,5 +1,5 @@ + package="com.example.test1"> diff --git a/assets/day/113.png b/assets/day/113.png new file mode 100644 index 0000000..e59d8c0 Binary files /dev/null and b/assets/day/113.png differ diff --git a/assets/day/116.png b/assets/day/116.png new file mode 100644 index 0000000..858a9d2 Binary files /dev/null and b/assets/day/116.png differ diff --git a/assets/day/119.png b/assets/day/119.png new file mode 100644 index 0000000..6dc52af Binary files /dev/null and b/assets/day/119.png differ diff --git a/assets/day/122.png b/assets/day/122.png new file mode 100644 index 0000000..9ca1a8c Binary files /dev/null and b/assets/day/122.png differ diff --git a/assets/day/143.png b/assets/day/143.png new file mode 100644 index 0000000..6020c88 Binary files /dev/null and b/assets/day/143.png differ diff --git a/assets/day/176.png b/assets/day/176.png new file mode 100644 index 0000000..24458ac Binary files /dev/null and b/assets/day/176.png differ diff --git a/assets/day/179.png b/assets/day/179.png new file mode 100644 index 0000000..556dd10 Binary files /dev/null and b/assets/day/179.png differ diff --git a/assets/day/182.png b/assets/day/182.png new file mode 100644 index 0000000..fe2d069 Binary files /dev/null and b/assets/day/182.png differ diff --git a/assets/day/185.png b/assets/day/185.png new file mode 100644 index 0000000..2d2450f Binary files /dev/null and b/assets/day/185.png differ diff --git a/assets/day/200.png b/assets/day/200.png new file mode 100644 index 0000000..b7ca751 Binary files /dev/null and b/assets/day/200.png differ diff --git a/assets/day/227.png b/assets/day/227.png new file mode 100644 index 0000000..8e387f8 Binary files /dev/null and b/assets/day/227.png differ diff --git a/assets/day/230.png b/assets/day/230.png new file mode 100644 index 0000000..20fac74 Binary files /dev/null and b/assets/day/230.png differ diff --git a/assets/day/248.png b/assets/day/248.png new file mode 100644 index 0000000..7c8d6de Binary files /dev/null and b/assets/day/248.png differ diff --git a/assets/day/260.png b/assets/day/260.png new file mode 100644 index 0000000..7124bb7 Binary files /dev/null and b/assets/day/260.png differ diff --git a/assets/day/263.png b/assets/day/263.png new file mode 100644 index 0000000..aad8edb Binary files /dev/null and b/assets/day/263.png differ diff --git a/assets/day/266.png b/assets/day/266.png new file mode 100644 index 0000000..aad8edb Binary files /dev/null and b/assets/day/266.png differ diff --git a/assets/day/281.png b/assets/day/281.png new file mode 100644 index 0000000..2d2450f Binary files /dev/null and b/assets/day/281.png differ diff --git a/assets/day/284.png b/assets/day/284.png new file mode 100644 index 0000000..fd2ea44 Binary files /dev/null and b/assets/day/284.png differ diff --git a/assets/day/293.png b/assets/day/293.png new file mode 100644 index 0000000..24458ac Binary files /dev/null and b/assets/day/293.png differ diff --git a/assets/day/296.png b/assets/day/296.png new file mode 100644 index 0000000..16436f6 Binary files /dev/null and b/assets/day/296.png differ diff --git a/assets/day/299.png b/assets/day/299.png new file mode 100644 index 0000000..24458ac Binary files /dev/null and b/assets/day/299.png differ diff --git a/assets/day/302.png b/assets/day/302.png new file mode 100644 index 0000000..16436f6 Binary files /dev/null and b/assets/day/302.png differ diff --git a/assets/day/305.png b/assets/day/305.png new file mode 100644 index 0000000..1e83ff7 Binary files /dev/null and b/assets/day/305.png differ diff --git a/assets/day/308.png b/assets/day/308.png new file mode 100644 index 0000000..e0daf6e Binary files /dev/null and b/assets/day/308.png differ diff --git a/assets/day/311.png b/assets/day/311.png new file mode 100644 index 0000000..36556c1 Binary files /dev/null and b/assets/day/311.png differ diff --git a/assets/day/314.png b/assets/day/314.png new file mode 100644 index 0000000..36556c1 Binary files /dev/null and b/assets/day/314.png differ diff --git a/assets/day/317.png b/assets/day/317.png new file mode 100644 index 0000000..40004d0 Binary files /dev/null and b/assets/day/317.png differ diff --git a/assets/day/320.png b/assets/day/320.png new file mode 100644 index 0000000..40004d0 Binary files /dev/null and b/assets/day/320.png differ diff --git a/assets/day/323.png b/assets/day/323.png new file mode 100644 index 0000000..556dd10 Binary files /dev/null and b/assets/day/323.png differ diff --git a/assets/day/326.png b/assets/day/326.png new file mode 100644 index 0000000..ed84c8b Binary files /dev/null and b/assets/day/326.png differ diff --git a/assets/day/329.png b/assets/day/329.png new file mode 100644 index 0000000..556dd10 Binary files /dev/null and b/assets/day/329.png differ diff --git a/assets/day/332.png b/assets/day/332.png new file mode 100644 index 0000000..ed84c8b Binary files /dev/null and b/assets/day/332.png differ diff --git a/assets/day/335.png b/assets/day/335.png new file mode 100644 index 0000000..11ba4ff Binary files /dev/null and b/assets/day/335.png differ diff --git a/assets/day/338.png b/assets/day/338.png new file mode 100644 index 0000000..cfcf2c4 Binary files /dev/null and b/assets/day/338.png differ diff --git a/assets/day/350.png b/assets/day/350.png new file mode 100644 index 0000000..35bd3ec Binary files /dev/null and b/assets/day/350.png differ diff --git a/assets/day/353.png b/assets/day/353.png new file mode 100644 index 0000000..24458ac Binary files /dev/null and b/assets/day/353.png differ diff --git a/assets/day/356.png b/assets/day/356.png new file mode 100644 index 0000000..1e83ff7 Binary files /dev/null and b/assets/day/356.png differ diff --git a/assets/day/359.png b/assets/day/359.png new file mode 100644 index 0000000..c1ffc16 Binary files /dev/null and b/assets/day/359.png differ diff --git a/assets/day/362.png b/assets/day/362.png new file mode 100644 index 0000000..fe2d069 Binary files /dev/null and b/assets/day/362.png differ diff --git a/assets/day/365.png b/assets/day/365.png new file mode 100644 index 0000000..11ef9b8 Binary files /dev/null and b/assets/day/365.png differ diff --git a/assets/day/368.png b/assets/day/368.png new file mode 100644 index 0000000..556dd10 Binary files /dev/null and b/assets/day/368.png differ diff --git a/assets/day/371.png b/assets/day/371.png new file mode 100644 index 0000000..11ba4ff Binary files /dev/null and b/assets/day/371.png differ diff --git a/assets/day/374.png b/assets/day/374.png new file mode 100644 index 0000000..0a80be3 Binary files /dev/null and b/assets/day/374.png differ diff --git a/assets/day/377.png b/assets/day/377.png new file mode 100644 index 0000000..027ec90 Binary files /dev/null and b/assets/day/377.png differ diff --git a/assets/day/386.png b/assets/day/386.png new file mode 100644 index 0000000..b7ca751 Binary files /dev/null and b/assets/day/386.png differ diff --git a/assets/day/389.png b/assets/day/389.png new file mode 100644 index 0000000..ef622d9 Binary files /dev/null and b/assets/day/389.png differ diff --git a/assets/day/392.png b/assets/day/392.png new file mode 100644 index 0000000..e191790 Binary files /dev/null and b/assets/day/392.png differ diff --git a/assets/day/395.png b/assets/day/395.png new file mode 100644 index 0000000..ffbcefa Binary files /dev/null and b/assets/day/395.png differ diff --git a/assets/night/113.png b/assets/night/113.png new file mode 100644 index 0000000..0941bf1 Binary files /dev/null and b/assets/night/113.png differ diff --git a/assets/night/116.png b/assets/night/116.png new file mode 100644 index 0000000..c074aa7 Binary files /dev/null and b/assets/night/116.png differ diff --git a/assets/night/119.png b/assets/night/119.png new file mode 100644 index 0000000..da0d447 Binary files /dev/null and b/assets/night/119.png differ diff --git a/assets/night/122.png b/assets/night/122.png new file mode 100644 index 0000000..17b6e5d Binary files /dev/null and b/assets/night/122.png differ diff --git a/assets/night/143.png b/assets/night/143.png new file mode 100644 index 0000000..be332cd Binary files /dev/null and b/assets/night/143.png differ diff --git a/assets/night/176.png b/assets/night/176.png new file mode 100644 index 0000000..a495c93 Binary files /dev/null and b/assets/night/176.png differ diff --git a/assets/night/179.png b/assets/night/179.png new file mode 100644 index 0000000..69a5409 Binary files /dev/null and b/assets/night/179.png differ diff --git a/assets/night/182.png b/assets/night/182.png new file mode 100644 index 0000000..0597f6a Binary files /dev/null and b/assets/night/182.png differ diff --git a/assets/night/185.png b/assets/night/185.png new file mode 100644 index 0000000..f134590 Binary files /dev/null and b/assets/night/185.png differ diff --git a/assets/night/200.png b/assets/night/200.png new file mode 100644 index 0000000..b9d2991 Binary files /dev/null and b/assets/night/200.png differ diff --git a/assets/night/227.png b/assets/night/227.png new file mode 100644 index 0000000..e63aba9 Binary files /dev/null and b/assets/night/227.png differ diff --git a/assets/night/230.png b/assets/night/230.png new file mode 100644 index 0000000..2340776 Binary files /dev/null and b/assets/night/230.png differ diff --git a/assets/night/248.png b/assets/night/248.png new file mode 100644 index 0000000..e943171 Binary files /dev/null and b/assets/night/248.png differ diff --git a/assets/night/260.png b/assets/night/260.png new file mode 100644 index 0000000..000404d Binary files /dev/null and b/assets/night/260.png differ diff --git a/assets/night/263.png b/assets/night/263.png new file mode 100644 index 0000000..f630fee Binary files /dev/null and b/assets/night/263.png differ diff --git a/assets/night/266.png b/assets/night/266.png new file mode 100644 index 0000000..f630fee Binary files /dev/null and b/assets/night/266.png differ diff --git a/assets/night/281.png b/assets/night/281.png new file mode 100644 index 0000000..f134590 Binary files /dev/null and b/assets/night/281.png differ diff --git a/assets/night/284.png b/assets/night/284.png new file mode 100644 index 0000000..00cefd5 Binary files /dev/null and b/assets/night/284.png differ diff --git a/assets/night/293.png b/assets/night/293.png new file mode 100644 index 0000000..a495c93 Binary files /dev/null and b/assets/night/293.png differ diff --git a/assets/night/296.png b/assets/night/296.png new file mode 100644 index 0000000..992576a Binary files /dev/null and b/assets/night/296.png differ diff --git a/assets/night/299.png b/assets/night/299.png new file mode 100644 index 0000000..a495c93 Binary files /dev/null and b/assets/night/299.png differ diff --git a/assets/night/302.png b/assets/night/302.png new file mode 100644 index 0000000..992576a Binary files /dev/null and b/assets/night/302.png differ diff --git a/assets/night/305.png b/assets/night/305.png new file mode 100644 index 0000000..d870f12 Binary files /dev/null and b/assets/night/305.png differ diff --git a/assets/night/308.png b/assets/night/308.png new file mode 100644 index 0000000..fcd7e25 Binary files /dev/null and b/assets/night/308.png differ diff --git a/assets/night/311.png b/assets/night/311.png new file mode 100644 index 0000000..03eb79d Binary files /dev/null and b/assets/night/311.png differ diff --git a/assets/night/314.png b/assets/night/314.png new file mode 100644 index 0000000..03eb79d Binary files /dev/null and b/assets/night/314.png differ diff --git a/assets/night/317.png b/assets/night/317.png new file mode 100644 index 0000000..0773703 Binary files /dev/null and b/assets/night/317.png differ diff --git a/assets/night/320.png b/assets/night/320.png new file mode 100644 index 0000000..0773703 Binary files /dev/null and b/assets/night/320.png differ diff --git a/assets/night/323.png b/assets/night/323.png new file mode 100644 index 0000000..69a5409 Binary files /dev/null and b/assets/night/323.png differ diff --git a/assets/night/326.png b/assets/night/326.png new file mode 100644 index 0000000..c9faadf Binary files /dev/null and b/assets/night/326.png differ diff --git a/assets/night/329.png b/assets/night/329.png new file mode 100644 index 0000000..69a5409 Binary files /dev/null and b/assets/night/329.png differ diff --git a/assets/night/332.png b/assets/night/332.png new file mode 100644 index 0000000..c9faadf Binary files /dev/null and b/assets/night/332.png differ diff --git a/assets/night/335.png b/assets/night/335.png new file mode 100644 index 0000000..69a5409 Binary files /dev/null and b/assets/night/335.png differ diff --git a/assets/night/338.png b/assets/night/338.png new file mode 100644 index 0000000..bcb17c0 Binary files /dev/null and b/assets/night/338.png differ diff --git a/assets/night/350.png b/assets/night/350.png new file mode 100644 index 0000000..6bdb310 Binary files /dev/null and b/assets/night/350.png differ diff --git a/assets/night/353.png b/assets/night/353.png new file mode 100644 index 0000000..a495c93 Binary files /dev/null and b/assets/night/353.png differ diff --git a/assets/night/356.png b/assets/night/356.png new file mode 100644 index 0000000..d870f12 Binary files /dev/null and b/assets/night/356.png differ diff --git a/assets/night/359.png b/assets/night/359.png new file mode 100644 index 0000000..ef0c7a8 Binary files /dev/null and b/assets/night/359.png differ diff --git a/assets/night/362.png b/assets/night/362.png new file mode 100644 index 0000000..0597f6a Binary files /dev/null and b/assets/night/362.png differ diff --git a/assets/night/365.png b/assets/night/365.png new file mode 100644 index 0000000..4e6335c Binary files /dev/null and b/assets/night/365.png differ diff --git a/assets/night/368.png b/assets/night/368.png new file mode 100644 index 0000000..69a5409 Binary files /dev/null and b/assets/night/368.png differ diff --git a/assets/night/371.png b/assets/night/371.png new file mode 100644 index 0000000..1c2db37 Binary files /dev/null and b/assets/night/371.png differ diff --git a/assets/night/374.png b/assets/night/374.png new file mode 100644 index 0000000..ed76db9 Binary files /dev/null and b/assets/night/374.png differ diff --git a/assets/night/377.png b/assets/night/377.png new file mode 100644 index 0000000..c130922 Binary files /dev/null and b/assets/night/377.png differ diff --git a/assets/night/386.png b/assets/night/386.png new file mode 100644 index 0000000..b9d2991 Binary files /dev/null and b/assets/night/386.png differ diff --git a/assets/night/389.png b/assets/night/389.png new file mode 100644 index 0000000..3a7083b Binary files /dev/null and b/assets/night/389.png differ diff --git a/assets/night/392.png b/assets/night/392.png new file mode 100644 index 0000000..3f54c0d Binary files /dev/null and b/assets/night/392.png differ diff --git a/assets/night/395.png b/assets/night/395.png new file mode 100644 index 0000000..ffbcefa Binary files /dev/null and b/assets/night/395.png differ diff --git a/assets/night/Thumbs.db b/assets/night/Thumbs.db new file mode 100644 index 0000000..6343381 Binary files /dev/null and b/assets/night/Thumbs.db differ diff --git a/ios/.gitignore b/ios/.gitignore index 151026b..7a7f987 100644 --- a/ios/.gitignore +++ b/ios/.gitignore @@ -1,3 +1,4 @@ +**/dgph *.mode1v3 *.mode2v3 *.moved-aside diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 5d430f2..3b555e8 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -291,7 +291,7 @@ ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.example.contacts01; + PRODUCT_BUNDLE_IDENTIFIER = com.example.test1; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -415,7 +415,7 @@ ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.example.contacts01; + PRODUCT_BUNDLE_IDENTIFIER = com.example.test1; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -434,7 +434,7 @@ ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - PRODUCT_BUNDLE_IDENTIFIER = com.example.contacts01; + PRODUCT_BUNDLE_IDENTIFIER = com.example.test1; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist index e2eed25..f0635f3 100644 --- a/ios/Runner/Info.plist +++ b/ios/Runner/Info.plist @@ -11,7 +11,7 @@ CFBundleInfoDictionaryVersion 6.0 CFBundleName - contacts_01 + test1 CFBundlePackageType APPL CFBundleShortVersionString diff --git a/lib/assets/imgs/cloudy.svg b/lib/assets/imgs/cloudy.svg new file mode 100644 index 0000000..6d8be3e --- /dev/null +++ b/lib/assets/imgs/cloudy.svg @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + Cloudy in Back and White + 2012-01-23T16:28:20 + + https://openclipart.org/detail/167406/cloudy-in-back-and-white-by-halattas + + + halattas + + + + + Back and White + cloud + cloudy + sun + + + + + + + + + + + diff --git a/lib/assets/sunny.svg b/lib/assets/sunny.svg new file mode 100644 index 0000000..4537f02 --- /dev/null +++ b/lib/assets/sunny.svg @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Openclipart + + + Sun + 2011-12-19T23:05:36 + Sun shine. + http://openclipart.org/detail/166347/sum-by-jimyeh + + + jimyeh + + + + + clip art + clipart + spring2013 + summer + sun + sunny + + + + + + + + + + + diff --git a/lib/main.dart b/lib/main.dart index 2c084ed..5cea6f3 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,255 +1,24 @@ import 'package:flutter/material.dart'; -import 'dart:math' as math; -void main() { - runApp(const MyApp()); -} - -class Contact { - String image; - String name; - String mobileNumber; - DateTime date; - bool isIncoming; - - Contact(this.image, this.name, this.mobileNumber, this.date, this.isIncoming); -} - -class MyApp extends StatelessWidget { - const MyApp({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return MaterialApp( - title: 'Flutter Demo 2', - theme: ThemeData( - primarySwatch: Colors.blue, - ), - debugShowCheckedModeBanner: false, - home: const MyHomePage(title: 'Contacts App'), - ); - } -} - -class MyHomePage extends StatefulWidget { - const MyHomePage({Key? key, required this.title}) : super(key: key); - - final String title; - - @override - State createState() => _MyHomePageState(); -} +import 'widgets/get_weather.dart'; -class _MyHomePageState extends State { - int _selectedIndex = 2; - static const TextStyle optionStyle = - TextStyle(fontSize: 30, fontWeight: FontWeight.bold); - static late List _pages; - - _MyHomePageState() { - _pages = [ - buildContactsList(), - buildFavoritesGridView(), - // Text('hello'), - Text( - 'Index 2: School', - style: optionStyle, - ), - ]; - } - - void _onItemTapped(int index) { - setState(() { - _selectedIndex = index; - }); - } - - var contacts = [ - Contact( - 'https://i.pravatar.cc/300', - 'Ahmed', - '71766137347', - DateTime.now().add( - const Duration(seconds: 3), - ), - true, - ), - Contact( - 'https://i.pravatar.cc/301', - 'Ali', - '71766137347', - DateTime.now().add( - const Duration(days: 1), - ), - false, - ), - Contact( - 'https://i.pravatar.cc/302', - 'Kamal', - '71766137347', - DateTime.now().add( - const Duration(days: 3), - ), - true, - ), - Contact( - 'https://i.pravatar.cc/303', - 'Mohammad', - '71766137347', - DateTime.now().add( - const Duration(days: 5), - ), - true, - ), - Contact( - 'https://i.pravatar.cc/304', - 'Mohammad', - '71766137347', - DateTime.now().add( - const Duration(days: 5), - ), - false, - ), - Contact( - 'https://i.pravatar.cc/305', - 'Hussein', - '71766137347', - DateTime.now().add( - const Duration(days: 6), - ), - false, - ), - Contact( - 'https://i.pravatar.cc/306', - 'Aboud', - '71766137347', - DateTime.now().add( - const Duration(days: 7), - ), - false, - ), - Contact( - 'https://i.pravatar.cc/307', - 'Osama', - '71766137347', - DateTime.now().add( - const Duration(days: 6), - ), - false, - ), - ]; - - Widget buildFavoritesGridView() { - return Column( - children: [ - Text('Favorites'), - Divider(thickness: 4,), - Expanded( - child: GridView.count( - crossAxisCount: 3, - children: List.generate(5, (index) { - var personColor = Color((math.Random().nextDouble() * 0xFFFFFF).toInt()) - .withOpacity(1.0); - return Center( - child: Container( - width: 120, - height: 120, - child: Text( - contacts[index].name[0], - style: TextStyle(fontSize: 40), - ), - alignment: Alignment.center, - decoration: - BoxDecoration(shape: BoxShape.circle, color: personColor), - ), - ); - }), +void main() async { + runApp(MaterialApp( + home: Scaffold( + backgroundColor: Colors.blueGrey[800], + appBar: AppBar( + backgroundColor: Colors.blueGrey[700], + title: const Text( + "Weather App", + style: TextStyle( + color: Colors.yellow, ), ), - ], - ); - } - - Widget buildContactItem(Contact _contact) { - return Card( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Row( - children: [ - CircleAvatar( - backgroundImage: NetworkImage(_contact.image), - ), - Padding( - padding: const EdgeInsets.all(16), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - _contact.name, - style: const TextStyle(fontWeight: FontWeight.bold), - ), - Text(_contact.mobileNumber), - ], - ), - ), - Text(_contact.date.toIso8601String().split('T').first), - Expanded( - child: Container(), - ), - if (_contact.isIncoming) - Icon( - Icons.arrow_downward, - color: Colors.red, - ) - else - Icon( - Icons.arrow_upward, - color: Colors.green, - ) - ], - ), - ), - ); - } - - Widget buildContactsList() { - return ListView.builder( - itemBuilder: (_context, index) { - return buildContactItem(contacts[index]); - }, - itemCount: contacts.length, - ); - } - - @override - Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text(widget.title), + centerTitle: true, + elevation: 0, ), body: Center( - child: _pages[_selectedIndex], + child: Weather(), ), - bottomNavigationBar: BottomNavigationBar( - items: const [ - BottomNavigationBarItem( - icon: Icon(Icons.home), - label: 'Recent', - ), - BottomNavigationBarItem( - icon: Icon(Icons.favorite), - label: 'Favorites', - ), - BottomNavigationBarItem( - icon: Icon(Icons.access_time_outlined), - label: 'School', - activeIcon: Icon(Icons.access_time_filled) - ), - ], - currentIndex: _selectedIndex, - selectedItemColor: Colors.amber[800], - onTap: _onItemTapped, - ), - ); - } + ), + )); } diff --git a/lib/widgets/get_weather.dart b/lib/widgets/get_weather.dart new file mode 100644 index 0000000..942f0bf --- /dev/null +++ b/lib/widgets/get_weather.dart @@ -0,0 +1,121 @@ +import 'package:flutter/material.dart'; +import 'package:http/http.dart' as http; +import 'dart:convert'; + +class Weather extends StatefulWidget { + const Weather({Key? key}) : super(key: key); + + @override + _WeatherState createState() => _WeatherState(); +} + +class _WeatherState extends State { + var loc; + + Future getLocation() async { + String apiURL = "https://ipwhois.app/json/"; + var locationRes = await http.get(Uri.parse(apiURL)); + if (locationRes.statusCode != 200) { + return false; + } else { + return jsonDecode(locationRes.body)['country'].toLowerCase(); + } + } + + Future getWeather() async { + var location = await getLocation(); + loc = location; + String apiURL = + "http://api.weatherapi.com/v1/current.json?key=058ac018c1e747ebb0142704212410&q=$location&aqi=no"; + var weatherRes = await http.get(Uri.parse(apiURL)); + if (weatherRes.statusCode != 200) { + return false; + } else { + return weatherRes.body; + } + } + + refresh() { + setState(() {}); + } + + @override + Widget build(BuildContext context) { + return FutureBuilder( + future: getWeather(), + builder: (contex, snapShot) { + if (snapShot.data == null) { + return const CircularProgressIndicator(); + } else { + var weatherInfo = jsonDecode(snapShot.data.toString()); + var iconFullPath = + weatherInfo['current']['condition']['icon'].toString().split('/'); + var iconName = 'assets/${iconFullPath[5]}/${iconFullPath[6]}'; + print(iconName); + return snapShot.connectionState == ConnectionState.waiting + ? const CircularProgressIndicator() + : Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Padding( + padding: const EdgeInsets.all(8.0), + child: snapShot.connectionState == ConnectionState.waiting + ? const CircularProgressIndicator() + : Text( + weatherInfo['location']['localtime'] + .toString() + .split(' ') + .first + .toString(), + style: const TextStyle( + color: Colors.yellow, + ), + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + 'Location ${weatherInfo['location']['name']} ${weatherInfo['location']['country']}', + style: const TextStyle( + color: Colors.yellow, + ), + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + "Temp In Celsius " + + '${weatherInfo['current']['temp_c'].toString()} ' + + "C", + style: const TextStyle( + color: Colors.yellow, + ), + ), + ), + Padding( + padding: const EdgeInsets.all(8.0), + child: Text( + "Temp In Fahrenheit " + + '${weatherInfo['current']['temp_f'].toString()} ' + + "F", + style: const TextStyle( + color: Colors.yellow, + ), + ), + ), + Image.asset( + iconName, + ), + FloatingActionButton( + onPressed: () { + setState(() {}); + }, + child: const Icon(Icons.refresh), + ) + ], + ); + } + }, + ); + } +} diff --git a/lib/widgets/main_page.dart b/lib/widgets/main_page.dart new file mode 100644 index 0000000..914e640 --- /dev/null +++ b/lib/widgets/main_page.dart @@ -0,0 +1,36 @@ +import 'package:flutter/material.dart'; + +class MainPage extends StatefulWidget { + const MainPage({Key? key}) : super(key: key); + + @override + _MainPageState createState() => _MainPageState(); +} + +class _MainPageState extends State { + @override + Widget build(BuildContext context) { + return Scaffold( + backgroundColor: Colors.blueGrey[800], + appBar: AppBar( + backgroundColor: Colors.blueGrey[700], + title: const Text( + "Weather App", + style: TextStyle( + color: Colors.yellow, + ), + ), + centerTitle: true, + elevation: 0, + ), + // body: FutureBuilder( + // future: + // builder: (contx, value) { + // print(value); + // print("value"); + // return Text('${value.data}'); + // }, + // ), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index 750761f..fe1b0ed 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -69,11 +69,32 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.4" + flutter_svg: + dependency: "direct main" + description: + name: flutter_svg + url: "https://pub.dartlang.org" + source: hosted + version: "0.23.0+1" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" + http: + dependency: "direct main" + description: + name: http + url: "https://pub.dartlang.org" + source: hosted + version: "0.13.4" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.0" lints: dependency: transitive description: @@ -102,6 +123,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.0" + path_drawing: + dependency: transitive + description: + name: path_drawing + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.1+1" + path_parsing: + dependency: transitive + description: + name: path_parsing + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.1" + petitparser: + dependency: transitive + description: + name: petitparser + url: "https://pub.dartlang.org" + source: hosted + version: "4.4.0" sky_engine: dependency: transitive description: flutter @@ -163,5 +205,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.0" + xml: + dependency: transitive + description: + name: xml + url: "https://pub.dartlang.org" + source: hosted + version: "5.3.1" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=2.14.0 <3.0.0" + flutter: ">=1.24.0-7.0" diff --git a/pubspec.yaml b/pubspec.yaml index 1c93cc7..b0d56a6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,4 +1,4 @@ -name: contacts_01 +name: test1 description: A new Flutter project. # The following line prevents the package from being accidentally published to @@ -34,6 +34,8 @@ 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 + http: ^0.13.4 + flutter_svg: ^0.23.0+1 dev_dependencies: flutter_test: @@ -58,9 +60,9 @@ flutter: 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/day/ + - assets/night/ # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware. diff --git a/test/widget_test.dart b/test/widget_test.dart deleted file mode 100644 index 5f578bd..0000000 --- a/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// 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:contacts_01/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(const 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); - }); -} diff --git a/web/index.html b/web/index.html index d2606e7..13ed737 100644 --- a/web/index.html +++ b/web/index.html @@ -23,10 +23,10 @@ - + - contacts_01 + test1 diff --git a/web/manifest.json b/web/manifest.json index 9631a79..3f85384 100644 --- a/web/manifest.json +++ b/web/manifest.json @@ -1,6 +1,6 @@ { - "name": "contacts_01", - "short_name": "contacts_01", + "name": "test1", + "short_name": "test1", "start_url": ".", "display": "standalone", "background_color": "#0175C2",