Files
GitJournal/lib/widgets/journal_editor_header.dart
Vishesh Handa 88552fe8e9 Revert "Workaround intl bug by harding 'en' locale"
This reverts commit 303192d9d575b26a77a00f7a62212f310ec1e329.
This reverts commit cd9d128b47ed523036f7ae1232ec7adcf04ed8a9.

GitJournal is used by non-English speakers (a lot in China and Russia)
and while we don't support those languages completely, we do support
them a little bit. I don't want to loose this functionality. It would be
better for us to fix the bug in intl.
2020-06-10 09:31:08 +02:00

54 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) {
if (note.created == null) {
return Container();
}
var dateStr = DateFormat('MMMM, yyyy').format(note.created);
var timeStr = DateFormat('EEEE HH:mm').format(note.created);
var bigNum = Text(
note.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,
);
}
}