Notifications screen has load button on empty, common linear progress indicator

main
Hank Grabowski 2023-11-27 15:09:42 -06:00
rodzic b13b66ec48
commit f3e8c3bdb8
2 zmienionych plików z 37 dodań i 11 usunięć

Wyświetl plik

@ -11,9 +11,13 @@ final getIt = GetIt.instance;
String randomId() => const Uuid().v4().toString();
final platformHasCamera = Platform.isIOS || Platform.isAndroid;
final platformIsMobile = Platform.isIOS || Platform.isAndroid;
final useImagePicker = kIsWeb || Platform.isAndroid || Platform.isIOS;
final platformHasCamera = platformIsMobile;
final platformIsDesktop = !platformIsMobile;
final useImagePicker = kIsWeb || platformIsMobile;
const usePhpDebugging = false;

Wyświetl plik

@ -3,7 +3,9 @@ import 'package:logging/logging.dart';
import 'package:provider/provider.dart';
import '../controls/app_bottom_nav_bar.dart';
import '../controls/linear_status_indicator.dart';
import '../controls/notifications_control.dart';
import '../controls/padding.dart';
import '../controls/responsive_max_width.dart';
import '../controls/standard_app_drawer.dart';
import '../controls/standard_appbar.dart';
@ -36,10 +38,11 @@ class NotificationsScreen extends StatelessWidget {
managerResult.match(onSuccess: (manager) {
final notifications = manager.notifications;
actions = [
StatusAndRefreshButton(
valueListenable: nss.notificationsUpdateStatus,
refreshFunction: () async => update(manager),
),
if (platformIsDesktop)
StatusAndRefreshButton(
valueListenable: nss.notificationsUpdateStatus,
refreshFunction: () async => update(manager),
),
IconButton(
onPressed: () async => _clearAllNotifications(context, manager),
icon: const Icon(Icons.cleaning_services),
@ -52,11 +55,21 @@ class NotificationsScreen extends StatelessWidget {
update(manager);
return;
},
child: const Center(
child: Center(
child: Column(
children: [
Center(child: Text('No notifications')),
],
mainAxisAlignment: MainAxisAlignment.center,
children: nss.notificationsUpdateStatus.value
? [
const Center(child: Text('Loading Notifications')),
]
: [
const Center(child: Text('No notifications')),
const VerticalPadding(),
ElevatedButton(
onPressed: () => update(manager),
child: const Text('Load Notifications'),
)
],
)),
);
} else {
@ -131,7 +144,16 @@ class NotificationsScreen extends StatelessWidget {
actions: actions,
),
drawer: const StandardAppDrawer(),
body: body,
body: Center(
child: Column(
children: [
StandardLinearProgressIndicator(nss.notificationsUpdateStatus),
Expanded(
child: ResponsiveMaxWidth(child: body),
),
],
),
),
bottomNavigationBar: const AppBottomNavBar(
currentButton: NavBarButtons.notifications,
),