Updated match result view
This commit is contained in:
@@ -11,7 +11,7 @@ import 'package:tallee/data/models/player.dart';
|
|||||||
import 'package:tallee/data/models/score_entry.dart';
|
import 'package:tallee/data/models/score_entry.dart';
|
||||||
import 'package:tallee/data/models/team.dart';
|
import 'package:tallee/data/models/team.dart';
|
||||||
import 'package:tallee/l10n/generated/app_localizations.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/buttons/haptic_icon_button.dart';
|
import 'package:tallee/presentation/widgets/buttons/haptic_icon_button.dart';
|
||||||
import 'package:tallee/presentation/widgets/tiles/match_result_view/custom_checkbox_list_tile.dart';
|
import 'package:tallee/presentation/widgets/tiles/match_result_view/custom_checkbox_list_tile.dart';
|
||||||
import 'package:tallee/presentation/widgets/tiles/match_result_view/custom_radio_list_tile.dart';
|
import 'package:tallee/presentation/widgets/tiles/match_result_view/custom_radio_list_tile.dart';
|
||||||
@@ -90,17 +90,20 @@ class _MatchResultViewState extends State<MatchResultView> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
automaticallyImplyLeading: true,
|
||||||
leading: HapticIconButton(
|
leading: HapticIconButton(
|
||||||
icon: const Icon(Icons.close),
|
icon: isLiveEditMode
|
||||||
onPressed: () {
|
? const Icon(Icons.arrow_back_ios)
|
||||||
widget.onWinnerChanged?.call();
|
: const Icon(Icons.close),
|
||||||
Navigator.pop(context);
|
onPressed: isLiveEditMode
|
||||||
},
|
? () => setState(() {
|
||||||
|
isLiveEditMode = false;
|
||||||
|
})
|
||||||
|
: () => {widget.onWinnerChanged?.call(), Navigator.pop(context)},
|
||||||
),
|
),
|
||||||
title: Text(widget.match.name),
|
title: Text(widget.match.name),
|
||||||
),
|
),
|
||||||
body: SafeArea(
|
body: Column(
|
||||||
child: Column(
|
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: isLiveEditMode
|
child: isLiveEditMode
|
||||||
@@ -137,7 +140,6 @@ class _MatchResultViewState extends State<MatchResultView> {
|
|||||||
// Show player selection
|
// Show player selection
|
||||||
if (rulesetSupportsPlayerSelection())
|
if (rulesetSupportsPlayerSelection())
|
||||||
if (ruleset == Ruleset.multipleWinners)
|
if (ruleset == Ruleset.multipleWinners)
|
||||||
// TODO: Implement view for teams
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: buildMultipleWinnerSelectionWidget(
|
child: buildMultipleWinnerSelectionWidget(
|
||||||
isTeamMatch,
|
isTeamMatch,
|
||||||
@@ -160,24 +162,34 @@ class _MatchResultViewState extends State<MatchResultView> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
if (rulesetSupportsScoreEntry())
|
if (!isLiveEditMode) ...[
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(12, 0, 12, 20),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
if (rulesetSupportsScoreEntry()) ...[
|
||||||
// Button to switch to live edit mode
|
// Button to switch to live edit mode
|
||||||
...[
|
AnimatedDialogButton(
|
||||||
CustomWidthButton(
|
buttonConstraints: const BoxConstraints(
|
||||||
text: isLiveEditMode ? loc.exit_view : loc.live_edit_mode,
|
minWidth: double.infinity,
|
||||||
sizeRelativeToWidth: 0.95,
|
minHeight: 50,
|
||||||
|
),
|
||||||
|
buttonText: loc.live_edit_mode,
|
||||||
buttonType: ButtonType.secondary,
|
buttonType: ButtonType.secondary,
|
||||||
onPressed: () => setState(() {
|
onPressed: () => setState(() {
|
||||||
isLiveEditMode = !isLiveEditMode;
|
isLiveEditMode = !isLiveEditMode;
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 10),
|
|
||||||
],
|
],
|
||||||
|
|
||||||
// Save Changes Button
|
// Save Changes Button
|
||||||
CustomWidthButton(
|
AnimatedDialogButton(
|
||||||
text: loc.save_changes,
|
buttonConstraints: const BoxConstraints(
|
||||||
sizeRelativeToWidth: 0.95,
|
minWidth: double.infinity,
|
||||||
|
minHeight: 50,
|
||||||
|
),
|
||||||
|
buttonText: loc.save_changes,
|
||||||
onPressed: canSave
|
onPressed: canSave
|
||||||
? () async {
|
? () async {
|
||||||
final ending = DateTime.now();
|
final ending = DateTime.now();
|
||||||
@@ -194,6 +206,9 @@ class _MatchResultViewState extends State<MatchResultView> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user