implemented a central haptic feedback system with configurable levels (off, reduced, full), added a Haptics facade providing semantic feedback methods, integrated haptic cues across navigation, settings toggles, and async action results, and updated version to 1.1.0+54
This commit is contained in:
@@ -10,6 +10,7 @@ import '../../state/app/modules/settings/bloc/settings_cubit.dart';
|
||||
import '../../storage/dev_tools_settings.dart';
|
||||
import '../../storage/settings.dart' as model;
|
||||
import '../../theming/light_app_theme.dart';
|
||||
import '../../utils/haptics.dart';
|
||||
import '../pages/settings/widgets/endpoint_picker.dart';
|
||||
import 'login_controller.dart';
|
||||
import 'widgets/login_branding.dart';
|
||||
@@ -40,6 +41,7 @@ class _LoginState extends State<Login> {
|
||||
}
|
||||
|
||||
void _onLoginSuccess() {
|
||||
Haptics.heavyAccent();
|
||||
context.read<AccountBloc>().setStatus(AccountStatus.loggedIn);
|
||||
// Re-register the periodic refresh (cancelAll runs on logout) and kick
|
||||
// off an immediate one-off so the widget populates within seconds
|
||||
|
||||
@@ -10,6 +10,7 @@ import '../../../../routing/app_routes.dart';
|
||||
import '../../../../share_intent/remote_file_ref.dart';
|
||||
import '../../../../utils/download_manager.dart';
|
||||
import '../../../../utils/file_clipboard.dart';
|
||||
import '../../../../utils/haptics.dart';
|
||||
import '../../../../widget/centered_leading.dart';
|
||||
import '../../../../widget/confirm_dialog.dart';
|
||||
import '../../../../widget/details_bottom_sheet.dart';
|
||||
@@ -83,6 +84,7 @@ class _FileElementState extends State<FileElement> {
|
||||
if (job == null) return;
|
||||
final status = job.status.value;
|
||||
if (status is DownloadDone) {
|
||||
Haptics.success();
|
||||
DownloadManager.instance.clear(widget.file.path);
|
||||
_detachJob();
|
||||
AppRoutes.openFileViewer(
|
||||
@@ -288,6 +290,7 @@ class _FileElementState extends State<FileElement> {
|
||||
}
|
||||
|
||||
void _showActionSheet() {
|
||||
Haptics.longPress();
|
||||
showDetailsBottomSheet(
|
||||
context,
|
||||
children: (sheetCtx) => [
|
||||
|
||||
@@ -6,6 +6,7 @@ import '../../../../state/app/modules/app_modules.dart';
|
||||
import '../../../../storage/dev_tools_settings.dart';
|
||||
import '../../../../storage/file_settings.dart';
|
||||
import '../../../../storage/file_view_settings.dart';
|
||||
import '../../../../storage/haptic_settings.dart';
|
||||
import '../../../../storage/holidays_settings.dart';
|
||||
import '../../../../storage/modules_settings.dart';
|
||||
import '../../../../storage/notification_settings.dart';
|
||||
@@ -65,5 +66,6 @@ class DefaultSettings {
|
||||
marianumConnectEndpoint: MarianumConnectEndpoint.live,
|
||||
marianumConnectCustomUrl: '',
|
||||
),
|
||||
hapticSettings: HapticSettings(level: HapticLevel.full),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import '../../../state/app/modules/app_modules.dart';
|
||||
import '../../../state/app/modules/settings/bloc/settings_cubit.dart';
|
||||
import '../../../storage/settings.dart' as model;
|
||||
import '../../../utils/haptics.dart';
|
||||
import '../../../widget/confirm_dialog.dart';
|
||||
import 'data/default_settings.dart';
|
||||
|
||||
@@ -23,6 +24,7 @@ class ModuleSortBody extends StatelessWidget {
|
||||
final modulesSettings = settings.val().modulesSettings;
|
||||
|
||||
void changeVisibility(Modules module) {
|
||||
Haptics.selection();
|
||||
var hidden = settings.val(write: true).modulesSettings.hiddenModules;
|
||||
if (hidden.contains(module)) {
|
||||
hidden.remove(module);
|
||||
@@ -48,9 +50,11 @@ class ModuleSortBody extends StatelessWidget {
|
||||
'Auf größeren Bildschirmen werden mehr Module direkt angezeigt',
|
||||
),
|
||||
value: modulesSettings.autoFillBottomBar,
|
||||
onChanged: (value) =>
|
||||
settings.val(write: true).modulesSettings.autoFillBottomBar =
|
||||
value,
|
||||
onChanged: (value) {
|
||||
Haptics.selection();
|
||||
settings.val(write: true).modulesSettings.autoFillBottomBar =
|
||||
value;
|
||||
},
|
||||
),
|
||||
if (!modulesSettings.autoFillBottomBar)
|
||||
ListTile(
|
||||
|
||||
@@ -2,7 +2,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../state/app/modules/settings/bloc/settings_cubit.dart';
|
||||
import '../../../../storage/haptic_settings.dart';
|
||||
import '../../../../theming/app_theme.dart';
|
||||
import '../../../../utils/haptics.dart';
|
||||
|
||||
class AppearanceSection extends StatelessWidget {
|
||||
const AppearanceSection({super.key});
|
||||
@@ -10,29 +12,83 @@ class AppearanceSection extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final settings = context.watch<SettingsCubit>();
|
||||
return ListTile(
|
||||
leading: const Icon(Icons.dark_mode_outlined),
|
||||
title: const Text('Farbgebung'),
|
||||
trailing: DropdownButton<ThemeMode>(
|
||||
value: settings.val().appTheme,
|
||||
icon: const Icon(Icons.arrow_drop_down),
|
||||
items: ThemeMode.values
|
||||
.map(
|
||||
(e) => DropdownMenuItem<ThemeMode>(
|
||||
value: e,
|
||||
enabled: e != settings.val().appTheme,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(AppTheme.getDisplayOptions(e).icon),
|
||||
const SizedBox(width: 10),
|
||||
Text(AppTheme.getDisplayOptions(e).displayName),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onChanged: (e) => settings.val(write: true).appTheme = e!,
|
||||
),
|
||||
return Column(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: const Icon(Icons.dark_mode_outlined),
|
||||
title: const Text('Farbgebung'),
|
||||
trailing: DropdownButton<ThemeMode>(
|
||||
value: settings.val().appTheme,
|
||||
icon: const Icon(Icons.arrow_drop_down),
|
||||
items: ThemeMode.values
|
||||
.map(
|
||||
(e) => DropdownMenuItem<ThemeMode>(
|
||||
value: e,
|
||||
enabled: e != settings.val().appTheme,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(AppTheme.getDisplayOptions(e).icon),
|
||||
const SizedBox(width: 10),
|
||||
Text(AppTheme.getDisplayOptions(e).displayName),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onChanged: (e) => settings.val(write: true).appTheme = e!,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.vibration_outlined),
|
||||
title: const Text('Haptisches Feedback'),
|
||||
trailing: DropdownButton<HapticLevel>(
|
||||
value: settings.val().hapticSettings.level,
|
||||
icon: const Icon(Icons.arrow_drop_down),
|
||||
items: HapticLevel.values
|
||||
.map(
|
||||
(e) => DropdownMenuItem<HapticLevel>(
|
||||
value: e,
|
||||
enabled: e != settings.val().hapticSettings.level,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(_hapticIcon(e)),
|
||||
const SizedBox(width: 10),
|
||||
Text(_hapticLabel(e)),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onChanged: (e) {
|
||||
settings.val(write: true).hapticSettings.level = e!;
|
||||
// Sofortiges Probe-Feedback in der neu gewählten Stufe.
|
||||
Haptics.longPress();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
IconData _hapticIcon(HapticLevel level) {
|
||||
switch (level) {
|
||||
case HapticLevel.off:
|
||||
return Icons.notifications_off_outlined;
|
||||
case HapticLevel.reduced:
|
||||
return Icons.notifications_paused_outlined;
|
||||
case HapticLevel.full:
|
||||
return Icons.notifications_active_outlined;
|
||||
}
|
||||
}
|
||||
|
||||
String _hapticLabel(HapticLevel level) {
|
||||
switch (level) {
|
||||
case HapticLevel.off:
|
||||
return 'Aus';
|
||||
case HapticLevel.reduced:
|
||||
return 'Reduziert';
|
||||
case HapticLevel.full:
|
||||
return 'Vollständig';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:hydrated_bloc/hydrated_bloc.dart';
|
||||
import '../../../../routing/app_routes.dart';
|
||||
import '../../../../state/app/modules/settings/bloc/settings_cubit.dart';
|
||||
import '../../../../storage/settings.dart' as model;
|
||||
import '../../../../utils/haptics.dart';
|
||||
import '../../../../widget/centered_leading.dart';
|
||||
import '../../../../widget/confirm_dialog.dart';
|
||||
import '../../../../widget/debug/cache_view.dart';
|
||||
@@ -45,12 +46,13 @@ class _DevToolsSectionState extends State<DevToolsSection> {
|
||||
title: const Text('Performance graph'),
|
||||
trailing: Checkbox(
|
||||
value: dev.showPerformanceOverlay,
|
||||
onChanged: (e) =>
|
||||
widget.settings
|
||||
.val(write: true)
|
||||
.devToolsSettings
|
||||
.showPerformanceOverlay =
|
||||
e!,
|
||||
onChanged: (e) {
|
||||
Haptics.selection();
|
||||
widget.settings
|
||||
.val(write: true)
|
||||
.devToolsSettings
|
||||
.showPerformanceOverlay = e!;
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
@@ -60,12 +62,13 @@ class _DevToolsSectionState extends State<DevToolsSection> {
|
||||
title: const Text('Indicate offscreen layers'),
|
||||
trailing: Checkbox(
|
||||
value: dev.checkerboardOffscreenLayers,
|
||||
onChanged: (e) =>
|
||||
widget.settings
|
||||
.val(write: true)
|
||||
.devToolsSettings
|
||||
.checkerboardOffscreenLayers =
|
||||
e!,
|
||||
onChanged: (e) {
|
||||
Haptics.selection();
|
||||
widget.settings
|
||||
.val(write: true)
|
||||
.devToolsSettings
|
||||
.checkerboardOffscreenLayers = e!;
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
@@ -73,12 +76,13 @@ class _DevToolsSectionState extends State<DevToolsSection> {
|
||||
title: const Text('Indicate raster cache images'),
|
||||
trailing: Checkbox(
|
||||
value: dev.checkerboardRasterCacheImages,
|
||||
onChanged: (e) =>
|
||||
widget.settings
|
||||
.val(write: true)
|
||||
.devToolsSettings
|
||||
.checkerboardRasterCacheImages =
|
||||
e!,
|
||||
onChanged: (e) {
|
||||
Haptics.selection();
|
||||
widget.settings
|
||||
.val(write: true)
|
||||
.devToolsSettings
|
||||
.checkerboardRasterCacheImages = e!;
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../state/app/modules/settings/bloc/settings_cubit.dart';
|
||||
import '../../../../utils/haptics.dart';
|
||||
|
||||
class FilesSection extends StatelessWidget {
|
||||
const FilesSection({super.key});
|
||||
@@ -16,8 +17,10 @@ class FilesSection extends StatelessWidget {
|
||||
title: const Text('Ordner in Dateien nach oben sortieren'),
|
||||
trailing: Checkbox(
|
||||
value: settings.val().fileSettings.sortFoldersToTop,
|
||||
onChanged: (e) =>
|
||||
settings.val(write: true).fileSettings.sortFoldersToTop = e!,
|
||||
onChanged: (e) {
|
||||
Haptics.selection();
|
||||
settings.val(write: true).fileSettings.sortFoldersToTop = e!;
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
@@ -25,12 +28,13 @@ class FilesSection extends StatelessWidget {
|
||||
title: const Text('Dateien immer mit Systemdialog öffnen'),
|
||||
trailing: Checkbox(
|
||||
value: settings.val().fileViewSettings.alwaysOpenExternally,
|
||||
onChanged: (e) =>
|
||||
settings
|
||||
.val(write: true)
|
||||
.fileViewSettings
|
||||
.alwaysOpenExternally =
|
||||
e!,
|
||||
onChanged: (e) {
|
||||
Haptics.selection();
|
||||
settings
|
||||
.val(write: true)
|
||||
.fileViewSettings
|
||||
.alwaysOpenExternally = e!;
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../notification/notify_updater.dart';
|
||||
import '../../../../state/app/modules/settings/bloc/settings_cubit.dart';
|
||||
import '../../../../utils/haptics.dart';
|
||||
import '../../../../widget/centered_leading.dart';
|
||||
import '../../../../widget/info_dialog.dart';
|
||||
|
||||
@@ -21,8 +22,10 @@ class TalkSection extends StatelessWidget {
|
||||
title: const Text('Favoriten im Talk nach oben sortieren'),
|
||||
trailing: Checkbox(
|
||||
value: talkSettings.sortFavoritesToTop,
|
||||
onChanged: (e) =>
|
||||
settings.val(write: true).talkSettings.sortFavoritesToTop = e!,
|
||||
onChanged: (e) {
|
||||
Haptics.selection();
|
||||
settings.val(write: true).talkSettings.sortFavoritesToTop = e!;
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
@@ -30,8 +33,10 @@ class TalkSection extends StatelessWidget {
|
||||
title: const Text('Ungelesene Chats nach oben sortieren'),
|
||||
trailing: Checkbox(
|
||||
value: talkSettings.sortUnreadToTop,
|
||||
onChanged: (e) =>
|
||||
settings.val(write: true).talkSettings.sortUnreadToTop = e!,
|
||||
onChanged: (e) {
|
||||
Haptics.selection();
|
||||
settings.val(write: true).talkSettings.sortUnreadToTop = e!;
|
||||
},
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
@@ -43,6 +48,7 @@ class TalkSection extends StatelessWidget {
|
||||
trailing: Checkbox(
|
||||
value: notificationSettings.enabled,
|
||||
onChanged: (e) {
|
||||
Haptics.selection();
|
||||
if (e!) {
|
||||
NotifyUpdater.enableAfterDisclaimer(settings).asDialog(context);
|
||||
} else {
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
import '../../../../state/app/modules/settings/bloc/settings_cubit.dart';
|
||||
import '../../../../utils/haptics.dart';
|
||||
import '../../../../view/pages/timetable/data/timetable_name_mode.dart';
|
||||
|
||||
class TimetableSection extends StatelessWidget {
|
||||
@@ -46,12 +47,13 @@ class TimetableSection extends StatelessWidget {
|
||||
title: const Text('Doppelstunden zusammenhängend anzeigen'),
|
||||
trailing: Checkbox(
|
||||
value: timetableSettings.connectDoubleLessons,
|
||||
onChanged: (e) =>
|
||||
settings
|
||||
.val(write: true)
|
||||
.timetableSettings
|
||||
.connectDoubleLessons =
|
||||
e!,
|
||||
onChanged: (e) {
|
||||
Haptics.selection();
|
||||
settings
|
||||
.val(write: true)
|
||||
.timetableSettings
|
||||
.connectDoubleLessons = e!;
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
@@ -9,6 +9,7 @@ import '../../../../routing/app_routes.dart';
|
||||
import '../../../../share_intent/remote_file_ref.dart';
|
||||
import '../../../../state/app/modules/chat/bloc/chat_bloc.dart';
|
||||
import '../../../../utils/download_manager.dart';
|
||||
import '../../../../utils/haptics.dart';
|
||||
import '../../../../widget/confirm_dialog.dart';
|
||||
import '../../../../widget/info_dialog.dart';
|
||||
import '../data/chat_bubble_styles.dart';
|
||||
@@ -63,6 +64,7 @@ class _ChatBubbleState extends State<ChatBubble>
|
||||
|
||||
Offset _position = Offset.zero;
|
||||
Offset _dragStartPosition = Offset.zero;
|
||||
bool _swipeActionArmed = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -97,6 +99,7 @@ class _ChatBubbleState extends State<ChatBubble>
|
||||
if (job == null) return;
|
||||
final status = job.status.value;
|
||||
if (status is DownloadDone) {
|
||||
Haptics.success();
|
||||
DownloadManager.instance.clear(job.remotePath);
|
||||
_detachJob();
|
||||
final talkFile = message.file;
|
||||
@@ -197,13 +200,16 @@ class _ChatBubbleState extends State<ChatBubble>
|
||||
}
|
||||
}
|
||||
|
||||
void _showOptionsDialog() => showChatMessageOptionsDialog(
|
||||
context,
|
||||
chatData: widget.chatData,
|
||||
bubbleData: widget.bubbleData,
|
||||
isSender: widget.isSender,
|
||||
onRefetch: widget.refetch,
|
||||
);
|
||||
void _showOptionsDialog() {
|
||||
Haptics.longPress();
|
||||
showChatMessageOptionsDialog(
|
||||
context,
|
||||
chatData: widget.chatData,
|
||||
bubbleData: widget.bubbleData,
|
||||
isSender: widget.isSender,
|
||||
onRefetch: widget.refetch,
|
||||
);
|
||||
}
|
||||
|
||||
/// True only for messages whose body has a meaningful tap action (poll
|
||||
/// dialog or file download/cancel). For plain text messages we leave
|
||||
@@ -302,10 +308,16 @@ class _ChatBubbleState extends State<ChatBubble>
|
||||
? Offset(_position.dx, 0)
|
||||
: Offset(_position.dx + dx, 0);
|
||||
});
|
||||
// Beim Überqueren der Action-Schwelle einmalig Haptik feuern,
|
||||
// damit der User physisch spürt: "jetzt löst's beim Loslassen aus".
|
||||
final isArmed = _position.dx.abs() > 50;
|
||||
if (isArmed && !_swipeActionArmed) Haptics.longPress();
|
||||
_swipeActionArmed = isArmed;
|
||||
},
|
||||
onHorizontalDragEnd: (_) {
|
||||
final isAction = _position.dx.abs() > 50;
|
||||
setState(() => _position = Offset.zero);
|
||||
_swipeActionArmed = false;
|
||||
if (widget.bubbleData.isReplyable && isAction) {
|
||||
context.read<ChatBloc>().setReferenceMessageId(
|
||||
widget.bubbleData.id,
|
||||
|
||||
@@ -13,6 +13,7 @@ import '../../../../notification/notification_tasks.dart';
|
||||
import '../../../../routing/app_routes.dart';
|
||||
import '../../../../state/app/modules/chat/bloc/chat_bloc.dart';
|
||||
import '../../../../state/app/modules/chat_list/bloc/chat_list_bloc.dart';
|
||||
import '../../../../utils/haptics.dart';
|
||||
import '../../../../widget/async_action_button.dart';
|
||||
import '../../../../widget/confirm_dialog.dart';
|
||||
import '../../../../widget/debug/debug_tile.dart';
|
||||
@@ -166,6 +167,7 @@ class _ChatTileState extends State<ChatTile> {
|
||||
},
|
||||
onLongPress: () {
|
||||
if (widget.disableContextActions) return;
|
||||
Haptics.longPress();
|
||||
showDetailsBottomSheet(
|
||||
context,
|
||||
children: (sheetCtx) => [
|
||||
|
||||
@@ -242,7 +242,7 @@ class _DayColumn extends StatelessWidget {
|
||||
);
|
||||
if (_overlapsExistingAppointment(start, end, dayAppts)) return;
|
||||
|
||||
HapticFeedback.mediumImpact();
|
||||
Haptics.longPress();
|
||||
onCreateEvent!(start, end);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:syncfusion_flutter_calendar/calendar.dart';
|
||||
|
||||
import '../../../../extensions/date_time.dart';
|
||||
import '../../../../utils/haptics.dart';
|
||||
import '../../../../widget/details_bottom_sheet.dart';
|
||||
import '../data/calendar_layout.dart';
|
||||
import '../data/calendar_logic.dart';
|
||||
|
||||
Reference in New Issue
Block a user