Skip to content

Commit

Permalink
Rework packs dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Dec 23, 2024
1 parent aba457e commit f5361ce
Show file tree
Hide file tree
Showing 14 changed files with 713 additions and 572 deletions.
15 changes: 14 additions & 1 deletion app/lib/bloc/editor.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:setonix/services/file_system.dart';
import 'package:setonix_api/setonix_api.dart';

class EditorCubit extends Cubit<SetonixData> {
final String path;
final SetonixFileSystem fileSystem;

EditorCubit(this.path, super.initialState);
EditorCubit(this.path, this.fileSystem, super.initialState);

void updateMeta(FileMetadata meta) => emit(state.setFileMetadata(meta));

@override
void onChange(Change<SetonixData> change) {
super.onChange(change);

save();
}

Future<void> save() {
return fileSystem.editorSystem.updateFile(path, state);
}
}
10 changes: 9 additions & 1 deletion app/lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,13 @@
"backgrounds": "Backgorunds",
"translations": "Translations",
"editor": "Editor",
"noData": "No data available"
"noData": "No data available",
"removePackMessage": "Are you sure you want to remove the pack {name}?",
"@removePackMessage": {
"placeholders": {
"name": {
"type": "String"
}
}
}
}
1 change: 1 addition & 0 deletions app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ class SetonixApp extends StatelessWidget {
),
routes: [
GoRoute(
name: 'editor',
path: kEditorPath,
builder: (context, state) => const GeneralEditorPage(),
),
Expand Down
3 changes: 2 additions & 1 deletion app/lib/pages/editor/shell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ class _EditorShellState extends State<EditorShell> {
orElse: () => EditorPage.general,
);
return BlocProvider(
create: (context) => EditorCubit(widget.name, data),
create: (context) =>
EditorCubit(widget.name, context.read<SetonixFileSystem>(), data),
child: Row(
children: [
if (!isMobile) EditorNavigatorView(currentPage: currentPage),
Expand Down
2 changes: 1 addition & 1 deletion app/lib/pages/game/drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import 'package:setonix/helpers/visualizer.dart';
import 'package:setonix/pages/game/info.dart';
import 'package:setonix/pages/game/multiplayer.dart';
import 'package:setonix/pages/game/team.dart';
import 'package:setonix/pages/home/packs.dart';
import 'package:setonix/pages/packs/dialog.dart';
import 'package:setonix_api/setonix_api.dart';

class GameDrawer extends StatelessWidget {
Expand Down
Loading

0 comments on commit f5361ce

Please sign in to comment.