Reworked team creation tile

This commit is contained in:
2026-05-21 18:16:40 +02:00
parent f3f7d44994
commit 32a8a6090a

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,19 +37,32 @@ 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,
clipBehavior: Clip.antiAlias,
child: IntrinsicHeight(
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 12,
horizontal: 6,
),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
// Name input + delete icon
Row( Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Expanded( Expanded(
child: TextInputField( child: TextInputField(
@@ -57,17 +71,20 @@ class _TeamCreationTileState extends State<TeamCreationTile> {
maxLength: Constants.MAX_TEAM_NAME_LENGTH, maxLength: Constants.MAX_TEAM_NAME_LENGTH,
), ),
), ),
const SizedBox(width: 12), HapticIconButton(
AnimatedDialogButton( icon: const Icon(FontAwesome.trash),
content: const Icon(Icons.delete), color: CustomTheme.textColor,
isDescructive: true, iconSize: 25,
onPressed: widget.onDelete, onPressed: widget.onDelete,
buttonText: '',
), ),
], ],
), ),
const SizedBox(height: 8), const SizedBox(height: 12),
Text(
// Color label
Padding(
padding: const EdgeInsets.only(left: 8),
child: Text(
loc.color, loc.color,
style: const TextStyle( style: const TextStyle(
fontSize: 15, fontSize: 15,
@@ -75,8 +92,13 @@ class _TeamCreationTileState extends State<TeamCreationTile> {
color: CustomTheme.textColor, color: CustomTheme.textColor,
), ),
), ),
),
const SizedBox(height: 8), const SizedBox(height: 8),
Wrap(
// Color picker
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Wrap(
spacing: 8, spacing: 8,
runSpacing: 8, runSpacing: 8,
children: teamColors.map((color) { children: teamColors.map((color) {
@@ -92,20 +114,31 @@ class _TeamCreationTileState extends State<TeamCreationTile> {
color: getColorFromGameColor(color), color: getColorFromGameColor(color),
shape: BoxShape.circle, shape: BoxShape.circle,
border: Border.all( border: Border.all(
color: isSelected ? Colors.white : Colors.transparent, color: isSelected
? Colors.white
: Colors.transparent,
width: 3, width: 3,
), ),
), ),
child: isSelected child: isSelected
? const Icon(Icons.check, size: 18, color: Colors.white) ? const Icon(
Icons.check,
size: 18,
color: Colors.white,
)
: null, : null,
), ),
); );
}).toList(), }).toList(),
), ),
const SizedBox(height: 12), ),
], ],
), ),
),
),
],
),
),
); );
} }
} }