Updated stacks & buttons
This commit is contained in:
@@ -8,7 +8,7 @@ import 'package:tallee/data/db/database.dart';
|
||||
import 'package:tallee/data/models/group.dart';
|
||||
import 'package:tallee/data/models/player.dart';
|
||||
import 'package:tallee/l10n/generated/app_localizations.dart';
|
||||
import 'package:tallee/presentation/widgets/buttons/custom_width_button.dart';
|
||||
import 'package:tallee/presentation/widgets/buttons/animated_dialog_button.dart';
|
||||
import 'package:tallee/presentation/widgets/player_selection.dart';
|
||||
import 'package:tallee/presentation/widgets/text_input/text_input_field.dart';
|
||||
|
||||
@@ -96,19 +96,24 @@ class _CreateGroupViewState extends State<CreateGroupView> {
|
||||
},
|
||||
),
|
||||
),
|
||||
CustomWidthButton(
|
||||
text: widget.groupToEdit == null
|
||||
? loc.create_group
|
||||
: loc.edit_group,
|
||||
sizeRelativeToWidth: 0.95,
|
||||
buttonType: ButtonType.primary,
|
||||
onPressed:
|
||||
(_groupNameController.text.isEmpty ||
|
||||
(selectedPlayers.length < 2))
|
||||
? null
|
||||
: _saveGroup,
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: AnimatedDialogButton(
|
||||
buttonConstraints: const BoxConstraints(
|
||||
minWidth: double.infinity,
|
||||
minHeight: 50,
|
||||
),
|
||||
buttonText: widget.groupToEdit == null
|
||||
? loc.create_group
|
||||
: loc.edit_group,
|
||||
buttonType: ButtonType.primary,
|
||||
onPressed:
|
||||
(_groupNameController.text.isEmpty ||
|
||||
(selectedPlayers.length < 2))
|
||||
? null
|
||||
: _saveGroup,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
@@ -14,7 +14,7 @@ import 'package:tallee/presentation/views/main_menu/match_view/create_match/choo
|
||||
import 'package:tallee/presentation/views/main_menu/match_view/create_match/choose_group_view.dart';
|
||||
import 'package:tallee/presentation/views/main_menu/match_view/create_match/create_teams/create_teams_view.dart';
|
||||
import 'package:tallee/presentation/views/main_menu/match_view/match_result_view.dart';
|
||||
import 'package:tallee/presentation/widgets/buttons/custom_width_button.dart';
|
||||
import 'package:tallee/presentation/widgets/buttons/animated_dialog_button.dart';
|
||||
import 'package:tallee/presentation/widgets/player_selection.dart';
|
||||
import 'package:tallee/presentation/widgets/text_input/text_input_field.dart';
|
||||
import 'package:tallee/presentation/widgets/tiles/choose_tile.dart';
|
||||
@@ -175,15 +175,21 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
||||
),
|
||||
|
||||
// Create or save button.
|
||||
CustomWidthButton(
|
||||
text: buttonText,
|
||||
sizeRelativeToWidth: 0.95,
|
||||
buttonType: ButtonType.primary,
|
||||
onPressed: isSubmitButtonEnabled()
|
||||
? () {
|
||||
submitButtonNavigation(context);
|
||||
}
|
||||
: null,
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: AnimatedDialogButton(
|
||||
buttonConstraints: const BoxConstraints(
|
||||
minWidth: double.infinity,
|
||||
minHeight: 50,
|
||||
),
|
||||
buttonType: ButtonType.primary,
|
||||
onPressed: isSubmitButtonEnabled()
|
||||
? () {
|
||||
submitButtonNavigation(context);
|
||||
}
|
||||
: null,
|
||||
buttonText: buttonText,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -56,33 +56,33 @@ class _CreateTeamsViewState extends State<CreateTeamsView> {
|
||||
return Scaffold(
|
||||
backgroundColor: CustomTheme.backgroundColor,
|
||||
appBar: AppBar(title: Text(loc.create_teams)),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.only(top: 12, bottom: 12),
|
||||
itemCount: teams.length,
|
||||
itemBuilder: (context, index) {
|
||||
return TeamCreationTile(
|
||||
color: teams[index].color,
|
||||
controller: nameController[index],
|
||||
hintText: '${loc.team} ${index + 1}',
|
||||
onDelete: teams.length <= 2
|
||||
? null
|
||||
: () => removeTeam(index),
|
||||
onColorSelection: (color) {
|
||||
setState(() {
|
||||
teams[index] = teams[index].copyWith(color: color);
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
body: Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
padding: const EdgeInsets.only(top: 12, bottom: 12),
|
||||
itemCount: teams.length,
|
||||
itemBuilder: (context, index) {
|
||||
return TeamCreationTile(
|
||||
color: teams[index].color,
|
||||
controller: nameController[index],
|
||||
hintText: '${loc.team} ${index + 1}',
|
||||
onDelete: teams.length <= 2 ? null : () => removeTeam(index),
|
||||
onColorSelection: (color) {
|
||||
setState(() {
|
||||
teams[index] = teams[index].copyWith(color: color);
|
||||
});
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
// Button row
|
||||
Row(
|
||||
// Button row
|
||||
Positioned(
|
||||
bottom: MediaQuery.paddingOf(context).bottom + 20,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Add new team
|
||||
@@ -95,7 +95,7 @@ class _CreateTeamsViewState extends State<CreateTeamsView> {
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
|
||||
// Confirm teams and continue with member assignment
|
||||
// Confirm teams
|
||||
MainMenuButton(
|
||||
icon: Icons.arrow_forward_sharp,
|
||||
onPressed: teams.length >= 2
|
||||
@@ -115,8 +115,8 @@ class _CreateTeamsViewState extends State<CreateTeamsView> {
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -52,67 +52,62 @@ class _ManageMembersViewState extends State<ManageMembersView> {
|
||||
return Scaffold(
|
||||
backgroundColor: CustomTheme.backgroundColor,
|
||||
appBar: AppBar(title: Text(loc.manage_members)),
|
||||
body: SafeArea(
|
||||
child: Stack(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ReorderableListView.builder(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
buildDefaultDragHandles: false,
|
||||
itemCount: allItemsCount,
|
||||
onReorder: onReorder,
|
||||
proxyDecorator: (child, index, animation) =>
|
||||
Material(type: MaterialType.transparency, child: child),
|
||||
itemBuilder: (context, index) {
|
||||
final teamIndex = teamIndexForFlat(index);
|
||||
final memberIndex = memberIndexForFlat(index, teamIndex);
|
||||
final team = teams[teamIndex];
|
||||
body: Stack(
|
||||
alignment: AlignmentDirectional.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: ReorderableListView.builder(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
buildDefaultDragHandles: false,
|
||||
itemCount: allItemsCount,
|
||||
onReorder: onReorder,
|
||||
proxyDecorator: (child, index, animation) =>
|
||||
Material(type: MaterialType.transparency, child: child),
|
||||
itemBuilder: (context, index) {
|
||||
final teamIndex = teamIndexForFlat(index);
|
||||
final memberIndex = memberIndexForFlat(index, teamIndex);
|
||||
final team = teams[teamIndex];
|
||||
|
||||
if (memberIndex == -1) {
|
||||
return buildTeamTile(team: team);
|
||||
}
|
||||
if (memberIndex == -1) {
|
||||
return buildTeamTile(team: team);
|
||||
}
|
||||
|
||||
final player = team.members[memberIndex];
|
||||
return ReorderableDelayedDragStartListener(
|
||||
key: ValueKey('player_${player.id}'),
|
||||
index: index,
|
||||
child: TextIconListTile(
|
||||
text: player.name,
|
||||
suffixText: getNameCountText(player),
|
||||
icon: Icons.drag_handle,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
final player = team.members[memberIndex];
|
||||
return ReorderableDelayedDragStartListener(
|
||||
key: ValueKey('player_${player.id}'),
|
||||
index: index,
|
||||
child: TextIconListTile(
|
||||
text: player.name,
|
||||
suffixText: getNameCountText(player),
|
||||
icon: Icons.drag_handle,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
Positioned(
|
||||
bottom: MediaQuery.of(context).padding.bottom,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Center(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
MainMenuButton(
|
||||
onPressed: () => setState(() {
|
||||
redistributePlayers();
|
||||
}),
|
||||
icon: Icons.cached,
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
MainMenuButton(
|
||||
onPressed: allTeamsHaveMembers
|
||||
? () async => submitMatch()
|
||||
: null,
|
||||
text: loc.create_match,
|
||||
icon: RpgAwesome.clovers_card,
|
||||
),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
bottom: MediaQuery.of(context).padding.bottom + 20,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
MainMenuButton(
|
||||
onPressed: () => setState(() {
|
||||
redistributePlayers();
|
||||
}),
|
||||
icon: Icons.cached,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
MainMenuButton(
|
||||
onPressed: allTeamsHaveMembers
|
||||
? () async => submitMatch()
|
||||
: null,
|
||||
text: loc.create_match,
|
||||
icon: RpgAwesome.clovers_card,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user