Files
App/lib/widgets/thought/token_info.dart
2025-10-27 01:08:42 +08:00

50 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:material_symbols_icons/material_symbols_icons.dart';
import 'package:island/models/thought.dart';
class TokenInfo extends StatelessWidget {
const TokenInfo({super.key, required this.thought});
final SnThinkingThought thought;
@override
Widget build(BuildContext context) {
if (thought.tokenCount == null && thought.modelName == null) {
return const SizedBox.shrink();
}
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Gap(8),
Row(
children: [
if (thought.modelName != null) ...[
const Icon(Symbols.neurology, size: 16),
const Gap(4),
Text(
'${thought.modelName}',
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
const Gap(16),
],
if (thought.tokenCount != null) ...[
const Icon(Symbols.token, size: 16),
const Gap(4),
Text(
'${thought.tokenCount} tokens',
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
],
],
),
],
);
}
}