diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d33dd4a..b330e67 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -744,6 +744,13 @@ jobs: - uses: subosito/flutter-action@v2.17.0 with: flutter-version-file: app/pubspec.yaml + - name: Build nessesary files + working-directory: ./ + run: | + cd tools + dart pub get + cd .. + dart run tools/generate.dart - name: 📦 Get dependencies run: | flutter pub get diff --git a/app/android/Gemfile.lock b/app/android/Gemfile.lock index 0cbf934..e40da6c 100644 --- a/app/android/Gemfile.lock +++ b/app/android/Gemfile.lock @@ -11,7 +11,7 @@ GEM atomos (0.1.3) aws-eventstream (1.3.0) aws-partitions (1.1013.0) - aws-sdk-core (3.213.0) + aws-sdk-core (3.214.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) @@ -19,7 +19,7 @@ GEM aws-sdk-kms (1.96.0) aws-sdk-core (~> 3, >= 3.210.0) aws-sigv4 (~> 1.5) - aws-sdk-s3 (1.173.0) + aws-sdk-s3 (1.174.0) aws-sdk-core (~> 3, >= 3.210.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.5) diff --git a/app/lib/l10n/app_en.arb b/app/lib/l10n/app_en.arb index c2659bd..485608c 100644 --- a/app/lib/l10n/app_en.arb +++ b/app/lib/l10n/app_en.arb @@ -202,5 +202,8 @@ "version": "Version", "author": "Author", "lastUsed": "Last used", - "size": "Size" + "size": "Size", + "backgrounds": "Backgorunds", + "translations": "Translations", + "editor": "Editor" } diff --git a/app/lib/main.dart b/app/lib/main.dart index d9d297b..6c685e9 100644 --- a/app/lib/main.dart +++ b/app/lib/main.dart @@ -8,6 +8,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart'; import 'package:flutter_web_plugins/url_strategy.dart'; import 'package:material_leap/l10n/leap_localizations.dart'; import 'package:material_leap/material_leap.dart'; +import 'package:setonix/pages/editor/general.dart'; import 'package:setonix/pages/game/page.dart'; import 'package:setonix/pages/home/page.dart'; import 'package:setonix/pages/settings/data.dart'; @@ -124,6 +125,13 @@ class SetonixApp extends StatelessWidget { name: state.pathParameters['name'], ), ), + GoRoute( + name: 'editor', + path: 'editor/:name', + builder: (context, state) => GeneralEditorPage( + name: state.pathParameters['name']!, + ), + ), GoRoute( name: 'connect', path: 'connect', diff --git a/app/lib/pages/editor/general.dart b/app/lib/pages/editor/general.dart new file mode 100644 index 0000000..9268501 --- /dev/null +++ b/app/lib/pages/editor/general.dart @@ -0,0 +1,48 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:material_leap/material_leap.dart'; +import 'package:setonix/pages/editor/navigation.dart'; + +class GeneralEditorPage extends StatelessWidget { + final String name; + + const GeneralEditorPage({super.key, required this.name}); + + @override + Widget build(BuildContext context) { + return EditorScaffold( + currentPage: EditorPage.general, + body: SingleChildScrollView( + child: Center( + child: ConstrainedBox( + constraints: BoxConstraints(maxWidth: LeapBreakpoints.expanded), + child: Column( + children: [ + TextField( + decoration: InputDecoration( + labelText: AppLocalizations.of(context).name, + filled: true, + ), + ), + TextField( + decoration: InputDecoration( + labelText: AppLocalizations.of(context).version, + filled: true, + ), + ), + TextField( + decoration: InputDecoration( + labelText: AppLocalizations.of(context).description, + border: OutlineInputBorder(), + ), + minLines: 3, + maxLines: 5, + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/app/lib/pages/editor/navigation.dart b/app/lib/pages/editor/navigation.dart new file mode 100644 index 0000000..02c34d8 --- /dev/null +++ b/app/lib/pages/editor/navigation.dart @@ -0,0 +1,87 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:material_leap/material_leap.dart'; +import 'package:phosphor_flutter/phosphor_flutter.dart'; + +enum EditorPage { + general, + figures, + decks, + backgrounds, + translations; + + IconGetter get icon => switch (this) { + EditorPage.general => PhosphorIcons.house, + EditorPage.figures => PhosphorIcons.cube, + EditorPage.decks => PhosphorIcons.stack, + EditorPage.backgrounds => PhosphorIcons.image, + EditorPage.translations => PhosphorIcons.translate, + }; + + String getLocalizedName(BuildContext context) { + final loc = AppLocalizations.of(context); + return switch (this) { + EditorPage.general => loc.general, + EditorPage.figures => loc.figures, + EditorPage.decks => loc.decks, + EditorPage.backgrounds => loc.backgrounds, + EditorPage.translations => loc.translations, + }; + } +} + +class EditorNavigatorView extends StatelessWidget { + final EditorPage currentPage; + + const EditorNavigatorView({ + super.key, + required this.currentPage, + }); + + @override + Widget build(BuildContext context) { + return NavigationRail( + destinations: EditorPage.values + .map((e) => NavigationRailDestination( + icon: Icon(e.icon(PhosphorIconsStyle.light)), + label: Text(e.getLocalizedName(context)), + selectedIcon: Icon(e.icon(PhosphorIconsStyle.fill)), + )) + .toList(), + selectedIndex: currentPage.index, + labelType: NavigationRailLabelType.all, + ); + } +} + +class EditorScaffold extends StatelessWidget { + final EditorPage currentPage; + final Widget body; + + const EditorScaffold({ + super.key, + required this.currentPage, + required this.body, + }); + + @override + Widget build(BuildContext context) { + final width = MediaQuery.sizeOf(context).width; + final isMobile = width < LeapBreakpoints.medium; + final navigator = EditorNavigatorView(currentPage: currentPage); + return Row( + children: [ + if (!isMobile) navigator, + Expanded( + child: Scaffold( + appBar: AppBar( + title: Text(currentPage.getLocalizedName(context)), + ), + drawer: isMobile ? navigator : null, + body: body, + ), + ), + ], + ); + } +} diff --git a/app/lib/pages/home/packs.dart b/app/lib/pages/home/packs.dart index b29cfee..3d4d4fe 100644 --- a/app/lib/pages/home/packs.dart +++ b/app/lib/pages/home/packs.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_gen/gen_l10n/app_localizations.dart'; +import 'package:go_router/go_router.dart'; import 'package:intl/intl.dart'; import 'package:material_leap/material_leap.dart'; import 'package:phosphor_flutter/phosphor_flutter.dart'; @@ -39,7 +40,7 @@ class _PacksDialogState extends State @override void initState() { super.initState(); - _tabController = TabController(length: isWorldLoaded ? 3 : 2, vsync: this); + _tabController = TabController(length: 3, vsync: this); _controller.addStatusListener((status) { if (status == AnimationStatus.dismissed) { setState(() { @@ -257,6 +258,11 @@ class _PacksDialogState extends State icon: const PhosphorIcon(PhosphorIconsLight.globe), label: Text(AppLocalizations.of(context).browse), ), + if (!isWorldLoaded) + HorizontalTab( + icon: const PhosphorIcon(PhosphorIconsLight.notePencil), + label: Text(AppLocalizations.of(context).editor), + ), ], ), const SizedBox(height: 8), @@ -313,6 +319,7 @@ class _PacksDialogState extends State child: Text(AppLocalizations.of(context).comingSoon), ), + if (bloc == null) _EditorPacksView(), ], ); }); @@ -539,3 +546,19 @@ class _WorldPacksView extends StatelessWidget { ); } } + +class _EditorPacksView extends StatelessWidget { + const _EditorPacksView({super.key}); + + @override + Widget build(BuildContext context) { + return ListView.builder( + itemCount: 5, + itemBuilder: (context, index) { + return ListTile( + title: Text('Pack $index'), + onTap: () => GoRouter.of(context).go('/editor/$index')); + }, + ); + } +} diff --git a/app/pubspec.lock b/app/pubspec.lock index 52b806b..d11913b 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -323,10 +323,10 @@ packages: dependency: transitive description: name: file_selector_linux - sha256: b2b91daf8a68ecfa4a01b778a6f52edef9b14ecd506e771488ea0f2e0784198b + sha256: "54cbbd957e1156d29548c7d9b9ec0c0ebb6de0a90452198683a7d23aed617a33" url: "https://pub.dev" source: hosted - version: "0.9.3+1" + version: "0.9.3+2" file_selector_macos: dependency: transitive description: @@ -837,10 +837,10 @@ packages: dependency: transitive description: name: path_provider_android - sha256: c464428172cb986b758c6d1724c603097febb8fb855aa265aeecc9280c294d4a + sha256: "8c4967f8b7cb46dc914e178daa29813d83ae502e0529d7b0478330616a691ef7" url: "https://pub.dev" source: hosted - version: "2.2.12" + version: "2.2.14" path_provider_foundation: dependency: transitive description: @@ -1321,10 +1321,10 @@ packages: dependency: transitive description: name: vector_graphics_compiler - sha256: ab9ff38fc771e9ee1139320adbe3d18a60327370c218c60752068ebee4b49ab1 + sha256: "1b4b9e706a10294258727674a340ae0d6e64a7231980f9f9a3d12e4b42407aad" url: "https://pub.dev" source: hosted - version: "1.1.15" + version: "1.1.16" vector_math: dependency: transitive description: