main
 1import 'package:flutter/material.dart';
 2
 3/// A info screen to show possible time format codes.
 4class TimeFormattingReferenceScreen extends StatelessWidget {
 5  /// Create a info screen to show possible time format codes.
 6  const TimeFormattingReferenceScreen({super.key});
 7  // https://pub.dev/documentation/intl/latest/intl/DateFormat-class.html
 8  static const _formats = '''
 9DAY                          d
10 ABBR_WEEKDAY                 E
11 WEEKDAY                      EEEE
12 ABBR_STANDALONE_MONTH        LLL
13 STANDALONE_MONTH             LLLL
14 NUM_MONTH                    M
15 NUM_MONTH_DAY                Md
16 NUM_MONTH_WEEKDAY_DAY        MEd
17 ABBR_MONTH                   MMM
18 ABBR_MONTH_DAY               MMMd
19 ABBR_MONTH_WEEKDAY_DAY       MMMEd
20 MONTH                        MMMM
21 MONTH_DAY                    MMMMd
22 MONTH_WEEKDAY_DAY            MMMMEEEEd
23 ABBR_QUARTER                 QQQ
24 QUARTER                      QQQQ
25 YEAR                         y
26 YEAR_NUM_MONTH               yM
27 YEAR_NUM_MONTH_DAY           yMd
28 YEAR_NUM_MONTH_WEEKDAY_DAY   yMEd
29 YEAR_ABBR_MONTH              yMMM
30 YEAR_ABBR_MONTH_DAY          yMMMd
31 YEAR_ABBR_MONTH_WEEKDAY_DAY  yMMMEd
32 YEAR_MONTH                   yMMMM
33 YEAR_MONTH_DAY               yMMMMd
34 YEAR_MONTH_WEEKDAY_DAY       yMMMMEEEEd
35 YEAR_ABBR_QUARTER            yQQQ
36 YEAR_QUARTER                 yQQQQ
37 HOUR24                       H
38 HOUR24_MINUTE                Hm
39 HOUR24_MINUTE_SECOND         Hms
40 HOUR                         j
41 HOUR_MINUTE                  jm
42 HOUR_MINUTE_SECOND           jms
43 MINUTE                       m
44 MINUTE_SECOND                ms
45 SECOND                       s''';
46
47  @override
48  Widget build(BuildContext context) => Scaffold(
49    appBar: AppBar(
50      backgroundColor: Theme.of(context).primaryColor,
51    ),
52    body: Padding(
53      padding: const EdgeInsets.symmetric(horizontal: 20),
54      child: SingleChildScrollView(
55        child: Table(
56          columnWidths: const {
57            0: FlexColumnWidth(0.71),
58            1: FlexColumnWidth(0.29),
59          },
60          children: _buildRows(context),
61        ),
62      ),
63    ),);
64
65  List<TableRow> _buildRows(BuildContext context) {
66    final List<TableRow> rowsOut = [
67      TableRow(
68        decoration: BoxDecoration(
69          border: Border(bottom: BorderSide(
70            color: Theme.of(context).dividerColor,
71          ),),
72        ),
73        children: const [Text('ICU Name'), Text('Skeleton')],
74      ),
75    ];
76    final lines = _formats.trim().split('\n');
77    for (int i = 0; i < lines.length; i++) {
78      final List<String> values = lines[i].trim().split(RegExp(r'\s{2,}'));
79      rowsOut.add(TableRow(children: [Text(values[0]), Text(values[1])]));
80    }
81    return rowsOut;
82  }
83}