Skip to content

Commit

Permalink
View sckeloton
Browse files Browse the repository at this point in the history
  • Loading branch information
Kendi J authored and Kendi J committed Oct 6, 2023
1 parent 8e7611e commit f247302
Show file tree
Hide file tree
Showing 20 changed files with 344 additions and 115 deletions.
Binary file added assets/images/forest_cloudy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/forest_rainy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/forest_sunny.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/sea_cloudy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/sea_rainy.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/sea_sunnypng.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
44 changes: 44 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,7 @@
<true/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your location is required for the weather app</string>
</dict>
</plist>
81 changes: 2 additions & 79 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:weather_app/presentation/views/rainy.dart';

void main() {
runApp(const MyApp());
Expand All @@ -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<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
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: <Widget>[
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.
);
}
}
165 changes: 165 additions & 0 deletions lib/presentation/views/rainy.dart
Original file line number Diff line number Diff line change
@@ -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<StatefulWidget> createState() => _RainyView();
}

class _RainyView extends State<RainyView> {
@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>[
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,
});
}
7 changes: 7 additions & 0 deletions lib/presentation/widgets/consts/theme.dart
Original file line number Diff line number Diff line change
@@ -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);
}
8 changes: 8 additions & 0 deletions lib/services/weather_service.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import 'package:location/location.dart';

class WeatherService {
static Future<dynamic> getWeather() async {
final String key = '';
LocationData location = await Location().getLocation();
}
}
1 change: 1 addition & 0 deletions macos/Flutter/Flutter-Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
1 change: 1 addition & 0 deletions macos/Flutter/Flutter-Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
2 changes: 2 additions & 0 deletions macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import FlutterMacOS
import Foundation

import location

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
LocationPlugin.register(with: registry.registrar(forPlugin: "LocationPlugin"))
}
43 changes: 43 additions & 0 deletions macos/Podfile
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit f247302

Please sign in to comment.