mirror of
https://gitlab.com/mysocialportal/relatica
synced 2024-10-18 11:13:31 +00:00
Merge branch 'notifications-refresh-refactor' into 'main'
Notifications refresh refactoring See merge request mysocialportal/relatica!51
This commit is contained in:
commit
e1781bd468
2 changed files with 37 additions and 11 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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,
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue