Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ashuntu committed Aug 9, 2024
0 parents commit c5621bc
Show file tree
Hide file tree
Showing 33 changed files with 1,653 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/snap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Snap

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
snap:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: snapcore/action-build@v1
id: snapcraft
- uses: actions/upload-artifact@v3
if: github.event_name == 'workflow_dispatch'
with:
name: 'snap'
path: ${{steps.snapcraft.outputs.snap}}
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
target
*.snap

# Flutter/Dart/Pub related
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
pubspec.lock
pubspec_overrides.yaml
build/
coverage/
*.g.dart
*.freezed.dart
*.mocks.dart

# IntelliJ related
*.iml
*.idea
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flutter 3.24.0-stable
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Game Center

Flutter app for system and game tweaks and information.

## Development

1. Install [Flutter](https://docs.flutter.dev/get-started/install/linux/desktop)
and [Melos](https://melos.invertase.dev/~melos-latest/getting-started)
2. Bootstrap the monorepo
```
melos bootstrap
```
3. Run the app
```
cd packages/game_center
flutter run
```
4 changes: 4 additions & 0 deletions melos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: game_center

packages:
- packages/**
43 changes: 43 additions & 0 deletions packages/game_center/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
45 changes: 45 additions & 0 deletions packages/game_center/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "2e9cb0aa71a386a91f73f7088d115c0d96654829"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
base_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
- platform: android
create_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
base_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
- platform: ios
create_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
base_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
- platform: linux
create_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
base_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
- platform: macos
create_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
base_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
- platform: web
create_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
base_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
- platform: windows
create_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829
base_revision: 2e9cb0aa71a386a91f73f7088d115c0d96654829

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
1 change: 1 addition & 0 deletions packages/game_center/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# game_center
1 change: 1 addition & 0 deletions packages/game_center/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include: package:ubuntu_lints/analysis_options.yaml
4 changes: 4 additions & 0 deletions packages/game_center/l10n.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
arb-dir: lib/l10n
template-arb-file: app_en.arb
output-localization-file: app_localizations.dart
nullable-getter: false
21 changes: 21 additions & 0 deletions packages/game_center/lib/about/about_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:yaru/yaru.dart';

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

static IconData icon(bool selected) =>
selected ? YaruIcons.information_filled : YaruIcons.information;
static String label(BuildContext context) =>
AppLocalizations.of(context).aboutPageLabel;

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context);

return Center(
child: Text(l10n.aboutPageLabel),
);
}
}
68 changes: 68 additions & 0 deletions packages/game_center/lib/app/app.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:game_center/app/app_pages.dart';
import 'package:ubuntu_localizations/ubuntu_localizations.dart';
import 'package:yaru/yaru.dart';

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

@override
Widget build(BuildContext context) {
return YaruTheme(
builder: (context, yaru, child) => MaterialApp(
theme: yaru.theme,
darkTheme: yaru.darkTheme,
highContrastTheme: yaruHighContrastLight,
highContrastDarkTheme: yaruHighContrastDark,
localizationsDelegates: const <LocalizationsDelegate<dynamic>>[
...AppLocalizations.localizationsDelegates,
...GlobalUbuntuLocalizations.delegates,
],
supportedLocales: AppLocalizations.supportedLocales,
home: const _AppFrame(),
),
);
}
}

class _AppFrame extends StatelessWidget {
const _AppFrame();

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context);
YaruWindow.of(context).setTitle(l10n.appTitle);

return Scaffold(
appBar: _TitleBar(
title: Text(l10n.appTitle),
),
body: YaruMasterDetailPage(
length: pages.length,
tileBuilder: (context, index, selected, availableWidth) =>
pages[index].titleBuilder(context, selected),
pageBuilder: (context, index) => pages[index].pageBuilder(context),
layoutDelegate: const YaruMasterFixedPaneDelegate(
paneWidth: 164,
),
),
);
}
}

class _TitleBar extends StatelessWidget implements PreferredSizeWidget {
const _TitleBar({required this.title});

final Widget title;

@override
Widget build(BuildContext context) {
return YaruWindowTitleBar(
title: title,
);
}

@override
Size get preferredSize => const Size(0, kYaruTitleBarHeight);
}
60 changes: 60 additions & 0 deletions packages/game_center/lib/app/app_pages.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import 'package:flutter/widgets.dart';
import 'package:game_center/about/about_page.dart';
import 'package:game_center/launcher/launcher_page.dart';
import 'package:game_center/settings/settings_page.dart';
import 'package:game_center/steam/steam_page.dart';
import 'package:game_center/system/system_page.dart';
import 'package:yaru/yaru.dart';

typedef AppPage = ({
Widget Function(BuildContext context, bool selected) titleBuilder,
WidgetBuilder pageBuilder,
});

final pages = <AppPage>[
(
titleBuilder: (context, selected) => YaruMasterTile(
leading: Icon(LauncherPage.icon(selected)),
title: Text(LauncherPage.label(context)),
),
pageBuilder: (_) => const YaruDetailPage(
body: LauncherPage(),
),
),
(
titleBuilder: (context, selected) => YaruMasterTile(
leading: Icon(SteamPage.icon(selected)),
title: Text(SteamPage.label(context)),
),
pageBuilder: (_) => const YaruDetailPage(
body: SteamPage(),
),
),
(
titleBuilder: (context, selected) => YaruMasterTile(
leading: Icon(SystemPage.icon(selected)),
title: Text(SystemPage.label(context)),
),
pageBuilder: (_) => const YaruDetailPage(
body: SystemPage(),
),
),
(
titleBuilder: (context, selected) => YaruMasterTile(
leading: Icon(SettingsPage.icon(selected)),
title: Text(SettingsPage.label(context)),
),
pageBuilder: (_) => const YaruDetailPage(
body: SettingsPage(),
),
),
(
titleBuilder: (context, selected) => YaruMasterTile(
leading: Icon(AboutPage.icon(selected)),
title: Text(AboutPage.label(context)),
),
pageBuilder: (_) => const YaruDetailPage(
body: AboutPage(),
),
),
];
14 changes: 14 additions & 0 deletions packages/game_center/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"@@locale": "en",
"appTitle": "Game Center",

"aboutPageLabel": "About",

"launcherPageLabel": "Apps",

"steamPageLabel": "Steam",

"settingsPageLabel": "Settings",

"systemPageLabel": "System"
}
21 changes: 21 additions & 0 deletions packages/game_center/lib/launcher/launcher_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:yaru/yaru.dart';

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

static IconData icon(bool selected) =>
selected ? YaruIcons.folder_open_filled : YaruIcons.folder;
static String label(BuildContext context) =>
AppLocalizations.of(context).launcherPageLabel;

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context);

return Center(
child: Text(l10n.launcherPageLabel),
);
}
}
11 changes: 11 additions & 0 deletions packages/game_center/lib/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:flutter/material.dart';
import 'package:game_center/app/app.dart';
import 'package:ubuntu_localizations/ubuntu_localizations.dart';
import 'package:yaru/yaru.dart';

Future<void> main() async {
await initDefaultLocale();
await YaruWindowTitleBar.ensureInitialized();

runApp(const App());
}
21 changes: 21 additions & 0 deletions packages/game_center/lib/settings/settings_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/widgets.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:yaru/yaru.dart';

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

static IconData icon(bool selected) =>
selected ? YaruIcons.settings_filled : YaruIcons.settings;
static String label(BuildContext context) =>
AppLocalizations.of(context).settingsPageLabel;

@override
Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context);

return Center(
child: Text(l10n.settingsPageLabel),
);
}
}
Loading

0 comments on commit c5621bc

Please sign in to comment.