- 后端用药提醒改为按次粒度(每个服药时间独立判断) - 新增 per-dose 打卡/取消打卡 API - 新增 MedicationCheckInPage 独立打卡页(每药每时间单独toggle) - 用药列表删底部弹窗(编辑/停药),点药品直接进该药打卡页 - 任务区用药汇总为一行(过期待服已服) - 支持隔天(EveryOtherDay)/每周频率判断 - 删历史对话功能(ConversationItem + conversationListProvider + UI)
51 lines
1.4 KiB
Dart
51 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'core/app_router.dart';
|
|
import 'core/app_theme.dart';
|
|
import 'core/navigation_provider.dart';
|
|
|
|
/// 健康管家 App 根组件
|
|
class HealthApp extends ConsumerWidget {
|
|
const HealthApp({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
return MaterialApp(
|
|
title: '健康管家',
|
|
debugShowCheckedModeBanner: false,
|
|
theme: AppTheme.lightTheme,
|
|
localizationsDelegates: const [
|
|
GlobalMaterialLocalizations.delegate,
|
|
GlobalWidgetsLocalizations.delegate,
|
|
GlobalCupertinoLocalizations.delegate,
|
|
],
|
|
supportedLocales: const [
|
|
Locale('zh', 'CN'),
|
|
Locale('zh'),
|
|
],
|
|
locale: const Locale('zh'),
|
|
home: const _RootNavigator(),
|
|
);
|
|
}
|
|
}
|
|
|
|
/// 根导航——根据 Riverpod 路由状态切换页面
|
|
class _RootNavigator extends ConsumerWidget {
|
|
const _RootNavigator();
|
|
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
final stack = ref.watch(routeStackProvider);
|
|
final current = stack.last;
|
|
|
|
return PopScope(
|
|
canPop: stack.length <= 1,
|
|
onPopInvokedWithResult: (didPop, result) {
|
|
if (!didPop) popRoute(ref);
|
|
},
|
|
child: buildPage(current),
|
|
);
|
|
}
|
|
}
|