Teamspiele implementieren #217

Open
flixcoo wants to merge 55 commits from feature/168-teamspiele-implementieren into development
Showing only changes of commit 32a8a6090a - Show all commits

View File

@@ -1,10 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:fluttericon/font_awesome_icons.dart';
import 'package:tallee/core/common.dart'; import 'package:tallee/core/common.dart';
import 'package:tallee/core/constants.dart'; import 'package:tallee/core/constants.dart';
import 'package:tallee/core/custom_theme.dart'; import 'package:tallee/core/custom_theme.dart';
import 'package:tallee/core/enums.dart'; import 'package:tallee/core/enums.dart';
import 'package:tallee/l10n/generated/app_localizations.dart'; import 'package:tallee/l10n/generated/app_localizations.dart';
import 'package:tallee/presentation/widgets/buttons/animated_dialog_button.dart'; import 'package:tallee/presentation/widgets/buttons/haptic_icon_button.dart';
import 'package:tallee/presentation/widgets/text_input/text_input_field.dart'; import 'package:tallee/presentation/widgets/text_input/text_input_field.dart';
class TeamCreationTile extends StatefulWidget { class TeamCreationTile extends StatefulWidget {
@@ -36,75 +37,107 @@ class _TeamCreationTileState extends State<TeamCreationTile> {
GameColor.values.length, GameColor.values.length,
(index) => getTeamColor(index), (index) => getTeamColor(index),
); );
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final loc = AppLocalizations.of(context); final loc = AppLocalizations.of(context);
return Container( return Container(
margin: CustomTheme.standardMargin, margin: CustomTheme.standardMargin,
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
decoration: CustomTheme.standardBoxDecoration, decoration: CustomTheme.standardBoxDecoration,
child: Column( clipBehavior: Clip.antiAlias,
crossAxisAlignment: CrossAxisAlignment.start, child: IntrinsicHeight(
children: [ child: Row(
Row( crossAxisAlignment: CrossAxisAlignment.stretch,
crossAxisAlignment: CrossAxisAlignment.center, children: [
children: [ Expanded(
Expanded( child: Padding(
child: TextInputField( padding: const EdgeInsets.symmetric(
controller: widget.controller, vertical: 12,
hintText: widget.hintText, horizontal: 6,
maxLength: Constants.MAX_TEAM_NAME_LENGTH,
), ),
), child: Column(
const SizedBox(width: 12), crossAxisAlignment: CrossAxisAlignment.start,
AnimatedDialogButton( children: [
content: const Icon(Icons.delete), // Name input + delete icon
isDescructive: true, Row(
onPressed: widget.onDelete, crossAxisAlignment: CrossAxisAlignment.center,
buttonText: '', mainAxisAlignment: MainAxisAlignment.center,
), children: [
], Expanded(
), child: TextInputField(
const SizedBox(height: 8), controller: widget.controller,
Text( hintText: widget.hintText,
loc.color, maxLength: Constants.MAX_TEAM_NAME_LENGTH,
style: const TextStyle( ),
fontSize: 15, ),
fontWeight: FontWeight.bold, HapticIconButton(
color: CustomTheme.textColor, icon: const Icon(FontAwesome.trash),
), color: CustomTheme.textColor,
), iconSize: 25,
const SizedBox(height: 8), onPressed: widget.onDelete,
Wrap( ),
spacing: 8, ],
runSpacing: 8,
children: teamColors.map((color) {
final isSelected = widget.color == color;
return GestureDetector(
onTap: () {
widget.onColorSelection?.call(color);
},
child: Container(
width: 34,
height: 34,
decoration: BoxDecoration(
color: getColorFromGameColor(color),
shape: BoxShape.circle,
border: Border.all(
color: isSelected ? Colors.white : Colors.transparent,
width: 3,
), ),
), const SizedBox(height: 12),
child: isSelected
? const Icon(Icons.check, size: 18, color: Colors.white) // Color label
: null, Padding(
padding: const EdgeInsets.only(left: 8),
child: Text(
loc.color,
style: const TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
color: CustomTheme.textColor,
),
),
),
const SizedBox(height: 8),
// Color picker
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Wrap(
spacing: 8,
runSpacing: 8,
children: teamColors.map((color) {
final isSelected = widget.color == color;
return GestureDetector(
onTap: () {
widget.onColorSelection?.call(color);
},
child: Container(
width: 34,
height: 34,
decoration: BoxDecoration(
color: getColorFromGameColor(color),
shape: BoxShape.circle,
border: Border.all(
color: isSelected
? Colors.white
: Colors.transparent,
width: 3,
),
),
child: isSelected
? const Icon(
Icons.check,
size: 18,
color: Colors.white,
)
: null,
),
);
}).toList(),
),
),
],
), ),
); ),
}).toList(), ),
), ],
const SizedBox(height: 12), ),
],
), ),
); );
} }