Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add aes_ui package #3

Merged
merged 2 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/aes_ui.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: aes_ui

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
paths:
- "packages/aes_ui/**"
- ".github/workflows/aes_ui.yaml"
branches:
- main

jobs:
build:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
with:
flutter_channel: stable
working_directory: packages/aes_ui
coverage_excludes: "**/*.g.dart"
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
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';
Expand All @@ -17,6 +18,19 @@ class _AirplaneEntertainmentSystemScreenState

@override
Widget build(BuildContext context) {
final layout = AesLayout.of(context);

const destinations = <Destination>[
Destination(
Icon(Icons.airplanemode_active_outlined),
'Home',
),
Destination(
Icon(Icons.music_note),
'Music',
),
];

return Scaffold(
body: LayoutBuilder(
builder: (context, constraints) {
Expand All @@ -33,14 +47,16 @@ class _AirplaneEntertainmentSystemScreenState
Expanded(
child: Row(
children: [
LeftSideNavigationRail(
selectedIndex: _currentPage,
onOptionSelected: (value) {
setState(() {
_currentPage = value;
});
},
),
if (layout == AesLayoutData.large)
AesNavigationRail(
destinations: destinations,
selectedIndex: _currentPage,
onDestinationSelected: (value) {
setState(() {
_currentPage = value;
});
},
),
Expanded(
child: _ContentPageView(
pageSize: Size(
Expand Down Expand Up @@ -76,6 +92,17 @@ class _AirplaneEntertainmentSystemScreenState
);
},
),
bottomNavigationBar: (layout == AesLayoutData.small)
? AesBottomNavigationBar(
destinations: destinations,
selectedIndex: _currentPage,
onDestinationSelected: (value) {
setState(() {
_currentPage = value;
});
},
)
: null,
);
}
}
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion lib/airplane_entertainment_system/widgets/widgets.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export 'clouds.dart';
export 'left_side_navigation_rail.dart';
export 'system_background.dart';
export 'top_button_bar.dart';
16 changes: 7 additions & 9 deletions lib/app/view/app.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:aes_ui/aes_ui.dart';
import 'package:airplane_entertainment_system/airplane_entertainment_system/airplane_entertainment_system.dart';
import 'package:airplane_entertainment_system/l10n/l10n.dart';
import 'package:flutter/material.dart';
Expand All @@ -7,16 +8,13 @@ class App extends StatelessWidget {

@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
appBarTheme: AppBarTheme(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
),
useMaterial3: true,
return AesLayout(
child: MaterialApp(
theme: const AesTheme().themeData,
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: const AirplaneEntertainmentSystemScreen(),
),
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
home: const AirplaneEntertainmentSystemScreen(),
);
}
}
8 changes: 3 additions & 5 deletions lib/music_player/view/music_player_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:aes_ui/aes_ui.dart';
import 'package:airplane_entertainment_system/l10n/l10n.dart';
import 'package:airplane_entertainment_system/music_player/music_player.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -216,16 +217,13 @@ class _MusicMenuHeader extends StatelessWidget {
@override
Widget build(BuildContext context) {
final l10n = context.l10n;

return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
l10n.goodVibes,
style: const TextStyle(
fontSize: 60,
fontWeight: FontWeight.w600,
height: 1,
),
style: AesTextStyles.headlineLarge,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 10),
Expand Down
121 changes: 81 additions & 40 deletions lib/overview/view/overview_page.dart
Original file line number Diff line number Diff line change
@@ -1,52 +1,96 @@
import 'package:aes_ui/aes_ui.dart';
import 'package:airplane_entertainment_system/l10n/l10n.dart';
import 'package:airplane_entertainment_system/overview/overview.dart';
import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) {
final layout = AesLayout.of(context);

return switch (layout) {
AesLayoutData.small => const _SmallOverviewPage(),
AesLayoutData.large => const _LargeOverviewPage(),
};
}
}

class _SmallOverviewPage extends StatelessWidget {
const _SmallOverviewPage();

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(
vertical: 20,
),
child: LayoutBuilder(
builder: (context, constraints) {
final isWide = constraints.maxWidth > 800;
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(width: 60),
Expanded(
flex: 4,
child: ListView(
padding: const EdgeInsets.only(right: 80),
children: const [
WelcomeCopy(),
SizedBox(height: 40),
FlightTrackingCard(),
SizedBox(height: 20),
WeatherCard(),
SizedBox(height: 20),
MusicCard(),
SizedBox(height: 20),
MovieCard(),
],
),
),
],
),
);
}
}

return Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
if (isWide)
const Expanded(
flex: 5,
child: Padding(
padding: EdgeInsets.only(left: 80),
child: AirplaneImage(),
),
),
const SizedBox(width: 60),
Expanded(
flex: 4,
child: ListView(
padding: const EdgeInsets.only(right: 80),
children: const [
WelcomeCopy(),
SizedBox(height: 40),
FlightTrackingCard(),
SizedBox(height: 20),
WeatherCard(),
SizedBox(height: 20),
MusicCard(),
SizedBox(height: 20),
MovieCard(),
],
),
),
],
);
},
class _LargeOverviewPage extends StatelessWidget {
const _LargeOverviewPage();

@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(
vertical: 20,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const Expanded(
flex: 5,
child: Padding(
padding: EdgeInsets.only(left: 80),
child: AirplaneImage(),
),
),
const SizedBox(width: 60),
Expanded(
flex: 4,
child: ListView(
padding: const EdgeInsets.only(right: 80),
children: const [
WelcomeCopy(),
SizedBox(height: 40),
FlightTrackingCard(),
SizedBox(height: 20),
WeatherCard(),
SizedBox(height: 20),
MusicCard(),
SizedBox(height: 20),
MovieCard(),
],
),
),
],
),
);
}
Expand All @@ -58,18 +102,15 @@ class WelcomeCopy extends StatelessWidget {
@override
Widget build(BuildContext context) {
final l10n = context.l10n;

return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const SizedBox(height: 50),
Text(
l10n.welcomeMessage,
maxLines: 2,
style: const TextStyle(
fontSize: 60,
fontWeight: FontWeight.w600,
height: 1,
),
style: AesTextStyles.headlineLarge,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 10),
Expand Down
Loading