Added button to leave live edit mode
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 46s
Pull Request Pipeline / lint (pull_request) Successful in 48s

This commit is contained in:
2026-05-04 15:29:28 +02:00
parent e25a2bde69
commit 3be7dac227

View File

@@ -8,6 +8,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/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/custom_width_button.dart';
import 'package:tallee/presentation/widgets/buttons/main_menu_button.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';
import 'package:tallee/presentation/widgets/tiles/match_result_view/live_edit_list_tile.dart'; import 'package:tallee/presentation/widgets/tiles/match_result_view/live_edit_list_tile.dart';
import 'package:tallee/presentation/widgets/tiles/match_result_view/score_list_tile.dart'; import 'package:tallee/presentation/widgets/tiles/match_result_view/score_list_tile.dart';
@@ -91,22 +92,15 @@ class _MatchResultViewState extends State<MatchResultView> {
return Scaffold( return Scaffold(
backgroundColor: CustomTheme.backgroundColor, backgroundColor: CustomTheme.backgroundColor,
appBar: AppBar( appBar: AppBar(
leading: isLiveEditMode leading: !isLiveEditMode
? IconButton( ? IconButton(
icon: const Icon(Icons.arrow_back_ios),
onPressed: () {
setState(() {
isLiveEditMode = false;
});
},
)
: IconButton(
icon: const Icon(Icons.close), icon: const Icon(Icons.close),
onPressed: () { onPressed: () {
widget.onWinnerChanged?.call(); widget.onWinnerChanged?.call();
Navigator.of(context).pop(_selectedPlayer); Navigator.of(context).pop(_selectedPlayer);
}, },
), )
: null,
title: Text(widget.match.name), title: Text(widget.match.name),
), ),
body: SafeArea( body: SafeArea(
@@ -115,17 +109,34 @@ class _MatchResultViewState extends State<MatchResultView> {
Expanded( Expanded(
child: isLiveEditMode && rulesetSupportsScoreEntry() child: isLiveEditMode && rulesetSupportsScoreEntry()
? ListView.builder( ? ListView.builder(
itemCount: allPlayers.length, itemCount: allPlayers.length + 1,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return LiveEditListTile( if (index < allPlayers.length) {
title: allPlayers[index].name, return LiveEditListTile(
onChanged: (value) { title: allPlayers[index].name,
setState(() { onChanged: (value) {
controller[index].text = value.toString(); setState(() {
}); controller[index].text = value.toString();
}, });
value: int.tryParse(controller[index].text) ?? 0, },
); value: int.tryParse(controller[index].text) ?? 0,
);
} else {
return Center(
child: Padding(
padding: const EdgeInsets.only(top: 30),
child: MainMenuButton(
text: 'Ansicht verlassen',
onPressed: () => {
setState(() {
isLiveEditMode = false;
}),
},
icon: Icons.close,
),
),
);
}
}, },
) )
: Container( : Container(
@@ -147,7 +158,7 @@ class _MatchResultViewState extends State<MatchResultView> {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'${getTitleForRuleset(loc)}:', getTitleForRuleset(loc),
style: const TextStyle( style: const TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,