WIP: Bearbeiten und Löschen von Matches #171
@@ -5,14 +5,32 @@ class CustomTheme {
|
|||||||
CustomTheme._(); // Private constructor to prevent instantiation
|
CustomTheme._(); // Private constructor to prevent instantiation
|
||||||
|
|
||||||
// ==================== Colors ====================
|
// ==================== Colors ====================
|
||||||
|
|
||||||
|
/// Primary color of the app theme
|
||||||
static Color primaryColor = const Color(0xFF7505E4);
|
static Color primaryColor = const Color(0xFF7505E4);
|
||||||
|
|
||||||
|
/// Secondary color of the app theme
|
||||||
static Color secondaryColor = const Color(0xFFAFA2FF);
|
static Color secondaryColor = const Color(0xFFAFA2FF);
|
||||||
|
|
||||||
|
/// Background color of the app theme
|
||||||
static Color backgroundColor = const Color(0xFF0B0B0B);
|
static Color backgroundColor = const Color(0xFF0B0B0B);
|
||||||
|
|
||||||
|
/// Default color for boxes and containers
|
||||||
static Color boxColor = const Color(0xFF101010);
|
static Color boxColor = const Color(0xFF101010);
|
||||||
static Color onBoxColor = const Color(0xFF181818);
|
|
||||||
|
/// Default border color for boxes and containers
|
||||||
static Color boxBorder = const Color(0xFF272727);
|
static Color boxBorder = const Color(0xFF272727);
|
||||||
|
|
||||||
|
/// Color for boxes and containers displayed on boxes
|
||||||
|
static Color onBoxColor = const Color(0xFF181818);
|
||||||
|
|
||||||
|
/// Text color used throughout the app
|
||||||
static const Color textColor = Colors.white;
|
static const Color textColor = Colors.white;
|
||||||
|
|
||||||
|
/// Selected color for the [NavbarItem]
|
||||||
static Color navBarItemSelectedColor = primaryColor.withGreen(100);
|
static Color navBarItemSelectedColor = primaryColor.withGreen(100);
|
||||||
|
|
||||||
|
/// Unselected color for the [NavbarItem]
|
||||||
static Color navBarItemUnselectedColor = Colors.grey.shade400;
|
static Color navBarItemUnselectedColor = Colors.grey.shade400;
|
||||||
|
|
||||||
// ==================== Border Radius ====================
|
// ==================== Border Radius ====================
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
"all_players_selected": "Alle Spieler:innen ausgewählt",
|
"all_players_selected": "Alle Spieler:innen ausgewählt",
|
||||||
"amount_of_matches": "Anzahl der Spiele",
|
"amount_of_matches": "Anzahl der Spiele",
|
||||||
"app_name": "Game Tracker",
|
"app_name": "Game Tracker",
|
||||||
|
"best_player": "Beste:r Spieler:in",
|
||||||
"cancel": "Abbrechen",
|
"cancel": "Abbrechen",
|
||||||
"choose_game": "Spielvorlage wählen",
|
"choose_game": "Spielvorlage wählen",
|
||||||
"choose_group": "Gruppe wählen",
|
"choose_group": "Gruppe wählen",
|
||||||
@@ -13,6 +14,7 @@
|
|||||||
"create_match": "Spiel erstellen",
|
"create_match": "Spiel erstellen",
|
||||||
"create_new_group": "Neue Gruppe erstellen",
|
"create_new_group": "Neue Gruppe erstellen",
|
||||||
"create_new_match": "Neues Spiel erstellen",
|
"create_new_match": "Neues Spiel erstellen",
|
||||||
|
"created_on": "Erstellt am",
|
||||||
"data": "Daten",
|
"data": "Daten",
|
||||||
"data_successfully_deleted": "Daten erfolgreich gelöscht",
|
"data_successfully_deleted": "Daten erfolgreich gelöscht",
|
||||||
"data_successfully_exported": "Daten erfolgreich exportiert",
|
"data_successfully_exported": "Daten erfolgreich exportiert",
|
||||||
@@ -22,6 +24,8 @@
|
|||||||
"delete_all_data": "Alle Daten löschen",
|
"delete_all_data": "Alle Daten löschen",
|
||||||
"delete_group": "Diese Gruppe löschen",
|
"delete_group": "Diese Gruppe löschen",
|
||||||
"edit_group": "Gruppe bearbeiten",
|
"edit_group": "Gruppe bearbeiten",
|
||||||
|
"delete_group": "Gruppe löschen",
|
||||||
|
"edit_group": "Gruppe bearbeiten",
|
||||||
"error_creating_group": "Fehler beim Erstellen der Gruppe, bitte erneut versuchen",
|
"error_creating_group": "Fehler beim Erstellen der Gruppe, bitte erneut versuchen",
|
||||||
"error_deleting_group": "Fehler beim Löschen der Gruppe, bitte erneut versuchen",
|
"error_deleting_group": "Fehler beim Löschen der Gruppe, bitte erneut versuchen",
|
||||||
"error_editing_group": "Fehler beim Bearbeiten der Gruppe, bitte erneut versuchen",
|
"error_editing_group": "Fehler beim Bearbeiten der Gruppe, bitte erneut versuchen",
|
||||||
@@ -33,6 +37,7 @@
|
|||||||
"game_name": "Spielvorlagenname",
|
"game_name": "Spielvorlagenname",
|
||||||
"group": "Gruppe",
|
"group": "Gruppe",
|
||||||
"group_name": "Gruppenname",
|
"group_name": "Gruppenname",
|
||||||
|
"group_profile": "Gruppenprofil",
|
||||||
"groups": "Gruppen",
|
"groups": "Gruppen",
|
||||||
"home": "Startseite",
|
"home": "Startseite",
|
||||||
"import_canceled": "Import abgebrochen",
|
"import_canceled": "Import abgebrochen",
|
||||||
@@ -46,6 +51,7 @@
|
|||||||
"match_in_progress": "Spiel läuft...",
|
"match_in_progress": "Spiel läuft...",
|
||||||
"match_name": "Spieltitel",
|
"match_name": "Spieltitel",
|
||||||
"matches": "Spiele",
|
"matches": "Spiele",
|
||||||
|
"members": "Mitglieder",
|
||||||
"most_points": "Höchste Punkte",
|
"most_points": "Höchste Punkte",
|
||||||
"no_data_available": "Keine Daten verfügbar",
|
"no_data_available": "Keine Daten verfügbar",
|
||||||
"no_groups_created_yet": "Noch keine Gruppen erstellt",
|
"no_groups_created_yet": "Noch keine Gruppen erstellt",
|
||||||
@@ -61,6 +67,7 @@
|
|||||||
"none": "Kein",
|
"none": "Kein",
|
||||||
"none_group": "Keine",
|
"none_group": "Keine",
|
||||||
"not_available": "Nicht verfügbar",
|
"not_available": "Nicht verfügbar",
|
||||||
|
"played_matches": "Gespielte Spiele",
|
||||||
"player_name": "Spieler:innenname",
|
"player_name": "Spieler:innenname",
|
||||||
"players": "Spieler:innen",
|
"players": "Spieler:innen",
|
||||||
"players_count": "{count} Spieler",
|
"players_count": "{count} Spieler",
|
||||||
|
|||||||
@@ -12,6 +12,9 @@
|
|||||||
"@app_name": {
|
"@app_name": {
|
||||||
"description": "The name of the App"
|
"description": "The name of the App"
|
||||||
},
|
},
|
||||||
|
"@best_player": {
|
||||||
|
"description": "Label for best player statistic"
|
||||||
|
},
|
||||||
"@cancel": {
|
"@cancel": {
|
||||||
"description": "Cancel button text"
|
"description": "Cancel button text"
|
||||||
},
|
},
|
||||||
@@ -39,6 +42,9 @@
|
|||||||
"@create_new_match": {
|
"@create_new_match": {
|
||||||
"description": "Appbar text to create a new match"
|
"description": "Appbar text to create a new match"
|
||||||
},
|
},
|
||||||
|
"@created_on": {
|
||||||
|
"description": "Label for creation date"
|
||||||
|
},
|
||||||
"@data": {
|
"@data": {
|
||||||
"description": "Data label"
|
"description": "Data label"
|
||||||
},
|
},
|
||||||
@@ -104,6 +110,9 @@
|
|||||||
"@group_name": {
|
"@group_name": {
|
||||||
"description": "Placeholder for group name input"
|
"description": "Placeholder for group name input"
|
||||||
},
|
},
|
||||||
|
"@group_profile": {
|
||||||
|
"description": "Title for group profile view"
|
||||||
|
},
|
||||||
"@groups": {
|
"@groups": {
|
||||||
"description": "Label for groups"
|
"description": "Label for groups"
|
||||||
},
|
},
|
||||||
@@ -143,6 +152,9 @@
|
|||||||
"@matches": {
|
"@matches": {
|
||||||
"description": "Label for matches"
|
"description": "Label for matches"
|
||||||
},
|
},
|
||||||
|
"@members": {
|
||||||
|
"description": "Label for group members"
|
||||||
|
},
|
||||||
"@most_points": {
|
"@most_points": {
|
||||||
"description": "Title for most points ruleset"
|
"description": "Title for most points ruleset"
|
||||||
},
|
},
|
||||||
@@ -188,6 +200,9 @@
|
|||||||
"@not_available": {
|
"@not_available": {
|
||||||
"description": "Abbreviation for not available"
|
"description": "Abbreviation for not available"
|
||||||
},
|
},
|
||||||
|
"@played_matches": {
|
||||||
|
"description": "Label for played matches statistic"
|
||||||
|
},
|
||||||
"@player_name": {
|
"@player_name": {
|
||||||
"description": "Placeholder for player name input"
|
"description": "Placeholder for player name input"
|
||||||
},
|
},
|
||||||
@@ -293,6 +308,7 @@
|
|||||||
"all_players_selected": "All players selected",
|
"all_players_selected": "All players selected",
|
||||||
"amount_of_matches": "Amount of Matches",
|
"amount_of_matches": "Amount of Matches",
|
||||||
"app_name": "Game Tracker",
|
"app_name": "Game Tracker",
|
||||||
|
"best_player": "Best Player",
|
||||||
"cancel": "Cancel",
|
"cancel": "Cancel",
|
||||||
"choose_game": "Choose Game",
|
"choose_game": "Choose Game",
|
||||||
"choose_group": "Choose Group",
|
"choose_group": "Choose Group",
|
||||||
@@ -301,6 +317,7 @@
|
|||||||
"create_group": "Create Group",
|
"create_group": "Create Group",
|
||||||
"create_match": "Create match",
|
"create_match": "Create match",
|
||||||
"create_new_group": "Create new group",
|
"create_new_group": "Create new group",
|
||||||
|
"created_on": "Created on",
|
||||||
"create_new_match": "Create new match",
|
"create_new_match": "Create new match",
|
||||||
"data": "Data",
|
"data": "Data",
|
||||||
"data_successfully_deleted": "Data successfully deleted",
|
"data_successfully_deleted": "Data successfully deleted",
|
||||||
@@ -309,7 +326,7 @@
|
|||||||
"days_ago": "{count} days ago",
|
"days_ago": "{count} days ago",
|
||||||
"delete": "Delete",
|
"delete": "Delete",
|
||||||
"delete_all_data": "Delete all data",
|
"delete_all_data": "Delete all data",
|
||||||
"delete_group": "Delete this group",
|
"delete_group": "Delete Group",
|
||||||
"edit_group": "Edit Group",
|
"edit_group": "Edit Group",
|
||||||
"error_creating_group": "Error while creating group, please try again",
|
"error_creating_group": "Error while creating group, please try again",
|
||||||
"error_deleting_group": "Error while deleting group, please try again",
|
"error_deleting_group": "Error while deleting group, please try again",
|
||||||
@@ -322,6 +339,7 @@
|
|||||||
"game_name": "Game Name",
|
"game_name": "Game Name",
|
||||||
"group": "Group",
|
"group": "Group",
|
||||||
"group_name": "Group name",
|
"group_name": "Group name",
|
||||||
|
"group_profile": "Group Profile",
|
||||||
"groups": "Groups",
|
"groups": "Groups",
|
||||||
"home": "Home",
|
"home": "Home",
|
||||||
"import_canceled": "Import canceled",
|
"import_canceled": "Import canceled",
|
||||||
@@ -335,6 +353,7 @@
|
|||||||
"match_in_progress": "Match in progress...",
|
"match_in_progress": "Match in progress...",
|
||||||
"match_name": "Match name",
|
"match_name": "Match name",
|
||||||
"matches": "Matches",
|
"matches": "Matches",
|
||||||
|
"members": "Members",
|
||||||
"most_points": "Most Points",
|
"most_points": "Most Points",
|
||||||
"no_data_available": "No data available",
|
"no_data_available": "No data available",
|
||||||
"no_groups_created_yet": "No groups created yet",
|
"no_groups_created_yet": "No groups created yet",
|
||||||
@@ -350,6 +369,7 @@
|
|||||||
"none": "None",
|
"none": "None",
|
||||||
"none_group": "None",
|
"none_group": "None",
|
||||||
"not_available": "Not available",
|
"not_available": "Not available",
|
||||||
|
"played_matches": "Played Matches",
|
||||||
"player_name": "Player name",
|
"player_name": "Player name",
|
||||||
"players": "Players",
|
"players": "Players",
|
||||||
"players_count": "{count} Players",
|
"players_count": "{count} Players",
|
||||||
|
|||||||
@@ -0,0 +1,271 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
import 'package:game_tracker/data/db/database.dart';
|
||||||
|
import 'package:game_tracker/data/dto/group.dart';
|
||||||
|
import 'package:game_tracker/data/dto/match.dart';
|
||||||
|
import 'package:game_tracker/data/dto/player.dart';
|
||||||
|
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
||||||
|
import 'package:game_tracker/presentation/widgets/app_skeleton.dart';
|
||||||
|
import 'package:game_tracker/presentation/widgets/buttons/animated_dialog_button.dart';
|
||||||
|
import 'package:game_tracker/presentation/widgets/buttons/main_menu_button.dart';
|
||||||
|
import 'package:game_tracker/presentation/widgets/colored_icon_container.dart';
|
||||||
|
import 'package:game_tracker/presentation/widgets/custom_alert_dialog.dart';
|
||||||
|
import 'package:game_tracker/presentation/widgets/tiles/info_tile.dart';
|
||||||
|
import 'package:game_tracker/presentation/widgets/tiles/text_icon_tile.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
class GroupProfileView extends StatefulWidget {
|
||||||
|
/// A view that displays the profile of a group
|
||||||
|
/// - [group]: The group to display
|
||||||
|
const GroupProfileView({
|
||||||
|
super.key,
|
||||||
|
required this.group,
|
||||||
|
required this.callback,
|
||||||
|
});
|
||||||
|
|
||||||
|
/// The group to display
|
||||||
|
final Group group;
|
||||||
|
|
||||||
|
final VoidCallback callback;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<GroupProfileView> createState() => _GroupProfileViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _GroupProfileViewState extends State<GroupProfileView> {
|
||||||
|
late final AppDatabase db;
|
||||||
|
bool isLoading = true;
|
||||||
|
|
||||||
|
/// Total matches played in this group
|
||||||
|
int totalMatches = 0;
|
||||||
|
|
||||||
|
String bestPlayer = '';
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
db = Provider.of<AppDatabase>(context, listen: false);
|
||||||
|
_loadStatistics();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final loc = AppLocalizations.of(context);
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: CustomTheme.backgroundColor,
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(loc.group_profile),
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.delete),
|
||||||
|
onPressed: () async {
|
||||||
|
showDialog<bool>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => CustomAlertDialog(
|
||||||
|
title: '${loc.delete_group}?',
|
||||||
|
content: loc.this_cannot_be_undone,
|
||||||
|
actions: [
|
||||||
|
AnimatedDialogButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(false),
|
||||||
|
child: Text(
|
||||||
|
loc.cancel,
|
||||||
|
style: const TextStyle(color: CustomTheme.textColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
AnimatedDialogButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(true),
|
||||||
|
child: Text(
|
||||||
|
loc.delete,
|
||||||
|
style: TextStyle(color: CustomTheme.secondaryColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
).then((confirmed) async {
|
||||||
|
if (confirmed! && context.mounted) {
|
||||||
|
await db.groupDao.deleteGroup(groupId: widget.group.id);
|
||||||
|
if (!context.mounted) return;
|
||||||
|
Navigator.pop(context);
|
||||||
|
widget.callback.call();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
body: SafeArea(
|
||||||
|
child: Stack(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
children: [
|
||||||
|
ListView(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 12,
|
||||||
|
right: 12,
|
||||||
|
top: 20,
|
||||||
|
bottom: 100,
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
const Center(
|
||||||
|
child: ColoredIconContainer(
|
||||||
|
icon: Icons.group,
|
||||||
|
containerSize: 55,
|
||||||
|
iconSize: 38,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Text(
|
||||||
|
widget.group.name,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 28,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: CustomTheme.textColor,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
Text(
|
||||||
|
'${loc.created_on} ${DateFormat.yMMMd(Localizations.localeOf(context).toString()).format(widget.group.createdAt)}',
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 12,
|
||||||
|
color: CustomTheme.textColor,
|
||||||
|
),
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
InfoTile(
|
||||||
|
title: loc.members,
|
||||||
|
icon: Icons.people,
|
||||||
|
horizontalAlignment: CrossAxisAlignment.start,
|
||||||
|
content: Wrap(
|
||||||
|
alignment: WrapAlignment.start,
|
||||||
|
crossAxisAlignment: WrapCrossAlignment.start,
|
||||||
|
spacing: 12,
|
||||||
|
runSpacing: 8,
|
||||||
|
children: widget.group.members.map((member) {
|
||||||
|
return TextIconTile(
|
||||||
|
text: member.name,
|
||||||
|
iconEnabled: false,
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 15),
|
||||||
|
InfoTile(
|
||||||
|
title: loc.statistics,
|
||||||
|
icon: Icons.bar_chart,
|
||||||
|
content: AppSkeleton(
|
||||||
|
enabled: isLoading,
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
_buildStatRow(
|
||||||
|
loc.members,
|
||||||
|
widget.group.members.length.toString(),
|
||||||
|
),
|
||||||
|
_buildStatRow(
|
||||||
|
loc.played_matches,
|
||||||
|
totalMatches.toString(),
|
||||||
|
),
|
||||||
|
_buildStatRow(loc.best_player, bestPlayer),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Positioned(
|
||||||
|
bottom: MediaQuery.paddingOf(context).bottom,
|
||||||
|
child: MainMenuButton(
|
||||||
|
text: loc.edit_group,
|
||||||
|
icon: Icons.edit,
|
||||||
|
onPressed: () {
|
||||||
|
// TODO: Uncomment when GroupDetailView is implemented
|
||||||
|
/*
|
||||||
|
await Navigator.push(
|
||||||
|
context,
|
||||||
|
adaptivePageRoute(
|
||||||
|
builder: (context) {
|
||||||
|
|
||||||
|
return const GroupDetailView();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);*/
|
||||||
|
print('Edit Group pressed');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Builds a single statistic row with a label and value
|
||||||
|
/// - [label]: The label of the statistic
|
||||||
|
/// - [value]: The value of the statistic
|
||||||
|
Widget _buildStatRow(String label, String value) {
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 4, horizontal: 8),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
label,
|
||||||
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
color: CustomTheme.textColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
value,
|
||||||
|
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Loads statistics for this group
|
||||||
|
Future<void> _loadStatistics() async {
|
||||||
|
final matches = await db.matchDao.getAllMatches();
|
||||||
|
final groupMatches = matches
|
||||||
|
.where((match) => match.group?.id == widget.group.id)
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
totalMatches = groupMatches.length;
|
||||||
|
bestPlayer = _getBestPlayer(groupMatches);
|
||||||
|
isLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Determines the best player in the group based on match wins
|
||||||
|
String _getBestPlayer(List<Match> matches) {
|
||||||
|
final bestPlayerCounts = <Player, int>{};
|
||||||
|
|
||||||
|
// Count wins for each player
|
||||||
|
for (var match in matches) {
|
||||||
|
if (match.winner != null) {
|
||||||
|
bestPlayerCounts.update(
|
||||||
|
match.winner!,
|
||||||
|
(value) => value + 1,
|
||||||
|
ifAbsent: () => 1,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort players by win count
|
||||||
|
final sortedPlayers = bestPlayerCounts.entries.toList()
|
||||||
|
..sort((a, b) => b.value.compareTo(a.value));
|
||||||
|
|
||||||
|
// Get the best player
|
||||||
|
bestPlayer = sortedPlayers.isNotEmpty ? sortedPlayers.first.key.name : '-';
|
||||||
|
|
||||||
|
return bestPlayer;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import 'package:game_tracker/data/db/database.dart';
|
|||||||
import 'package:game_tracker/data/dto/group.dart';
|
import 'package:game_tracker/data/dto/group.dart';
|
||||||
import 'package:game_tracker/data/dto/player.dart';
|
import 'package:game_tracker/data/dto/player.dart';
|
||||||
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
||||||
|
import 'package:game_tracker/presentation/views/main_menu/group_view/group_profile_view.dart';
|
||||||
import 'package:game_tracker/presentation/views/main_menu/group_view/group_detail_view.dart';
|
import 'package:game_tracker/presentation/views/main_menu/group_view/group_detail_view.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/app_skeleton.dart';
|
import 'package:game_tracker/presentation/widgets/app_skeleton.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/buttons/main_menu_button.dart';
|
import 'package:game_tracker/presentation/widgets/buttons/main_menu_button.dart';
|
||||||
@@ -74,19 +75,22 @@ class _GroupsViewState extends State<GroupsView> {
|
|||||||
height: MediaQuery.paddingOf(context).bottom - 20,
|
height: MediaQuery.paddingOf(context).bottom - 20,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return GroupTile(group: groups[index], onTap: () async {
|
return GroupTile(
|
||||||
|
group: groups[index],
|
||||||
|
onTap: () async {
|
||||||
await Navigator.push(
|
await Navigator.push(
|
||||||
context,
|
context,
|
||||||
adaptivePageRoute(
|
adaptivePageRoute(
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return GroupDetailView(groupToEdit: groups[index]);
|
return GroupProfileView(
|
||||||
|
group: groups[index],
|
||||||
|
callback: loadGroups,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
setState(() {
|
},
|
||||||
loadGroups();
|
);
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -117,6 +121,9 @@ class _GroupsViewState extends State<GroupsView> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loadGroups() {
|
void loadGroups() {
|
||||||
|
setState(() {
|
||||||
|
isLoading = true;
|
||||||
|
});
|
||||||
Future.wait([
|
Future.wait([
|
||||||
db.groupDao.getAllGroups(),
|
db.groupDao.getAllGroups(),
|
||||||
Future.delayed(Constants.MINIMUM_SKELETON_DURATION),
|
Future.delayed(Constants.MINIMUM_SKELETON_DURATION),
|
||||||
|
|||||||
@@ -1,99 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
|
||||||
import 'package:game_tracker/core/enums.dart';
|
|
||||||
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
|
||||||
import 'package:game_tracker/presentation/widgets/tiles/title_description_list_tile.dart';
|
|
||||||
|
|
||||||
class ChooseRulesetView extends StatefulWidget {
|
|
||||||
/// A view that allows the user to choose a ruleset from a list of available rulesets
|
|
||||||
/// - [rulesets]: A list of tuples containing the ruleset and its description
|
|
||||||
/// - [initialRulesetIndex]: The index of the initially selected ruleset
|
|
||||||
const ChooseRulesetView({
|
|
||||||
super.key,
|
|
||||||
required this.rulesets,
|
|
||||||
required this.initialRulesetIndex,
|
|
||||||
});
|
|
||||||
|
|
||||||
/// A list of tuples containing the ruleset and its description
|
|
||||||
final List<(Ruleset, String)> rulesets;
|
|
||||||
|
|
||||||
/// The index of the initially selected ruleset
|
|
||||||
final int initialRulesetIndex;
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<ChooseRulesetView> createState() => _ChooseRulesetViewState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _ChooseRulesetViewState extends State<ChooseRulesetView> {
|
|
||||||
/// Currently selected ruleset index
|
|
||||||
late int selectedRulesetIndex;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
selectedRulesetIndex = widget.initialRulesetIndex;
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final loc = AppLocalizations.of(context);
|
|
||||||
return DefaultTabController(
|
|
||||||
length: 2,
|
|
||||||
initialIndex: 0,
|
|
||||||
child: Scaffold(
|
|
||||||
backgroundColor: CustomTheme.backgroundColor,
|
|
||||||
appBar: AppBar(
|
|
||||||
leading: IconButton(
|
|
||||||
icon: const Icon(Icons.arrow_back_ios),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop(
|
|
||||||
selectedRulesetIndex == -1
|
|
||||||
? null
|
|
||||||
: widget.rulesets[selectedRulesetIndex].$1,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
title: Text(loc.choose_ruleset),
|
|
||||||
),
|
|
||||||
body: PopScope(
|
|
||||||
// This fixes that the Android Back Gesture didn't return the
|
|
||||||
// selectedRulesetIndex and therefore the selected Ruleset wasn't saved
|
|
||||||
canPop: false,
|
|
||||||
onPopInvokedWithResult: (bool didPop, Object? result) {
|
|
||||||
if (didPop) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Navigator.of(context).pop(
|
|
||||||
selectedRulesetIndex == -1
|
|
||||||
? null
|
|
||||||
: widget.rulesets[selectedRulesetIndex].$1,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: ListView.builder(
|
|
||||||
padding: const EdgeInsets.only(bottom: 85),
|
|
||||||
itemCount: widget.rulesets.length,
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
return TitleDescriptionListTile(
|
|
||||||
onPressed: () async {
|
|
||||||
setState(() {
|
|
||||||
if (selectedRulesetIndex == index) {
|
|
||||||
selectedRulesetIndex = -1;
|
|
||||||
} else {
|
|
||||||
selectedRulesetIndex = index;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
title: translateRulesetToString(
|
|
||||||
widget.rulesets[index].$1,
|
|
||||||
context,
|
|
||||||
),
|
|
||||||
description: widget.rulesets[index].$2,
|
|
||||||
isHighlighted: selectedRulesetIndex == index,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -10,7 +10,6 @@ import 'package:game_tracker/data/dto/player.dart';
|
|||||||
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
||||||
import 'package:game_tracker/presentation/views/main_menu/match_view/create_match/choose_game_view.dart';
|
import 'package:game_tracker/presentation/views/main_menu/match_view/create_match/choose_game_view.dart';
|
||||||
import 'package:game_tracker/presentation/views/main_menu/match_view/create_match/choose_group_view.dart';
|
import 'package:game_tracker/presentation/views/main_menu/match_view/create_match/choose_group_view.dart';
|
||||||
import 'package:game_tracker/presentation/views/main_menu/match_view/create_match/choose_ruleset_view.dart';
|
|
||||||
import 'package:game_tracker/presentation/views/main_menu/match_view/match_result_view.dart';
|
import 'package:game_tracker/presentation/views/main_menu/match_view/match_result_view.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/buttons/custom_width_button.dart';
|
import 'package:game_tracker/presentation/widgets/buttons/custom_width_button.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/player_selection.dart';
|
import 'package:game_tracker/presentation/widgets/player_selection.dart';
|
||||||
@@ -58,13 +57,6 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
/// the [ChooseGroupView]
|
/// the [ChooseGroupView]
|
||||||
String selectedGroupId = '';
|
String selectedGroupId = '';
|
||||||
|
|
||||||
/// The currently selected ruleset
|
|
||||||
Ruleset? selectedRuleset;
|
|
||||||
|
|
||||||
/// The index of the currently selected ruleset in [rulesets] to mark it in
|
|
||||||
/// the [ChooseRulesetView]
|
|
||||||
int selectedRulesetIndex = -1;
|
|
||||||
|
|
||||||
/// The index of the currently selected game in [games] to mark it in
|
/// The index of the currently selected game in [games] to mark it in
|
||||||
/// the [ChooseGameView]
|
/// the [ChooseGameView]
|
||||||
int selectedGameIndex = -1;
|
int selectedGameIndex = -1;
|
||||||
@@ -72,12 +64,6 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
/// The currently selected players
|
/// The currently selected players
|
||||||
List<Player>? selectedPlayers;
|
List<Player>? selectedPlayers;
|
||||||
|
|
||||||
/// List of available rulesets with their localized string representations
|
|
||||||
late final List<(Ruleset, String)> _rulesets;
|
|
||||||
|
|
||||||
/// GlobalKey for ScaffoldMessenger to show snackbars
|
|
||||||
final _scaffoldMessengerKey = GlobalKey<ScaffoldMessengerState>();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -110,15 +96,8 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
final loc = AppLocalizations.of(context);
|
final loc = AppLocalizations.of(context);
|
||||||
hintText ??= loc.match_name;
|
hintText ??= loc.match_name;
|
||||||
_rulesets = [
|
|
||||||
(Ruleset.singleWinner, loc.ruleset_single_winner),
|
|
||||||
(Ruleset.singleLoser, loc.ruleset_single_loser),
|
|
||||||
(Ruleset.mostPoints, loc.ruleset_most_points),
|
|
||||||
(Ruleset.leastPoints, loc.ruleset_least_points),
|
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Replace when games are implemented
|
|
||||||
List<(String, String, Ruleset)> games = [
|
List<(String, String, Ruleset)> games = [
|
||||||
('Example Game 1', 'This is a description', Ruleset.leastPoints),
|
('Example Game 1', 'This is a description', Ruleset.leastPoints),
|
||||||
('Example Game 2', '', Ruleset.singleWinner),
|
('Example Game 2', '', Ruleset.singleWinner),
|
||||||
@@ -161,39 +140,12 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
if (selectedGameIndex != -1) {
|
if (selectedGameIndex != -1) {
|
||||||
hintText = games[selectedGameIndex].$1;
|
hintText = games[selectedGameIndex].$1;
|
||||||
selectedRuleset = games[selectedGameIndex].$3;
|
|
||||||
selectedRulesetIndex = _rulesets.indexWhere(
|
|
||||||
(r) => r.$1 == selectedRuleset,
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
hintText = loc.match_name;
|
hintText = loc.match_name;
|
||||||
selectedRuleset = null;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ChooseTile(
|
|
||||||
title: loc.ruleset,
|
|
||||||
trailingText: selectedRuleset == null
|
|
||||||
? loc.none
|
|
||||||
: translateRulesetToString(selectedRuleset!, context),
|
|
||||||
onPressed: () async {
|
|
||||||
selectedRuleset = await Navigator.of(context).push(
|
|
||||||
adaptivePageRoute(
|
|
||||||
builder: (context) => ChooseRulesetView(
|
|
||||||
rulesets: _rulesets,
|
|
||||||
initialRulesetIndex: selectedRulesetIndex,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
if (!mounted) return;
|
|
||||||
selectedRulesetIndex = _rulesets.indexWhere(
|
|
||||||
(r) => r.$1 == selectedRuleset,
|
|
||||||
);
|
|
||||||
selectedGameIndex = -1;
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
ChooseTile(
|
ChooseTile(
|
||||||
title: loc.group,
|
title: loc.group,
|
||||||
trailingText: selectedGroup == null
|
trailingText: selectedGroup == null
|
||||||
@@ -278,7 +230,6 @@ class _CreateMatchViewState extends State<CreateMatchView> {
|
|||||||
/// - Either a group is selected OR at least 2 players are selected
|
/// - Either a group is selected OR at least 2 players are selected
|
||||||
bool _enableCreateGameButton() {
|
bool _enableCreateGameButton() {
|
||||||
return (selectedGroup != null ||
|
return (selectedGroup != null ||
|
||||||
(selectedPlayers != null && selectedPlayers!.length > 1)) &&
|
(selectedPlayers != null && selectedPlayers!.length > 1));
|
||||||
selectedRuleset != null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
import 'package:game_tracker/l10n/generated/app_localizations.dart';
|
||||||
import 'package:game_tracker/presentation/views/main_menu/settings_view/licenses/oss_licenses.dart';
|
import 'package:game_tracker/presentation/views/main_menu/settings_view/licenses/oss_licenses.dart';
|
||||||
|
import 'package:game_tracker/presentation/widgets/colored_icon_container.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class LicenseDetailView extends StatelessWidget {
|
class LicenseDetailView extends StatelessWidget {
|
||||||
@@ -29,19 +30,11 @@ class LicenseDetailView extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
const ColoredIconContainer(
|
||||||
margin: const EdgeInsetsGeometry.only(right: 15),
|
icon: Icons.description,
|
||||||
width: 60,
|
margin: EdgeInsetsGeometry.only(right: 15),
|
||||||
height: 60,
|
containerSize: 60,
|
||||||
decoration: BoxDecoration(
|
iconSize: 30,
|
||||||
color: CustomTheme.primaryColor.withAlpha(40),
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
),
|
|
||||||
child: Icon(
|
|
||||||
Icons.description,
|
|
||||||
color: CustomTheme.primaryColor,
|
|
||||||
size: 30,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
|||||||
57
lib/presentation/widgets/colored_icon_container.dart
Normal file
57
lib/presentation/widgets/colored_icon_container.dart
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
|
||||||
|
class ColoredIconContainer extends StatelessWidget {
|
||||||
|
/// A customizable container widget that displays an icon with a colored background.
|
||||||
|
/// - [icon]: The icon to be displayed inside the container.
|
||||||
|
/// - [containerSize]: The size of the container (width and height).
|
||||||
|
/// - [iconSize]: The size of the icon inside the container.
|
||||||
|
/// - [margin]: Optional margin around the container.
|
||||||
|
/// - [padding]: Optional padding inside the container.
|
||||||
|
const ColoredIconContainer({
|
||||||
|
super.key,
|
||||||
|
required this.icon,
|
||||||
|
this.containerSize = 44,
|
||||||
|
this.iconSize = 28,
|
||||||
|
this.margin,
|
||||||
|
this.padding,
|
||||||
|
});
|
||||||
|
|
||||||
|
/// The icon to be displayed inside the container.
|
||||||
|
final IconData icon;
|
||||||
|
|
||||||
|
/// The size of the container (width and height).
|
||||||
|
final double containerSize;
|
||||||
|
|
||||||
|
/// The size of the icon inside the container.
|
||||||
|
final double iconSize;
|
||||||
|
|
||||||
|
/// Optional margin around the container.
|
||||||
|
final EdgeInsetsGeometry? margin;
|
||||||
|
|
||||||
|
/// Optional padding inside the container.
|
||||||
|
final EdgeInsetsGeometry? padding;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Stack(
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: containerSize,
|
||||||
|
height: containerSize,
|
||||||
|
margin: margin,
|
||||||
|
padding: padding,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: CustomTheme.primaryColor.withAlpha(40),
|
||||||
|
borderRadius: BorderRadius.circular(10),
|
||||||
|
),
|
||||||
|
child: Icon(
|
||||||
|
icon,
|
||||||
|
size: iconSize,
|
||||||
|
color: CustomTheme.primaryColor.withGreen(40),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,12 +3,17 @@ import 'package:game_tracker/core/custom_theme.dart';
|
|||||||
import 'package:game_tracker/data/dto/group.dart';
|
import 'package:game_tracker/data/dto/group.dart';
|
||||||
import 'package:game_tracker/presentation/widgets/tiles/text_icon_tile.dart';
|
import 'package:game_tracker/presentation/widgets/tiles/text_icon_tile.dart';
|
||||||
|
|
||||||
class GroupTile extends StatelessWidget {
|
class GroupTile extends StatefulWidget {
|
||||||
/// A tile widget that displays information about a group, including its name and members.
|
/// A tile widget that displays information about a group, including its name and members.
|
||||||
/// - [group]: The group data to be displayed.
|
/// - [group]: The group data to be displayed.
|
||||||
/// - [isHighlighted]: Whether the tile should be highlighted.
|
/// - [isHighlighted]: Whether the tile should be highlighted.
|
||||||
/// - [onTap]: An optional callback function to handle tap events.
|
/// - [onTap]: Callback function to be executed when the tile is tapped.
|
||||||
const GroupTile({super.key, required this.group, this.isHighlighted = false, this.onTap});
|
const GroupTile({
|
||||||
|
super.key,
|
||||||
|
required this.group,
|
||||||
|
this.isHighlighted = false,
|
||||||
|
this.onTap,
|
||||||
|
});
|
||||||
|
|
||||||
/// The group data to be displayed.
|
/// The group data to be displayed.
|
||||||
final Group group;
|
final Group group;
|
||||||
@@ -16,17 +21,22 @@ class GroupTile extends StatelessWidget {
|
|||||||
/// Whether the tile should be highlighted.
|
/// Whether the tile should be highlighted.
|
||||||
final bool isHighlighted;
|
final bool isHighlighted;
|
||||||
|
|
||||||
/// Callback function to handle tap events.
|
/// Callback function to be executed when the tile is tapped.
|
||||||
final VoidCallback? onTap;
|
final VoidCallback? onTap;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<GroupTile> createState() => _GroupTileState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _GroupTileState extends State<GroupTile> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
return GestureDetector(
|
||||||
onTap: onTap,
|
onTap: widget.onTap,
|
||||||
child: AnimatedContainer(
|
child: AnimatedContainer(
|
||||||
margin: CustomTheme.standardMargin,
|
margin: CustomTheme.standardMargin,
|
||||||
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
|
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
|
||||||
decoration: isHighlighted
|
decoration: widget.isHighlighted
|
||||||
? CustomTheme.highlightedBoxDecoration
|
? CustomTheme.highlightedBoxDecoration
|
||||||
: CustomTheme.standardBoxDecoration,
|
: CustomTheme.standardBoxDecoration,
|
||||||
duration: const Duration(milliseconds: 150),
|
duration: const Duration(milliseconds: 150),
|
||||||
@@ -38,7 +48,7 @@ class GroupTile extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Text(
|
child: Text(
|
||||||
group.name,
|
widget.group.name,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
@@ -49,7 +59,7 @@ class GroupTile extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'${group.members.length}',
|
'${widget.group.members.length}',
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.w900,
|
fontWeight: FontWeight.w900,
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
@@ -69,7 +79,7 @@ class GroupTile extends StatelessWidget {
|
|||||||
runSpacing: 8.0,
|
runSpacing: 8.0,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
for (var member in [
|
for (var member in [
|
||||||
...group.members,
|
...widget.group.members,
|
||||||
]..sort((a, b) => a.name.compareTo(b.name)))
|
]..sort((a, b) => a.name.compareTo(b.name)))
|
||||||
TextIconTile(text: member.name, iconEnabled: false),
|
TextIconTile(text: member.name, iconEnabled: false),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class InfoTile extends StatefulWidget {
|
|||||||
this.padding,
|
this.padding,
|
||||||
this.height,
|
this.height,
|
||||||
this.width,
|
this.width,
|
||||||
|
this.horizontalAlignment = CrossAxisAlignment.center,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// The title text displayed on the tile.
|
/// The title text displayed on the tile.
|
||||||
@@ -37,6 +38,9 @@ class InfoTile extends StatefulWidget {
|
|||||||
/// Optional width for the tile.
|
/// Optional width for the tile.
|
||||||
final double? width;
|
final double? width;
|
||||||
|
|
||||||
|
/// The main axis alignment for the content.
|
||||||
|
final CrossAxisAlignment horizontalAlignment;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<InfoTile> createState() => _InfoTileState();
|
State<InfoTile> createState() => _InfoTileState();
|
||||||
}
|
}
|
||||||
@@ -51,7 +55,7 @@ class _InfoTileState extends State<InfoTile> {
|
|||||||
decoration: CustomTheme.standardBoxDecoration,
|
decoration: CustomTheme.standardBoxDecoration,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: widget.horizontalAlignment,
|
||||||
children: [
|
children: [
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
import 'package:game_tracker/presentation/views/main_menu/settings_view/licenses/license_detail_view.dart';
|
import 'package:game_tracker/presentation/views/main_menu/settings_view/licenses/license_detail_view.dart';
|
||||||
import 'package:game_tracker/presentation/views/main_menu/settings_view/licenses/oss_licenses.dart';
|
import 'package:game_tracker/presentation/views/main_menu/settings_view/licenses/oss_licenses.dart';
|
||||||
|
import 'package:game_tracker/presentation/widgets/colored_icon_container.dart';
|
||||||
|
|
||||||
class LicenseTile extends StatelessWidget {
|
class LicenseTile extends StatelessWidget {
|
||||||
/// A tile widget that displays information about a software package license.
|
/// A tile widget that displays information about a software package license.
|
||||||
@@ -29,18 +30,10 @@ class LicenseTile extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
const ColoredIconContainer(
|
||||||
width: 50,
|
icon: Icons.description,
|
||||||
height: 50,
|
containerSize: 50,
|
||||||
decoration: BoxDecoration(
|
iconSize: 32,
|
||||||
color: CustomTheme.primaryColor.withAlpha(40),
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
),
|
|
||||||
child: Icon(
|
|
||||||
Icons.description,
|
|
||||||
color: CustomTheme.primaryColor,
|
|
||||||
size: 32,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ class _MatchTileState extends State<MatchTile> {
|
|||||||
} else if (difference.inDays < 7) {
|
} else if (difference.inDays < 7) {
|
||||||
return loc.days_ago(difference.inDays);
|
return loc.days_ago(difference.inDays);
|
||||||
} else {
|
} else {
|
||||||
return DateFormat('MMM d, yyyy').format(dateTime);
|
return '${loc.created_on} ${DateFormat.yMMMd(Localizations.localeOf(context).toString()).format(dateTime)}';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:game_tracker/core/custom_theme.dart';
|
import 'package:game_tracker/core/custom_theme.dart';
|
||||||
|
import 'package:game_tracker/presentation/widgets/colored_icon_container.dart';
|
||||||
|
|
||||||
class SettingsListTile extends StatelessWidget {
|
class SettingsListTile extends StatelessWidget {
|
||||||
/// A customizable settings list tile widget that displays an icon, title, and an optional suffix widget.
|
/// A customizable settings list tile widget that displays an icon, title, and an optional suffix widget.
|
||||||
@@ -46,18 +47,10 @@ class SettingsListTile extends StatelessWidget {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Container(
|
ColoredIconContainer(
|
||||||
width: 44,
|
icon: icon,
|
||||||
height: 44,
|
containerSize: 44,
|
||||||
decoration: BoxDecoration(
|
iconSize: 28,
|
||||||
color: CustomTheme.primaryColor.withAlpha(40),
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
),
|
|
||||||
child: Icon(
|
|
||||||
icon,
|
|
||||||
size: 28,
|
|
||||||
color: CustomTheme.primaryColor.withGreen(40),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const SizedBox(width: 16),
|
const SizedBox(width: 16),
|
||||||
Text(title, style: const TextStyle(fontSize: 18)),
|
Text(title, style: const TextStyle(fontSize: 18)),
|
||||||
|
|||||||
@@ -73,7 +73,6 @@ class TitleDescriptionListTile extends StatelessWidget {
|
|||||||
const Spacer(),
|
const Spacer(),
|
||||||
Container(
|
Container(
|
||||||
constraints: const BoxConstraints(maxWidth: 115),
|
constraints: const BoxConstraints(maxWidth: 115),
|
||||||
margin: const EdgeInsets.only(top: 4),
|
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
vertical: 2,
|
vertical: 2,
|
||||||
horizontal: 6,
|
horizontal: 6,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: game_tracker
|
name: game_tracker
|
||||||
description: "Game Tracking App for Card Games"
|
description: "Game Tracking App for Card Games"
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
version: 0.0.7+216
|
version: 0.0.7+239
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.8.1
|
sdk: ^3.8.1
|
||||||
|
|||||||
Reference in New Issue
Block a user