Implementierung der Games #203

Merged
flixcoo merged 34 commits from feature/119-implementierung-der-games-2 into development 2026-05-09 17:13:46 +00:00
2 changed files with 186 additions and 218 deletions
Showing only changes of commit ae572a5dbd - Show all commits

View File

@@ -119,10 +119,10 @@ class AppLocalizationsDe extends AppLocalizations {
String _temp0 = intl.Intl.pluralLogic( String _temp0 = intl.Intl.pluralLogic(
count, count,
locale: localeName, locale: localeName,
other: '$count Spiele', other: 'werden $count Spiele',
one: '1 Spiel', one: 'wird 1 Spiel',
); );
return 'Wenn du diese Spielvorlage löschst, werden $_temp0 mit dieser Spielvorlage ebenfalls gelöscht.'; return 'Wenn du diese Spielvorlage löschst, $_temp0 mit dieser Spielvorlage ebenfalls gelöscht.';
} }
@override @override

View File

@@ -214,223 +214,10 @@ class _CreateGameViewState extends State<CreateGameView> {
// Choose ruleset tile // Choose ruleset tile
if (!isEditMode()) if (!isEditMode())
ChooseTile( ChooseTile(title: loc.ruleset, trailing: getColorDropdown(loc)),

meinste nicht, dass man die tiles hier nicht lieber alle auslagern sollte? die sind arg lang

meinste nicht, dass man die tiles hier nicht lieber alle auslagern sollte? die sind arg lang

Ja das ding ist die werden halt nur einmal verwendet

Ja das ding ist die werden halt nur einmal verwendet

ja oder wenigstens ausgelagert in der datei?

ja oder wenigstens ausgelagert in der datei?

ich kanns sonst als funktion unten drunter packen?

ich kanns sonst als funktion unten drunter packen?

Ja genau

Ja genau
title: loc.ruleset,
trailing: CustomPopup(
showArrow: true,
arrowColor: CustomTheme.boxBorderColor,
contentPadding: const EdgeInsets.symmetric(
horizontal: 0,
vertical: 10,
),
barrierColor: Colors.transparent,
contentDecoration: CustomTheme.standardBoxDecoration,
content: StatefulBuilder(
builder: (context, setPopupState) => SizedBox(
width: 280,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: List.generate(
_rulesets.length,
(index) => GestureDetector(
onTap: () {
setState(() {
selectedRuleset = _rulesets[index].$1;
});
setPopupState(() {});
},
child: Column(
children: [
Container(
margin: const EdgeInsets.symmetric(
horizontal: 12,
),
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(
Radius.circular(8),
),
color:
selectedRuleset == _rulesets[index].$1
? CustomTheme.textColor.withAlpha(20)
: Colors.transparent,
),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 8,
horizontal: 16,
),
child: Row(
spacing: 8,
children: [
Icon(
getRulesetIcon(_rulesets[index].$1),
size: 16,
),
Text(
_rulesets[index].$2,
style: const TextStyle(
color: CustomTheme.textColor,
fontSize: 15,
),
),
],
),
),
),
if (index < _rulesets.length - 1)
const Divider(indent: 15, endIndent: 15),
],
),
),
),
),
),
),
child: Row(
spacing: 8,
children: [
Icon(getRulesetIcon(selectedRuleset!), size: 16),
Padding(
padding: const EdgeInsets.only(right: 5),
child: Text(
translateRulesetToString(selectedRuleset!, context),
textAlign: TextAlign.right,
),
),
Transform.rotate(
angle: pi / 2,
child: const Icon(Icons.arrow_forward_ios, size: 16),
),
],
),
),
),
// Choose color tile // Choose color tile
ChooseTile( ChooseTile(title: loc.color, trailing: getRulesetDropdown(loc)),
title: loc.color,
trailing:
//Popup
CustomPopup(
showArrow: true,
arrowColor: CustomTheme.boxBorderColor,
contentPadding: const EdgeInsets.symmetric(
horizontal: 0,
vertical: 10,
),
barrierColor: Colors.transparent,
contentDecoration: CustomTheme.standardBoxDecoration,
content: StatefulBuilder(
builder: (context, setPopupState) => SizedBox(
width: 150,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: List.generate(
_colors.length,
(index) => GestureDetector(
onTap: () {
setState(() {
selectedColor = _colors[index].$1;
});
setPopupState(() {});
},
child: Column(
children: [
// Selected Highlighting
Container(
margin: const EdgeInsets.symmetric(
horizontal: 12,
),
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(
Radius.circular(8),
),
color:
selectedColor == _colors[index].$1
? CustomTheme.textColor.withAlpha(
20,
)
: Colors.transparent,
),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 6,
),
child: Row(
spacing: 8,
children: selectedColor == null
? [Text(loc.none)]
: [
Container(
width: 16,
height: 16,
margin:
const EdgeInsets.only(
left: 12,
),
decoration: BoxDecoration(
color:
getColorFromGameColor(
_colors[index].$1,
),
shape: BoxShape.circle,
),
),
Text(
_colors[index].$2,
style: const TextStyle(
color:
CustomTheme.textColor,
fontSize: 15,
),
),
],
),
),
),
if (index < _colors.length - 1)
const Divider(indent: 15, endIndent: 15),
],
),
),
),
),
),
),
child: Row(
spacing: 8,
children: [
// Selected Color
Container(
width: 16,
height: 16,
decoration: BoxDecoration(
color: getColorFromGameColor(selectedColor!),
shape: BoxShape.circle,
),
),
Padding(
padding: const EdgeInsets.only(right: 5),
child: Text(
translateGameColorToString(
selectedColor!,
context,
),
),
),
Transform.rotate(
angle: pi / 2,
child: const Icon(
Icons.arrow_forward_ios,
size: 16,
),
),
],
),
),
),
// Description input field // Description input field
Container( Container(
@@ -549,4 +336,185 @@ class _CreateGameViewState extends State<CreateGameView> {
bool isEditMode() { bool isEditMode() {
return widget.gameToEdit != null; return widget.gameToEdit != null;
} }
Widget getRulesetDropdown(AppLocalizations loc) {
return CustomPopup(
showArrow: true,
arrowColor: CustomTheme.boxBorderColor,
contentPadding: const EdgeInsets.symmetric(horizontal: 0, vertical: 10),
barrierColor: Colors.transparent,
contentDecoration: CustomTheme.standardBoxDecoration,
content: StatefulBuilder(
builder: (context, setPopupState) => SizedBox(
width: 280,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: List.generate(
_rulesets.length,
(index) => GestureDetector(
onTap: () {
setState(() {
selectedRuleset = _rulesets[index].$1;
});
setPopupState(() {});
},
child: Column(
children: [
Container(
margin: const EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(
Radius.circular(8),
),
color: selectedRuleset == _rulesets[index].$1
? CustomTheme.textColor.withAlpha(20)
: Colors.transparent,
),
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 8,
horizontal: 16,
),
child: Row(
spacing: 8,
children: [
Icon(getRulesetIcon(_rulesets[index].$1), size: 16),
Text(
_rulesets[index].$2,
style: const TextStyle(
color: CustomTheme.textColor,
fontSize: 15,
),
),
],
),
),
),
if (index < _rulesets.length - 1)
const Divider(indent: 15, endIndent: 15),
],
),
),
),
),
),
),
child: Row(
spacing: 8,
children: [
Icon(getRulesetIcon(selectedRuleset!), size: 16),
Padding(
padding: const EdgeInsets.only(right: 5),
child: Text(
translateRulesetToString(selectedRuleset!, context),
textAlign: TextAlign.right,
),
),
Transform.rotate(
angle: pi / 2,
child: const Icon(Icons.arrow_forward_ios, size: 16),
),
],
),
);
}
Widget getColorDropdown(AppLocalizations loc) {
return CustomPopup(
showArrow: true,
arrowColor: CustomTheme.boxBorderColor,
contentPadding: const EdgeInsets.symmetric(horizontal: 0, vertical: 10),
barrierColor: Colors.transparent,
contentDecoration: CustomTheme.standardBoxDecoration,
content: StatefulBuilder(
builder: (context, setPopupState) => SizedBox(
width: 150,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: List.generate(
_colors.length,
(index) => GestureDetector(
onTap: () {
setState(() {
selectedColor = _colors[index].$1;
});
setPopupState(() {});
},
child: Column(
children: [
// Selected Highlighting
Container(
margin: const EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(
Radius.circular(8),
),
color: selectedColor == _colors[index].$1
? CustomTheme.textColor.withAlpha(20)
: Colors.transparent,
),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 6),
child: Row(
spacing: 8,
children: selectedColor == null
? [Text(loc.none)]
: [
Container(
width: 16,
height: 16,
margin: const EdgeInsets.only(left: 12),
decoration: BoxDecoration(
color: getColorFromGameColor(
_colors[index].$1,
),
shape: BoxShape.circle,
),
),
Text(
_colors[index].$2,
style: const TextStyle(
color: CustomTheme.textColor,
fontSize: 15,
),
),
],
),
),
),
if (index < _colors.length - 1)
const Divider(indent: 15, endIndent: 15),
],
),
),
),
),
),
),
child: Row(
spacing: 8,
children: [
// Selected Color
Container(
width: 16,
height: 16,
decoration: BoxDecoration(
color: getColorFromGameColor(selectedColor!),
shape: BoxShape.circle,
),
),
Padding(
padding: const EdgeInsets.only(right: 5),
child: Text(translateGameColorToString(selectedColor!, context)),
),
Transform.rotate(
angle: pi / 2,
child: const Icon(Icons.arrow_forward_ios, size: 16),
),
],
),
);
}
} }