mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-08-06 15:21:21 +08:00
57 lines
1.2 KiB
Dart
57 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
import 'package:gitjournal/core/note.dart';
|
|
|
|
class JournalEditorHeader extends StatelessWidget {
|
|
final Note note;
|
|
|
|
JournalEditorHeader(this.note);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var created = note.created;
|
|
if (created == null) {
|
|
return Container();
|
|
}
|
|
var dateStr = DateFormat('MMMM, yyyy').format(created);
|
|
var timeStr = DateFormat('EEEE HH:mm').format(created);
|
|
|
|
var bigNum = Text(
|
|
created.day.toString(),
|
|
style: const TextStyle(fontSize: 40.0),
|
|
);
|
|
|
|
var dateText = Text(
|
|
dateStr,
|
|
style: const TextStyle(fontSize: 18.0),
|
|
);
|
|
|
|
var timeText = Text(
|
|
timeStr,
|
|
style: const TextStyle(fontSize: 18.0),
|
|
);
|
|
|
|
var w = Row(
|
|
children: <Widget>[
|
|
bigNum,
|
|
const SizedBox(width: 8.0),
|
|
Column(
|
|
children: <Widget>[
|
|
dateText,
|
|
timeText,
|
|
],
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
),
|
|
],
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
);
|
|
|
|
return Padding(
|
|
padding: const EdgeInsets.only(top: 8.0, bottom: 18.0),
|
|
child: w,
|
|
);
|
|
}
|
|
}
|