Skip to content

Commit

Permalink
Restructure project
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed May 25, 2024
1 parent 5398283 commit f2f40b5
Show file tree
Hide file tree
Showing 27 changed files with 581 additions and 368 deletions.
22 changes: 15 additions & 7 deletions app/lib/api/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,18 @@ import 'package:flutter/material.dart';

import '../pages/settings/page.dart';

Future<void> openSettings(BuildContext context) => showDialog<void>(
context: context,
builder: (context) => Dialog(
clipBehavior: Clip.antiAlias,
child: ConstrainedBox(
constraints: const BoxConstraints(maxHeight: 600, maxWidth: 800),
child: const SettingsPage(isDialog: true))));
Future<void> openSettings(
BuildContext context, {
SettingsView view = SettingsView.general,
}) =>
showDialog<void>(
context: context,
builder: (context) => Dialog(
clipBehavior: Clip.antiAlias,
child: ConstrainedBox(
constraints:
const BoxConstraints(maxHeight: 600, maxWidth: 800),
child: SettingsPage(
isDialog: true,
view: view,
))));
8 changes: 5 additions & 3 deletions app/lib/cubits/settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ import 'package:dart_mappable/dart_mappable.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:quokka/widgets/window.dart';
import 'package:material_leap/material_leap.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:window_manager/window_manager.dart';

part 'settings.mapper.dart';

@MappableClass()
class QuokkaSettings with QuokkaSettingsMappable {
class QuokkaSettings with QuokkaSettingsMappable implements LeapSettings {
final String localeTag;
final ThemeMode theme;
final String design;
@override
final bool nativeTitleBar;

const QuokkaSettings({
Expand Down Expand Up @@ -48,7 +49,8 @@ class QuokkaSettings with QuokkaSettingsMappable {
}
}

class SettingsCubit extends Cubit<QuokkaSettings> {
class SettingsCubit extends Cubit<QuokkaSettings>
with LeapSettingsStreamableMixin<QuokkaSettings> {
SettingsCubit(SharedPreferences prefs)
: super(QuokkaSettings.fromPrefs(prefs));

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import 'dart:convert';
import 'package:archive/archive.dart';
import 'package:flutter/services.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:quokka/models/deck.dart';
import 'package:quokka/models/meta.dart';
import 'package:quokka/models/object.dart';
import 'package:quokka/models/definitions/deck.dart';
import 'package:quokka/models/definitions/meta.dart';
import 'package:quokka/models/definitions/object.dart';

const kPackMetadataPath = 'pack.json';
const kPackDecksPath = 'decks';
Expand Down
36 changes: 35 additions & 1 deletion app/lib/models/table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,52 @@ class GridLocation with GridLocationMappable {
class GameTable with GameTableMappable {
final Map<GridLocation, TableCell> cells;
final Map<GridLocation, GameBoard> boards;
final Map<String, GameSeat> seats;
final Map<String, GamePlayer> players;

GameTable({
this.cells = const {},
this.boards = const {},
this.seats = const {},
this.players = const {},
});
}

@MappableClass()
class GamePlayer with GamePlayerMappable {
final String name;
final List<String>? teams;

GamePlayer({
required this.name,
this.teams = const [],
});
}

@MappableClass()
class GameSeat with GameSeatMappable {
final int? color;

GameSeat({
this.color,
});
}

@MappableClass()
class TableCell with TableCellMappable {
final List<GameObject> objects;
final String? team;
final int reveal;
final int? teamReveal;

TableCell({
this.objects = const [],
this.team,
this.reveal = -1,
this.teamReveal,
});

TableCell(this.objects);
int get teamRevealValue => teamReveal ?? reveal;
}

@MappableClass()
Expand Down
Loading

0 comments on commit f2f40b5

Please sign in to comment.