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(); 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; const usePhpDebugging = false;

Wyświetl plik

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