implemented the Ticker module with a native ProseMirror document renderer and integrated API support for structured content, navigation trees, and proxied files
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../theming/app_theme.dart';
|
||||
import 'pm_document_view.dart';
|
||||
import 'pm_node.dart';
|
||||
|
||||
/// Accent color + leading icon per callout variant, mirroring the web renderer.
|
||||
class _CalloutStyle {
|
||||
final Color accent;
|
||||
final IconData icon;
|
||||
|
||||
const _CalloutStyle(this.accent, this.icon);
|
||||
}
|
||||
|
||||
const _calloutStyles = <PmCalloutVariant, _CalloutStyle>{
|
||||
PmCalloutVariant.info: _CalloutStyle(Color(0xFF2563EB), Icons.info_outline),
|
||||
PmCalloutVariant.tip: _CalloutStyle(
|
||||
Color(0xFFA16207),
|
||||
Icons.lightbulb_outline,
|
||||
),
|
||||
PmCalloutVariant.success: _CalloutStyle(
|
||||
Color(0xFF16A34A),
|
||||
Icons.check_circle_outline,
|
||||
),
|
||||
PmCalloutVariant.warning: _CalloutStyle(
|
||||
Color(0xFFEA580C),
|
||||
Icons.warning_amber_outlined,
|
||||
),
|
||||
PmCalloutVariant.important: _CalloutStyle(
|
||||
Color(0xFFB91C1C),
|
||||
Icons.priority_high,
|
||||
),
|
||||
};
|
||||
|
||||
class PmCalloutView extends StatelessWidget {
|
||||
final PmCallout node;
|
||||
|
||||
const PmCalloutView({required this.node, super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final style = _calloutStyles[node.variant] ?? _calloutStyles.values.first;
|
||||
return DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: style.accent.withValues(alpha: 0.09),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border(left: BorderSide(color: style.accent, width: 4)),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(AppSpacing.md),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Icon(style.icon, color: style.accent, size: 20),
|
||||
const SizedBox(width: AppSpacing.sm),
|
||||
Expanded(child: pmBlocks(node.children)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user