-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: WeatherRepository * feat: fake realtime weather * refactor: extracted weather to own folder * removed unnecessary Positioned and key * refactor: changed structure * added packages workflows * fix: comment and bootstrap
- Loading branch information
Showing
51 changed files
with
1,219 additions
and
314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: weather_api_client | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "packages/weather_api_client/**" | ||
- ".github/workflows/weather_api_client.yaml" | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1 | ||
with: | ||
working_directory: packages/weather_api_client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: weather_repository | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "packages/weather_repository/**" | ||
- ".github/workflows/weather_repository.yaml" | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1 | ||
with: | ||
working_directory: packages/weather_repository |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
import 'package:airplane_entertainment_system/app/app.dart'; | ||
import 'package:airplane_entertainment_system/bootstrap.dart'; | ||
import 'package:just_audio/just_audio.dart'; | ||
import 'package:music_repository/music_repository.dart'; | ||
import 'package:weather_api_client/weather_api_client.dart'; | ||
import 'package:weather_repository/weather_repository.dart'; | ||
|
||
void main() { | ||
bootstrap(() => const App()); | ||
bootstrap(() { | ||
final weatherRepository = WeatherRepository(WeatherApiClient()); | ||
final musicRepository = MusicRepository(); | ||
final audioPlayer = AudioPlayer(); | ||
|
||
return App( | ||
weatherRepository: weatherRepository, | ||
musicRepository: musicRepository, | ||
audioPlayer: audioPlayer, | ||
); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
import 'package:airplane_entertainment_system/app/app.dart'; | ||
import 'package:airplane_entertainment_system/bootstrap.dart'; | ||
import 'package:just_audio/just_audio.dart'; | ||
import 'package:music_repository/music_repository.dart'; | ||
import 'package:weather_api_client/weather_api_client.dart'; | ||
import 'package:weather_repository/weather_repository.dart'; | ||
|
||
void main() { | ||
bootstrap(() => const App()); | ||
bootstrap(() { | ||
final weatherRepository = WeatherRepository(WeatherApiClient()); | ||
final musicRepository = MusicRepository(); | ||
final audioPlayer = AudioPlayer(); | ||
|
||
return App( | ||
weatherRepository: weatherRepository, | ||
musicRepository: musicRepository, | ||
audioPlayer: audioPlayer, | ||
); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,20 @@ | ||
import 'package:airplane_entertainment_system/app/app.dart'; | ||
import 'package:airplane_entertainment_system/bootstrap.dart'; | ||
import 'package:just_audio/just_audio.dart'; | ||
import 'package:music_repository/music_repository.dart'; | ||
import 'package:weather_api_client/weather_api_client.dart'; | ||
import 'package:weather_repository/weather_repository.dart'; | ||
|
||
void main() { | ||
bootstrap(() => const App()); | ||
bootstrap(() { | ||
final weatherRepository = WeatherRepository(WeatherApiClient()); | ||
final musicRepository = MusicRepository(); | ||
final audioPlayer = AudioPlayer(); | ||
|
||
return App( | ||
weatherRepository: weatherRepository, | ||
musicRepository: musicRepository, | ||
audioPlayer: audioPlayer, | ||
); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:bloc/bloc.dart'; | ||
import 'package:equatable/equatable.dart'; | ||
import 'package:weather_repository/weather_repository.dart'; | ||
|
||
part 'weather_event.dart'; | ||
part 'weather_state.dart'; | ||
|
||
class WeatherBloc extends Bloc<WeatherEvent, WeatherState> { | ||
WeatherBloc({ | ||
required WeatherRepository weatherRepository, | ||
}) : _weatherRepository = weatherRepository, | ||
super(const WeatherState()) { | ||
on<WeatherUpdatesRequested>(_onWeatherUpdatesRequested); | ||
} | ||
|
||
final WeatherRepository _weatherRepository; | ||
|
||
Future<void> _onWeatherUpdatesRequested( | ||
WeatherUpdatesRequested event, | ||
Emitter<WeatherState> emit, | ||
) async { | ||
await emit.forEach( | ||
_weatherRepository.weatherInformation, | ||
onData: (weatherInfo) { | ||
return state.copyWith( | ||
weatherInfo: weatherInfo, | ||
status: WeatherStatus.updating, | ||
); | ||
}, | ||
onError: (error, stackTrace) { | ||
return state.copyWith(status: WeatherStatus.error); | ||
}, | ||
); | ||
} | ||
} |
Oops, something went wrong.