Skip to content

Commit

Permalink
Merge branch 'main' into feat/flight-tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
marwfair committed Aug 1, 2024
2 parents 7616976 + f7c1ee0 commit 2b471cc
Show file tree
Hide file tree
Showing 74 changed files with 1,796 additions and 434 deletions.
3 changes: 2 additions & 1 deletion .github/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"localizable",
"mostrado",
"página",
"Texto"
"Texto",
"Kirpal"
]
}
19 changes: 19 additions & 0 deletions .github/workflows/weather_api_client.yaml
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
19 changes: 19 additions & 0 deletions .github/workflows/weather_repository.yaml
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 removed assets/thunder.png
Binary file not shown.
Binary file added assets/weather/clear.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/weather/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/weather/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/weather/thunderstorms.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,33 @@ import 'package:aes_ui/aes_ui.dart';
import 'package:airplane_entertainment_system/airplane_entertainment_system/airplane_entertainment_system.dart';
import 'package:airplane_entertainment_system/music_player/music_player.dart';
import 'package:airplane_entertainment_system/overview/overview.dart';
import 'package:airplane_entertainment_system/weather/weather.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class AirplaneEntertainmentSystemScreen extends StatefulWidget {
class AirplaneEntertainmentSystemScreen extends StatelessWidget {
const AirplaneEntertainmentSystemScreen({super.key});

@override
State<AirplaneEntertainmentSystemScreen> createState() =>
_AirplaneEntertainmentSystemScreenState();
Widget build(BuildContext context) {
return BlocProvider(
create: (context) => WeatherBloc(weatherRepository: context.read())
..add(const WeatherUpdatesRequested()),
child: const AirplaneEntertainmentSystemView(),
);
}
}

class AirplaneEntertainmentSystemView extends StatefulWidget {
const AirplaneEntertainmentSystemView({super.key});

@override
State<AirplaneEntertainmentSystemView> createState() =>
_AirplaneEntertainmentSystemViewState();
}

