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:
+11
-1
@@ -23,6 +23,7 @@ import 'state/app/modules/timetable/bloc/timetable_bloc.dart';
|
||||
import 'state/app/modules/timetable/bloc/timetable_state.dart';
|
||||
import 'storage/settings.dart' as model;
|
||||
import 'utils/debouncer.dart';
|
||||
import 'utils/haptics.dart';
|
||||
import 'view/pages/overhang.dart';
|
||||
import 'widget/breaker/breaker.dart';
|
||||
import 'widget_data/widget_navigation.dart';
|
||||
@@ -42,13 +43,19 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
||||
StreamSubscription<RemoteMessage>? _onMessageOpenedAppSub;
|
||||
StreamSubscription<String>? _fcmTokenRefreshSub;
|
||||
int _knownTotalTabs = 1;
|
||||
int _lastTabIndex = 0;
|
||||
bool _userOnLastTab = false;
|
||||
|
||||
static const Duration _chatListActiveInterval = Duration(seconds: 15);
|
||||
static const Duration _chatListIdleInterval = Duration(seconds: 60);
|
||||
|
||||
void _onTabControllerChanged() {
|
||||
_userOnLastTab = Main.bottomNavigator.index == _knownTotalTabs - 1;
|
||||
final newIndex = Main.bottomNavigator.index;
|
||||
if (newIndex != _lastTabIndex) {
|
||||
Haptics.selection();
|
||||
_lastTabIndex = newIndex;
|
||||
}
|
||||
_userOnLastTab = newIndex == _knownTotalTabs - 1;
|
||||
_syncChatListPolling();
|
||||
}
|
||||
|
||||
@@ -107,7 +114,9 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
Haptics.bind(context.read<SettingsCubit>());
|
||||
Main.bottomNavigator = PersistentTabController(initialIndex: 0);
|
||||
_lastTabIndex = Main.bottomNavigator.index;
|
||||
Main.bottomNavigator.addListener(_onTabControllerChanged);
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
|
||||
@@ -230,6 +239,7 @@ class _AppState extends State<App> with WidgetsBindingObserver {
|
||||
Main.bottomNavigator = PersistentTabController(
|
||||
initialIndex: targetIndex,
|
||||
);
|
||||
_lastTabIndex = targetIndex;
|
||||
Main.bottomNavigator.addListener(_onTabControllerChanged);
|
||||
_userOnLastTab = targetIndex == totalTabs - 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user