feat: 实现日历提醒 in-app fallback 机制及通知服务重构
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import '../../../../core/theme/design_tokens.dart';
|
||||
|
||||
class HomeKeyboardInsetCalculator {
|
||||
static double compute({
|
||||
required double rawViewInsetBottom,
|
||||
required double bottomViewPadding,
|
||||
}) {
|
||||
if (rawViewInsetBottom <= AppSpacing.xs) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
final adjustedInset = rawViewInsetBottom - bottomViewPadding;
|
||||
if (adjustedInset <= AppSpacing.xs) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return adjustedInset;
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@ import '../../../chat/presentation/bloc/agent_stage.dart';
|
||||
import '../../../chat/presentation/bloc/chat_bloc.dart';
|
||||
import '../../../messages/data/inbox_api.dart';
|
||||
import '../../data/voice_recorder.dart';
|
||||
import '../controllers/home_keyboard_inset_calculator.dart';
|
||||
import '../controllers/home_message_viewport_controller.dart';
|
||||
import '../controllers/home_viewport_coordinator.dart';
|
||||
import '../../../../shared/widgets/app_pull_refresh_feedback.dart';
|
||||
@@ -100,7 +101,6 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
double? _historyViewportMaxExtent;
|
||||
final GlobalKey<HomeInputHostState> _inputHostKey =
|
||||
GlobalKey<HomeInputHostState>();
|
||||
double _stableKeyboardInset = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@@ -541,16 +541,10 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
|
||||
double _effectiveKeyboardInset(BuildContext context) {
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
final rawInset = mediaQuery.viewInsets.bottom;
|
||||
if (rawInset <= AppSpacing.xs) {
|
||||
_stableKeyboardInset = 0;
|
||||
return 0;
|
||||
}
|
||||
// Only update stable if new value is larger (never decrease on jitter down)
|
||||
if (rawInset > _stableKeyboardInset) {
|
||||
_stableKeyboardInset = rawInset;
|
||||
}
|
||||
return _stableKeyboardInset;
|
||||
return HomeKeyboardInsetCalculator.compute(
|
||||
rawViewInsetBottom: mediaQuery.viewInsets.bottom,
|
||||
bottomViewPadding: mediaQuery.viewPadding.bottom,
|
||||
);
|
||||
}
|
||||
|
||||
void _dismissKeyboard() {
|
||||
|
||||
Reference in New Issue
Block a user