class _AirplaneEntertainmentSystemScreenState
extends State<AirplaneEntertainmentSystemScreen> {
class _AirplaneEntertainmentSystemViewState
extends State<AirplaneEntertainmentSystemView> {
int _currentPage = 0;

@override
Expand Down Expand Up @@ -82,7 +97,7 @@ class _AirplaneEntertainmentSystemScreenState
child: AnimatedOpacity(
duration: const Duration(milliseconds: 600),
opacity: _currentPage == 0 ? 0.8 : 0,
child: const Clouds(
child: const WeatherClouds(
key: Key('foregroundClouds'),
count: 3,
averageScale: 0.25,
Expand Down Expand Up @@ -178,7 +193,7 @@ class _ContentPageViewState extends State<_ContentPageView>
Widget build(BuildContext context) {
final isSmall = AesLayout.of(context) == AesLayoutData.small;
final pageSize = widget.pageSize;
final pageSide = isSmall ? pageSize.width : pageSize.width.hashCode;
final pageSide = isSmall ? pageSize.width : pageSize.height;
final pageOffset = pageSide / 4;
final axis = isSmall ? Axis.horizontal : Axis.vertical;

Expand Down
25 changes: 3 additions & 22 deletions lib/airplane_entertainment_system/widgets/system_background.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:airplane_entertainment_system/airplane_entertainment_system/airplane_entertainment_system.dart';
import 'package:airplane_entertainment_system/weather/weather.dart';
import 'package:flutter/material.dart' hide Image;

class SystemBackground extends StatelessWidget {
Expand All @@ -14,30 +14,11 @@ class SystemBackground extends StatelessWidget {
return Stack(
fit: StackFit.expand,
children: [
AnimatedContainer(
duration: const Duration(milliseconds: 600),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
if (page == 1)
const Color(0xFFFFFFFF)
else
const Color(0xffb1fff8),
const Color(0xFF00A8DC),
],
stops: [
if (page == 1) 0.2 else 0.0,
1.0,
],
begin: Alignment.topRight,
end: Alignment.centerLeft,
),
),
),
WeatherBackground(enabled: page == 0),
AnimatedOpacity(
duration: const Duration(milliseconds: 600),
opacity: page == 0 ? 1 : 0,
child: const Clouds(
child: const WeatherClouds(
key: Key('backgroundClouds'),
count: 5,
averageScale: 1,
Expand Down
1 change: 0 additions & 1 deletion lib/airplane_entertainment_system/widgets/widgets.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export 'clouds.dart';
export 'system_background.dart';
export 'top_button_bar.dart';
23 changes: 18 additions & 5 deletions lib/app/view/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,37 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:just_audio/just_audio.dart';
import 'package:music_repository/music_repository.dart';
import 'package:weather_repository/weather_repository.dart';

class App extends StatelessWidget {
const App({
required WeatherRepository weatherRepository,
required MusicRepository musicRepository,
required AudioPlayer audioPlayer,
required FlightInformationRepository flightInformationRepository,
super.key,
}) : _flightInformationRepository = flightInformationRepository;
}) : _weatherRepository = weatherRepository,
_musicRepository = musicRepository,
_audioPlayer = audioPlayer,
_flightInformationRepository = flightInformationRepository;

final WeatherRepository _weatherRepository;
final MusicRepository _musicRepository;
final AudioPlayer _audioPlayer;
final FlightInformationRepository _flightInformationRepository;

@override
Widget build(BuildContext context) {
return MultiRepositoryProvider(
providers: [
RepositoryProvider(
create: (context) => MusicRepository(),
RepositoryProvider.value(
value: _weatherRepository,
),
RepositoryProvider.value(
value: _musicRepository,
),
RepositoryProvider(
create: (context) => AudioPlayer(),
RepositoryProvider.value(
value: _audioPlayer,
),
RepositoryProvider.value(
value: _flightInformationRepository,
Expand Down
1 change: 1 addition & 0 deletions lib/bootstrap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ Future<void> bootstrap(FutureOr<Widget> Function() builder) async {

// Add cross-flavor configuration here

WidgetsFlutterBinding.ensureInitialized();
runApp(await builder());
}
30 changes: 29 additions & 1 deletion lib/generated/assets.gen.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions lib/l10n/arb/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,26 @@
"welcomeMessage": "Welcome on board",
"welcomeSubtitle": "Lunch will be served in\n10 minutes",
"assistButton": "ASSIST",
"clear": "Clear",
"@clear": {
"description": "The label shown when weather is clear."
},
"cloudy": "Cloudy",
"@cloudy": {
"description": "The label shown when weather is cloudy."
},
"rainy": "Rainy",
"@rainy": {
"description": "The label shown when weather is rainy."
},
"thunderstorms": "Thunderstorms",
"@thunderstorms": {
"description": "The label shown when weather is thunderstorms."
},
"weatherErrorMessage": "Uh oh! There was an error while fetching the weather information.",
"@weatherErrorMessage": {
"description": "The error message for when the weather information fails to update."
},
"trackingErrorMessage": "Uh oh! There was an error while fetching the flight information.",
"@trackingErrorMessage": {
"description": "The error message for when the flight tracking information fails to update."
Expand Down
10 changes: 10 additions & 0 deletions lib/main_development.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@ import 'package:airplane_entertainment_system/app/app.dart';
import 'package:airplane_entertainment_system/bootstrap.dart';
import 'package:flight_api_client/flight_api_client.dart';
import 'package:flight_information_repository/flight_information_repository.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(() {
final weatherRepository = WeatherRepository(WeatherApiClient());
final musicRepository = MusicRepository();
final audioPlayer = AudioPlayer();
final flightInformationRepository =
FlightInformationRepository(FlightApiClient());

return App(
weatherRepository: weatherRepository,
musicRepository: musicRepository,
audioPlayer: audioPlayer,
flightInformationRepository: flightInformationRepository,
);
});
Expand Down
10 changes: 10 additions & 0 deletions lib/main_production.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@ import 'package:airplane_entertainment_system/app/app.dart';
import 'package:airplane_entertainment_system/bootstrap.dart';
import 'package:flight_api_client/flight_api_client.dart';
import 'package:flight_information_repository/flight_information_repository.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(() {
final weatherRepository = WeatherRepository(WeatherApiClient());
final musicRepository = MusicRepository();
final audioPlayer = AudioPlayer();
final flightInformationRepository =
FlightInformationRepository(FlightApiClient());

return App(
weatherRepository: weatherRepository,
musicRepository: musicRepository,
audioPlayer: audioPlayer,
flightInformationRepository: flightInformationRepository,
);
});
Expand Down
10 changes: 10 additions & 0 deletions lib/main_staging.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@ import 'package:airplane_entertainment_system/app/app.dart';
import 'package:airplane_entertainment_system/bootstrap.dart';
import 'package:flight_api_client/flight_api_client.dart';
import 'package:flight_information_repository/flight_information_repository.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(() {
final weatherRepository = WeatherRepository(WeatherApiClient());
final musicRepository = MusicRepository();
final audioPlayer = AudioPlayer();
final flightInformationRepository =
FlightInformationRepository(FlightApiClient());

return App(
weatherRepository: weatherRepository,
musicRepository: musicRepository,
audioPlayer: audioPlayer,
flightInformationRepository: flightInformationRepository,
);
});
Expand Down
2 changes: 1 addition & 1 deletion lib/music_player/cubit/music_player_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class MusicPlayerCubit extends Cubit<MusicPlayerState> {

void _onProgressChanged(Duration position) {
final duration = _player.duration;
if (duration == null) return;
if (duration == null || duration.inMilliseconds == 0) return;
final progress = position.inMilliseconds / duration.inMilliseconds;
emit(state.copyWith(progress: progress));
}
Expand Down
11 changes: 10 additions & 1 deletion lib/music_player/widgets/music_visualizer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,17 @@ class MusicVisualizerState extends State<MusicVisualizer>
);
spectrogramIndex = 0;
spectrogram = (jsonDecode(spectrogramData) as List)
.map((e) => (e as List).map((e) => (e as num).toDouble()).toList())
.map(
(e) => (e as List)
// TODO(jolexxa): very bad hack to chop off the lowest and
// highest frequencies of the spectrograph. This makes the
// visualizer look more appealing.
.sublist(2, e.length - 2)
.map((e) => (e as num).toDouble())
.toList(),
)
.toList();

frequencyTweens = [
for (final frequency in spectrogram[spectrogramIndex])
ConstantTween<double>(frequency),
Expand Down
1 change: 1 addition & 0 deletions lib/overview/view/overview_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:aes_ui/aes_ui.dart';
import 'package:airplane_entertainment_system/flight_tracking/flight_tracking.dart';
import 'package:airplane_entertainment_system/l10n/l10n.dart';
import 'package:airplane_entertainment_system/overview/overview.dart';
import 'package:airplane_entertainment_system/weather/weather.dart';
import 'package:flutter/material.dart';

class OverviewPage extends StatelessWidget {
Expand Down
Loading

0 comments on commit 2b471cc

Please sign in to comment.