feat: 长辈模式(大字大按钮 + 偏好按账号隔离)+ 语音输入(按住说话 + 实时转写 + 后端代理 DashScope ASR + 患者端专用)+ 健康仪表盘背景渐变
This commit is contained in:
@@ -7,11 +7,15 @@ import 'package:file_picker/file_picker.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
import '../../core/app_colors.dart';
|
||||
import '../../core/app_design_tokens.dart';
|
||||
import '../../core/elder_mode_scope.dart';
|
||||
import '../../core/app_module_visuals.dart';
|
||||
import '../../core/navigation_provider.dart';
|
||||
import '../../providers/auth_provider.dart';
|
||||
import '../../providers/chat_provider.dart';
|
||||
import '../../providers/data_providers.dart';
|
||||
import '../../providers/elder_mode_provider.dart';
|
||||
import '../../services/realtime_speech_service.dart';
|
||||
import '../../widgets/app_toast.dart';
|
||||
import '../../widgets/health_drawer.dart';
|
||||
import '../../widgets/keyboard_lift.dart';
|
||||
import '../diet/diet_capture_page.dart';
|
||||
@@ -32,6 +36,15 @@ class _HomePageState extends ConsumerState<HomePage>
|
||||
String? _pickedImagePath;
|
||||
Timer? _notificationTimer;
|
||||
double _conversationDragDistance = 0;
|
||||
bool _voiceMode = false;
|
||||
_SpeechPhase _speechPhase = _SpeechPhase.idle;
|
||||
RealtimeSpeechSession? _speechSession;
|
||||
StreamSubscription<SpeechRecognitionEvent>? _speechEventSubscription;
|
||||
String _speechText = '';
|
||||
bool _voicePressActive = false;
|
||||
bool _cancelVoiceOnRelease = false;
|
||||
bool _finishVoiceWhenReady = false;
|
||||
double? _voicePressStartY;
|
||||
|
||||
void _startConversationDrawerDrag(DragStartDetails details) {
|
||||
_conversationDragDistance = 0;
|
||||
@@ -55,6 +68,8 @@ class _HomePageState extends ConsumerState<HomePage>
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
final elderPreferences = ref.read(elderModeProvider).preferences;
|
||||
_voiceMode = elderPreferences.enabled && elderPreferences.voiceInputEnabled;
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
_scheduleScrollToLatest();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
@@ -72,6 +87,10 @@ class _HomePageState extends ConsumerState<HomePage>
|
||||
if (state == AppLifecycleState.resumed) {
|
||||
_checkDueNotifications();
|
||||
}
|
||||
if (state == AppLifecycleState.paused &&
|
||||
_speechPhase != _SpeechPhase.idle) {
|
||||
unawaited(_cancelVoiceRecording());
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -81,6 +100,8 @@ class _HomePageState extends ConsumerState<HomePage>
|
||||
_textCtrl.dispose();
|
||||
_scrollCtrl.dispose();
|
||||
_focusNode.dispose();
|
||||
unawaited(_speechEventSubscription?.cancel());
|
||||
unawaited(_speechSession?.cancel());
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -124,6 +145,19 @@ class _HomePageState extends ConsumerState<HomePage>
|
||||
final auth = ref.watch(authProvider);
|
||||
final user = auth.user;
|
||||
|
||||
ref.listen<bool>(
|
||||
elderModeProvider.select(
|
||||
(state) => state.isEnabled && state.preferences.voiceInputEnabled,
|
||||
),
|
||||
(previous, current) {
|
||||
if (previous == current || !mounted) return;
|
||||
if (_speechPhase != _SpeechPhase.idle) {
|
||||
unawaited(_cancelVoiceRecording());
|
||||
}
|
||||
setState(() => _voiceMode = current);
|
||||
},
|
||||
);
|
||||
|
||||
ref.listen(cameraActionProvider, (prev, next) {
|
||||
if (next == 'camera') {
|
||||
_pickImage(ImageSource.camera);
|
||||
@@ -202,12 +236,13 @@ class _HomePageState extends ConsumerState<HomePage>
|
||||
}
|
||||
|
||||
Widget _buildHeader(dynamic user) {
|
||||
final elderMode = ElderModeScope.enabledOf(context);
|
||||
final name = (user?.name != null && user!.name!.isNotEmpty)
|
||||
? user.name
|
||||
: '用户';
|
||||
final unreadCount = ref.watch(notificationUnreadCountProvider).value ?? 0;
|
||||
return Container(
|
||||
padding: const EdgeInsets.fromLTRB(14, 8, 14, 6),
|
||||
padding: EdgeInsets.fromLTRB(14, elderMode ? 10 : 8, 14, 6),
|
||||
child: Row(
|
||||
children: [
|
||||
Builder(
|
||||
@@ -234,8 +269,8 @@ class _HomePageState extends ConsumerState<HomePage>
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
'${_getGreeting()},$name',
|
||||
style: const TextStyle(
|
||||
fontSize: 18,
|
||||
style: TextStyle(
|
||||
fontSize: elderMode ? 20 : 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
@@ -271,11 +306,12 @@ class _HomePageState extends ConsumerState<HomePage>
|
||||
];
|
||||
|
||||
Widget _buildAgentBar() {
|
||||
final elderMode = ElderModeScope.enabledOf(context);
|
||||
final activeAgent = ref.watch(
|
||||
chatProvider.select((state) => state.activeAgent),
|
||||
);
|
||||
return SizedBox(
|
||||
height: 46,
|
||||
height: elderMode ? 58 : 46,
|
||||
child: ListView.separated(
|
||||
scrollDirection: Axis.horizontal,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 2),
|
||||
@@ -297,9 +333,9 @@ class _HomePageState extends ConsumerState<HomePage>
|
||||
),
|
||||
padding: const EdgeInsets.all(1.2),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 11.8,
|
||||
vertical: 7.8,
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: elderMode ? 15 : 11.8,
|
||||
vertical: elderMode ? 10 : 7.8,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
@@ -309,23 +345,23 @@ class _HomePageState extends ConsumerState<HomePage>
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
width: 18,
|
||||
height: 18,
|
||||
width: elderMode ? 24 : 18,
|
||||
height: elderMode ? 24 : 18,
|
||||
decoration: BoxDecoration(
|
||||
gradient: visual.gradient,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Icon(
|
||||
visual.icon,
|
||||
size: 13,
|
||||
size: elderMode ? 17 : 13,
|
||||
color: visual.iconColor,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Text(
|
||||
visual.label,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
style: TextStyle(
|
||||
fontSize: elderMode ? 17 : 15,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
@@ -438,98 +474,315 @@ class _HomePageState extends ConsumerState<HomePage>
|
||||
}
|
||||
|
||||
Widget _buildInputBar() {
|
||||
final elderMode = ElderModeScope.enabledOf(context);
|
||||
final isStreaming = ref.watch(
|
||||
chatProvider.select((state) => state.isStreaming),
|
||||
);
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(12, 0, 12, 10),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.fromLTRB(6, 5, 6, 5),
|
||||
padding: EdgeInsets.fromLTRB(
|
||||
6,
|
||||
elderMode ? 7 : 5,
|
||||
6,
|
||||
elderMode ? 7 : 5,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: AppRadius.pillBorder,
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
customBorder: const CircleBorder(),
|
||||
onTap: () => _showAttachmentPicker(context),
|
||||
child: Ink(
|
||||
width: 38,
|
||||
height: 38,
|
||||
decoration: const BoxDecoration(
|
||||
gradient: AppColors.primaryGradient,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: const Icon(
|
||||
LucideIcons.plus,
|
||||
size: 21,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxHeight: 112),
|
||||
child: TextField(
|
||||
controller: _textCtrl,
|
||||
focusNode: _focusNode,
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
maxLines: null,
|
||||
textInputAction: TextInputAction.newline,
|
||||
decoration: const InputDecoration(
|
||||
hintText: '输入你想说的...',
|
||||
filled: false,
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: 4,
|
||||
vertical: 12,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
),
|
||||
onSubmitted: (_) => _sendMessage(),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
customBorder: const CircleBorder(),
|
||||
onTap: isStreaming
|
||||
? () => ref.read(chatProvider.notifier).stopGenerating()
|
||||
: _sendMessage,
|
||||
child: Ink(
|
||||
width: 38,
|
||||
height: 38,
|
||||
decoration: const BoxDecoration(
|
||||
gradient: AppColors.primaryGradient,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
isStreaming ? Icons.stop_rounded : LucideIcons.send,
|
||||
size: 18,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
children: _voiceMode
|
||||
? _buildVoiceInputContents(elderMode, isStreaming)
|
||||
: _buildTextInputContents(elderMode, isStreaming),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> _buildTextInputContents(bool elderMode, bool isStreaming) {
|
||||
return [
|
||||
_InputCircleButton(
|
||||
icon: LucideIcons.plus,
|
||||
elderMode: elderMode,
|
||||
gradient: AppColors.primaryGradient,
|
||||
iconColor: Colors.white,
|
||||
onTap: () => _showAttachmentPicker(context),
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxHeight: 112),
|
||||
child: TextField(
|
||||
controller: _textCtrl,
|
||||
focusNode: _focusNode,
|
||||
style: TextStyle(
|
||||
fontSize: elderMode ? 18 : 15,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
maxLines: null,
|
||||
textInputAction: TextInputAction.newline,
|
||||
decoration: InputDecoration(
|
||||
hintText: '输入你想说的...',
|
||||
filled: false,
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.symmetric(
|
||||
horizontal: 4,
|
||||
vertical: elderMode ? 15 : 12,
|
||||
),
|
||||
border: InputBorder.none,
|
||||
enabledBorder: InputBorder.none,
|
||||
focusedBorder: InputBorder.none,
|
||||
),
|
||||
onSubmitted: (_) => _sendMessage(),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
_InputCircleButton(
|
||||
icon: LucideIcons.mic,
|
||||
elderMode: elderMode,
|
||||
gradient: AppColors.primaryGradient,
|
||||
iconColor: Colors.white,
|
||||
onTap: isStreaming ? null : _switchToVoiceMode,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
_InputCircleButton(
|
||||
icon: isStreaming ? Icons.stop_rounded : LucideIcons.send,
|
||||
elderMode: elderMode,
|
||||
gradient: AppColors.primaryGradient,
|
||||
iconColor: Colors.white,
|
||||
onTap: isStreaming
|
||||
? () => ref.read(chatProvider.notifier).stopGenerating()
|
||||
: _sendMessage,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
List<Widget> _buildVoiceInputContents(bool elderMode, bool isStreaming) {
|
||||
return [
|
||||
_InputCircleButton(
|
||||
icon: LucideIcons.plus,
|
||||
elderMode: elderMode,
|
||||
gradient: AppColors.primaryGradient,
|
||||
iconColor: Colors.white,
|
||||
onTap: _speechPhase == _SpeechPhase.idle
|
||||
? () => _showAttachmentPicker(context)
|
||||
: null,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: isStreaming
|
||||
? InkWell(
|
||||
onTap: () => ref.read(chatProvider.notifier).stopGenerating(),
|
||||
borderRadius: AppRadius.pillBorder,
|
||||
child: _VoiceHoldSurface(
|
||||
elderMode: elderMode,
|
||||
label: '停止生成',
|
||||
color: AppColors.primary,
|
||||
),
|
||||
)
|
||||
: Listener(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onPointerDown: _onVoicePointerDown,
|
||||
onPointerMove: _onVoicePointerMove,
|
||||
onPointerUp: _onVoicePointerUp,
|
||||
onPointerCancel: _onVoicePointerCancel,
|
||||
child: _VoiceHoldSurface(
|
||||
elderMode: elderMode,
|
||||
label: _voiceInputLabel,
|
||||
color: _voiceLabelColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
_InputCircleButton(
|
||||
icon: LucideIcons.keyboard,
|
||||
elderMode: elderMode,
|
||||
gradient: AppColors.primaryGradient,
|
||||
iconColor: Colors.white,
|
||||
onTap: _speechPhase == _SpeechPhase.idle ? _switchToTextMode : null,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
String get _voiceInputLabel {
|
||||
if (_cancelVoiceOnRelease) return '松开取消';
|
||||
return switch (_speechPhase) {
|
||||
_SpeechPhase.connecting => '正在连接…',
|
||||
_SpeechPhase.listening =>
|
||||
_speechText.trim().isEmpty ? '松开发送' : _speechText.trim(),
|
||||
_SpeechPhase.finishing => '正在识别…',
|
||||
_SpeechPhase.idle => '按住说话',
|
||||
};
|
||||
}
|
||||
|
||||
Color get _voiceLabelColor {
|
||||
if (_cancelVoiceOnRelease) return AppColors.error;
|
||||
if (_speechPhase == _SpeechPhase.listening ||
|
||||
_speechPhase == _SpeechPhase.connecting ||
|
||||
_speechPhase == _SpeechPhase.finishing) {
|
||||
return AppColors.primary;
|
||||
}
|
||||
return AppColors.textSecondary;
|
||||
}
|
||||
|
||||
Future<void> _switchToVoiceMode() async {
|
||||
_dismissKeyboard();
|
||||
final allowed = await ref
|
||||
.read(realtimeSpeechServiceProvider)
|
||||
.requestPermission();
|
||||
if (!mounted) return;
|
||||
if (!allowed) {
|
||||
AppToast.show(context, '需要麦克风权限才能使用语音输入', type: AppToastType.error);
|
||||
return;
|
||||
}
|
||||
setState(() => _voiceMode = true);
|
||||
}
|
||||
|
||||
void _switchToTextMode() {
|
||||
if (_speechPhase != _SpeechPhase.idle) return;
|
||||
setState(() => _voiceMode = false);
|
||||
}
|
||||
|
||||
void _onVoicePointerDown(PointerDownEvent event) {
|
||||
if (_speechPhase != _SpeechPhase.idle) return;
|
||||
_voicePressActive = true;
|
||||
_cancelVoiceOnRelease = false;
|
||||
_finishVoiceWhenReady = false;
|
||||
_voicePressStartY = event.position.dy;
|
||||
unawaited(_startVoiceRecording());
|
||||
}
|
||||
|
||||
void _onVoicePointerMove(PointerMoveEvent event) {
|
||||
if (!_voicePressActive || _voicePressStartY == null) return;
|
||||
final shouldCancel = _voicePressStartY! - event.position.dy >= 60;
|
||||
if (shouldCancel != _cancelVoiceOnRelease && mounted) {
|
||||
setState(() => _cancelVoiceOnRelease = shouldCancel);
|
||||
}
|
||||
}
|
||||
|
||||
void _onVoicePointerUp(PointerUpEvent event) {
|
||||
if (!_voicePressActive) return;
|
||||
_voicePressActive = false;
|
||||
if (_speechPhase == _SpeechPhase.connecting) {
|
||||
_finishVoiceWhenReady = true;
|
||||
return;
|
||||
}
|
||||
if (_cancelVoiceOnRelease) {
|
||||
unawaited(_cancelVoiceRecording());
|
||||
} else if (_speechPhase == _SpeechPhase.listening) {
|
||||
unawaited(_finishVoiceRecording());
|
||||
}
|
||||
}
|
||||
|
||||
void _onVoicePointerCancel(PointerCancelEvent event) {
|
||||
if (!_voicePressActive) return;
|
||||
_voicePressActive = false;
|
||||
_cancelVoiceOnRelease = true;
|
||||
unawaited(_cancelVoiceRecording());
|
||||
}
|
||||
|
||||
Future<void> _startVoiceRecording() async {
|
||||
setState(() {
|
||||
_speechPhase = _SpeechPhase.connecting;
|
||||
_speechText = '';
|
||||
});
|
||||
try {
|
||||
final session = await ref.read(realtimeSpeechServiceProvider).start();
|
||||
if (!mounted) {
|
||||
await session.cancel();
|
||||
return;
|
||||
}
|
||||
_speechSession = session;
|
||||
_speechEventSubscription = session.events.listen((event) {
|
||||
if (!mounted) return;
|
||||
if (event.type == SpeechRecognitionEventType.error) {
|
||||
_handleSpeechFailure(event.text);
|
||||
return;
|
||||
}
|
||||
setState(() => _speechText = event.text);
|
||||
});
|
||||
setState(() => _speechPhase = _SpeechPhase.listening);
|
||||
if (_finishVoiceWhenReady || !_voicePressActive) {
|
||||
if (_cancelVoiceOnRelease) {
|
||||
await _cancelVoiceRecording();
|
||||
} else {
|
||||
await _finishVoiceRecording();
|
||||
}
|
||||
}
|
||||
} on SpeechRecognitionException catch (error) {
|
||||
_handleSpeechFailure(error.message);
|
||||
} catch (_) {
|
||||
_handleSpeechFailure('语音输入启动失败,请稍后重试');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _finishVoiceRecording() async {
|
||||
final session = _speechSession;
|
||||
if (session == null || _speechPhase == _SpeechPhase.finishing) return;
|
||||
setState(() => _speechPhase = _SpeechPhase.finishing);
|
||||
try {
|
||||
final text = (await session.finish()).trim();
|
||||
if (!mounted) return;
|
||||
await _releaseSpeechSession();
|
||||
if (!mounted) return;
|
||||
_resetSpeechState();
|
||||
if (text.isEmpty) {
|
||||
AppToast.show(context, '没有听清,请再说一次');
|
||||
return;
|
||||
}
|
||||
_textCtrl.text = text;
|
||||
_sendMessage();
|
||||
} on SpeechRecognitionException catch (error) {
|
||||
_handleSpeechFailure(error.message);
|
||||
} catch (_) {
|
||||
_handleSpeechFailure('语音识别失败,请重试');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _cancelVoiceRecording() async {
|
||||
try {
|
||||
await _speechSession?.cancel();
|
||||
} finally {
|
||||
await _releaseSpeechSession();
|
||||
if (mounted) _resetSpeechState();
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _releaseSpeechSession() async {
|
||||
await _speechEventSubscription?.cancel();
|
||||
_speechEventSubscription = null;
|
||||
await _speechSession?.dispose();
|
||||
_speechSession = null;
|
||||
}
|
||||
|
||||
void _handleSpeechFailure(String message) {
|
||||
if (_speechPhase == _SpeechPhase.idle) return;
|
||||
final partialText = _speechText.trim();
|
||||
unawaited(_releaseSpeechSession());
|
||||
if (!mounted) return;
|
||||
_resetSpeechState();
|
||||
if (partialText.isNotEmpty) {
|
||||
_textCtrl.text = partialText;
|
||||
setState(() => _voiceMode = false);
|
||||
}
|
||||
AppToast.show(context, message, type: AppToastType.error);
|
||||
}
|
||||
|
||||
void _resetSpeechState() {
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_speechPhase = _SpeechPhase.idle;
|
||||
_speechText = '';
|
||||
_voicePressActive = false;
|
||||
_cancelVoiceOnRelease = false;
|
||||
_finishVoiceWhenReady = false;
|
||||
_voicePressStartY = null;
|
||||
});
|
||||
}
|
||||
|
||||
void _showAttachmentPicker(BuildContext context) {
|
||||
_dismissKeyboard();
|
||||
showModalBottomSheet(
|
||||
@@ -649,6 +902,82 @@ class _HomePageState extends ConsumerState<HomePage>
|
||||
}
|
||||
}
|
||||
|
||||
enum _SpeechPhase { idle, connecting, listening, finishing }
|
||||
|
||||
class _InputCircleButton extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final bool elderMode;
|
||||
final Gradient? gradient;
|
||||
final Color iconColor;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
const _InputCircleButton({
|
||||
required this.icon,
|
||||
required this.elderMode,
|
||||
this.gradient,
|
||||
required this.iconColor,
|
||||
required this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final size = elderMode ? 52.0 : 38.0;
|
||||
return Opacity(
|
||||
opacity: onTap == null ? 0.45 : 1,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: InkWell(
|
||||
customBorder: const CircleBorder(),
|
||||
onTap: onTap,
|
||||
child: Ink(
|
||||
width: size,
|
||||
height: size,
|
||||
decoration: BoxDecoration(
|
||||
gradient: gradient,
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(icon, size: elderMode ? 25 : 20, color: iconColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _VoiceHoldSurface extends StatelessWidget {
|
||||
final bool elderMode;
|
||||
final String label;
|
||||
final Color color;
|
||||
|
||||
const _VoiceHoldSurface({
|
||||
required this.elderMode,
|
||||
required this.label,
|
||||
required this.color,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 4,
|
||||
vertical: elderMode ? 14 : 11,
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
label,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: elderMode ? 20 : 17,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: color,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _HomeMessages extends ConsumerWidget {
|
||||
final ScrollController scrollCtrl;
|
||||
|
||||
@@ -673,21 +1002,26 @@ class _HeaderIconButton extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final elderMode = ElderModeScope.enabledOf(context);
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
Container(
|
||||
width: 44,
|
||||
height: 44,
|
||||
width: elderMode ? 54 : 44,
|
||||
height: elderMode ? 54 : 44,
|
||||
decoration: BoxDecoration(
|
||||
gradient: AppColors.surfaceGradient,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
border: Border.all(color: AppColors.borderLight),
|
||||
boxShadow: AppColors.cardShadowLight,
|
||||
),
|
||||
child: Icon(icon, size: 20, color: AppColors.textPrimary),
|
||||
child: Icon(
|
||||
icon,
|
||||
size: elderMode ? 27 : 20,
|
||||
color: AppColors.textPrimary,
|
||||
),
|
||||
),
|
||||
if (badgeCount > 0)
|
||||
Positioned(
|
||||
|
||||
Reference in New Issue
Block a user