Use WarningCard to display offline mode

This commit is contained in:
Roland Geider
2025-10-31 10:35:10 +01:00
parent 7d1c03a0a5
commit b8ea38b951
4 changed files with 27 additions and 19 deletions

View File

@@ -1,6 +1,6 @@
/*
* This file is part of wger Workout Manager <https://github.com/wger-project>.
* Copyright (C) 2020, 2021 wger Team
* Copyright (c) 2020, wger Team
*
* wger Workout Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -277,7 +277,7 @@ class CopyToClipboardButton extends StatelessWidget {
}
}
void showDeleteDialog(BuildContext context, String confirmDeleteName, Log log) async {
void showDeleteLogDialog(BuildContext context, String confirmDeleteName, Log log) async {
final res = await showDialog(
context: context,
builder: (BuildContext contextDialog) {

View File

@@ -1069,5 +1069,5 @@
"lightMode": "Always light mode",
"systemMode": "System settings",
"youAreOffline": "You are offline",
"offlineModeInfo": "Some features are unavailable until you reconnect to the internet. Currently, this mainly affects editing routines and nutrition plans, but logging workouts and meals works offline. The data will be synced automatically once you are back online."
"offlineModeInfo": "Some features are unavailable until you reconnect to the internet (buttons and menus will be disabled). Currently, this mainly affects editing routines and nutrition plans, but logging workouts and meals works offline. The data will be synced automatically once you are back online."
}

View File

@@ -1,6 +1,6 @@
/*
* This file is part of wger Workout Manager <https://github.com/wger-project>.
* Copyright (C) wger Team
* Copyright (c) 2020, 2020- wger Team
*
* wger Workout Manager is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
@@ -31,7 +31,27 @@ class InfoCard extends StatelessWidget {
color: theme.colorScheme.primaryContainer,
child: ListTile(
leading: Icon(Icons.info, color: theme.colorScheme.primary),
subtitle: Text(text),
title: Text(text),
),
);
}
}
class WarningCard extends StatelessWidget {
final String text;
const WarningCard({super.key, this.text = ''});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Card(
color: theme.colorScheme.errorContainer,
child: ListTile(
dense: true,
leading: Icon(Icons.info_outline, color: theme.colorScheme.primary),
title: Text(text),
),
);
}

View File

@@ -20,6 +20,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:wger/l10n/generated/app_localizations.dart';
import 'package:wger/providers/network_provider.dart';
import 'package:wger/widgets/core/cards.dart';
class DashboardNetworkInfo extends ConsumerWidget {
const DashboardNetworkInfo({super.key});
@@ -34,20 +35,7 @@ class DashboardNetworkInfo extends ConsumerWidget {
: Tooltip(
margin: const EdgeInsets.all(8),
message: i18n.offlineModeInfo,
child: Card(
color: Theme.of(context).colorScheme.errorContainer,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisSize: MainAxisSize.max,
spacing: 8,
children: [
const Icon(Icons.info_outline),
Text(i18n.youAreOffline),
],
),
),
),
child: WarningCard(text: i18n.youAreOffline),
);
}
}