- Add NewsTickerWidget with horizontal auto-scrolling at 40px/sec - Add NewsData and NewsHeadline Freezed models - Add news datasource fetching from /tools/news endpoint - Add news provider with 30-minute auto-refresh - Place ticker between Welcome card and System Stats on dashboard - Show placeholder headlines when no data (italic, muted style) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
35 lines
884 B
Dart
35 lines
884 B
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
part 'news_model.freezed.dart';
|
|
part 'news_model.g.dart';
|
|
|
|
/// News response from Core API.
|
|
/// Contains headlines for the news ticker.
|
|
@freezed
|
|
sealed class NewsData with _$NewsData {
|
|
const factory NewsData({
|
|
required List<NewsHeadline> headlines,
|
|
String? category,
|
|
List<String>? sources,
|
|
@JsonKey(name: 'updated_at') required DateTime updatedAt,
|
|
String? user,
|
|
}) = _NewsData;
|
|
|
|
factory NewsData.fromJson(Map<String, dynamic> json) =>
|
|
_$NewsDataFromJson(json);
|
|
}
|
|
|
|
/// Single news headline.
|
|
@freezed
|
|
sealed class NewsHeadline with _$NewsHeadline {
|
|
const factory NewsHeadline({
|
|
required String title,
|
|
String? description,
|
|
String? source,
|
|
String? url,
|
|
}) = _NewsHeadline;
|
|
|
|
factory NewsHeadline.fromJson(Map<String, dynamic> json) =>
|
|
_$NewsHeadlineFromJson(json);
|
|
}
|