Skip to content

Commit 17a2cb8

Browse files
committed
merge: build stamp, theme separation, sharper docs logo
2 parents 2357dad + f7c1bcd commit 17a2cb8

7 files changed

Lines changed: 91 additions & 5 deletions

File tree

.github/workflows/build-and-release-app.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,30 +84,41 @@ jobs:
8484
- name: Install dependencies
8585
run: flutter pub get
8686

87+
# A single timestamp shared by every dart-define below, so all platforms
88+
# in one release report the same build time.
89+
- name: Stamp build time
90+
shell: bash
91+
run: echo "BUILD_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_ENV"
92+
93+
8794
- name: Build Android
8895
if: matrix.platform == 'android'
8996
run: >-
9097
flutter build apk --release
98+
--dart-define=ADMINCRAFT_BUILD_TIME=${{ env.BUILD_TIME }}
9199
--dart-define=ADMINCRAFT_GOOGLE_WEB_CLIENT_ID=${{ vars.ADMINCRAFT_GOOGLE_WEB_CLIENT_ID }}
92100
93101
- name: Build Windows
94102
if: matrix.platform == 'windows'
95103
run: >-
96104
flutter build windows --release
105+
--dart-define=ADMINCRAFT_BUILD_TIME=${{ env.BUILD_TIME }}
97106
--dart-define=ADMINCRAFT_GOOGLE_DESKTOP_CLIENT_ID=${{ vars.ADMINCRAFT_GOOGLE_DESKTOP_CLIENT_ID }}
98107
--dart-define=ADMINCRAFT_GOOGLE_DESKTOP_CLIENT_SECRET=${{ secrets.ADMINCRAFT_GOOGLE_DESKTOP_CLIENT_SECRET }}
99108
100109
- name: Build macOS
101110
if: matrix.platform == 'macos'
102111
run: >-
103112
flutter build macos --release
113+
--dart-define=ADMINCRAFT_BUILD_TIME=${{ env.BUILD_TIME }}
104114
--dart-define=ADMINCRAFT_GOOGLE_DESKTOP_CLIENT_ID=${{ vars.ADMINCRAFT_GOOGLE_DESKTOP_CLIENT_ID }}
105115
--dart-define=ADMINCRAFT_GOOGLE_DESKTOP_CLIENT_SECRET=${{ secrets.ADMINCRAFT_GOOGLE_DESKTOP_CLIENT_SECRET }}
106116
107117
- name: Build Linux
108118
if: matrix.platform == 'linux'
109119
run: >-
110120
flutter build linux --release
121+
--dart-define=ADMINCRAFT_BUILD_TIME=${{ env.BUILD_TIME }}
111122
--dart-define=ADMINCRAFT_GOOGLE_DESKTOP_CLIENT_ID=${{ vars.ADMINCRAFT_GOOGLE_DESKTOP_CLIENT_ID }}
112123
--dart-define=ADMINCRAFT_GOOGLE_DESKTOP_CLIENT_SECRET=${{ secrets.ADMINCRAFT_GOOGLE_DESKTOP_CLIENT_SECRET }}
113124

.github/workflows/pages.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,17 @@ jobs:
4747
- name: Test app
4848
run: flutter test
4949

50+
# A single timestamp shared by every dart-define below, so all platforms
51+
# in one release report the same build time.
52+
- name: Stamp build time
53+
shell: bash
54+
run: echo "BUILD_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)" >> "$GITHUB_ENV"
55+
5056
- name: Build Admincraft web
5157
run: >-
5258
flutter build web --release --wasm
5359
--base-href "${{ steps.pages.outputs.base_path }}/"
60+
--dart-define=ADMINCRAFT_BUILD_TIME=${{ env.BUILD_TIME }}
5461
--dart-define=ADMINCRAFT_GOOGLE_WEB_CLIENT_ID=${{ vars.ADMINCRAFT_GOOGLE_WEB_CLIENT_ID }}
5562
5663
- name: Build documentation inside the web app artifact

docs/stylesheets/extra.css

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@
3535
background-image: linear-gradient(90deg, #503321, #805539 55%, #5f7f3b);
3636
}
3737

38-
.md-header__button.md-logo img,
39-
.md-header__button.md-logo svg {
38+
/* The logo is 16px pixel art, so it must scale with hard edges. Material renders
39+
* it twice, in the header and in the navigation drawer, and targeting only the
40+
* header left the drawer copy smoothly interpolated and blurry. */
41+
.md-logo img,
42+
.md-logo svg {
4043
image-rendering: pixelated;
4144
}
4245

lib/models/app_theme.dart

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@ enum AppTheme {
77
seedColor: Color(0xFF6F523D),
88
logoAsset: 'docs/logo/variants/dirt.png',
99
),
10+
// Grass and Creeper were nine degrees apart in hue, which Material's tonal
11+
// mapping flattened into near-identical schemes. Grass now leans olive and
12+
// Creeper toward a vivid spring green, far enough apart to tell at a glance.
1013
grass(
1114
label: 'Grass',
12-
description: 'Natural and balanced',
13-
seedColor: Color(0xFF4F772D),
15+
description: 'Olive and outdoorsy',
16+
seedColor: Color(0xFF6F8F1E),
1417
logoAsset: 'docs/logo/variants/grass.png',
1518
),
1619
creeper(
1720
label: 'Creeper',
1821
description: 'Bright and energetic',
19-
seedColor: Color(0xFF4C8C2B),
22+
seedColor: Color(0xFF16A34A),
2023
logoAsset: 'docs/logo/variants/creeper.png',
2124
),
2225
diamond(
@@ -30,6 +33,14 @@ enum AppTheme {
3033
description: 'Deep and dramatic',
3134
seedColor: Color(0xFF654A91),
3235
logoAsset: 'docs/logo/variants/obsidian_glow.png',
36+
),
37+
// Fills the one hue the set was missing. The others sit between brown and
38+
// purple going through green and cyan, leaving nothing on the red side.
39+
pig(
40+
label: 'Pig',
41+
description: 'Soft and rosy',
42+
seedColor: Color(0xFFD2536B),
43+
logoAsset: 'docs/logo/variants/pig.png',
3344
);
3445

3546
final String label;

lib/utils/build_info.dart

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/// When this build was produced.
2+
///
3+
/// The package version alone does not identify a build: several builds share a
4+
/// version during development, and a released version says nothing about when
5+
/// its binary was made. The release workflow passes the time in:
6+
///
7+
/// flutter build ... --dart-define=ADMINCRAFT_BUILD_TIME=2026-08-14T10:30:00Z
8+
///
9+
/// Local builds leave it empty, which is treated as "unknown" rather than
10+
/// shown as a wrong value.
11+
class BuildInfo {
12+
static const String _raw = String.fromEnvironment('ADMINCRAFT_BUILD_TIME');
13+
14+
static bool get isKnown => stamp != null;
15+
16+
static String _two(int value) => value.toString().padLeft(2, '0');
17+
18+
/// Compact stamp for display, `20260814-1030Z`, matching the form used
19+
/// elsewhere so two builds can be compared at a glance.
20+
static String? get stamp {
21+
final parsed = _parsed;
22+
if (parsed == null) return null;
23+
24+
return '${parsed.year}${_two(parsed.month)}${_two(parsed.day)}'
25+
'-${_two(parsed.hour)}${_two(parsed.minute)}Z';
26+
}
27+
28+
/// Full timestamp for a tooltip, where there is room to be readable.
29+
static String? get description {
30+
final parsed = _parsed;
31+
if (parsed == null) return null;
32+
33+
return 'Built ${parsed.year}-${_two(parsed.month)}-${_two(parsed.day)} '
34+
'${_two(parsed.hour)}:${_two(parsed.minute)} UTC';
35+
}
36+
37+
static DateTime? get _parsed {
38+
if (_raw.isEmpty) return null;
39+
return DateTime.tryParse(_raw)?.toUtc();
40+
}
41+
}

lib/views/preferences_view.dart

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import 'package:admincraft/models/app_theme.dart';
22
import 'package:admincraft/models/model.dart';
33
import 'package:admincraft/services/theme_service.dart';
44
import 'package:admincraft/utils/toast_utils.dart';
5+
import 'package:admincraft/utils/build_info.dart';
56
import 'package:admincraft/utils/url_utils.dart';
67
import 'package:flutter/material.dart';
78
import 'package:package_info_plus/package_info_plus.dart';
@@ -213,6 +214,17 @@ class _PreferencesViewState extends State<PreferencesView> {
213214
Text(_version.isEmpty
214215
? 'Loading version…'
215216
: 'Version $_version'),
217+
// Release builds carry the time they were made, so a
218+
// report can identify the exact binary rather than a
219+
// version several builds share.
220+
if (BuildInfo.isKnown)
221+
Tooltip(
222+
message: BuildInfo.description!,
223+
child: Text(
224+
'Build ${BuildInfo.stamp}',
225+
style: Theme.of(context).textTheme.bodySmall,
226+
),
227+
),
216228
const SizedBox(height: 12),
217229
Wrap(
218230
spacing: 8,

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ flutter:
7474
- docs/logo/variants/creeper.png
7575
- docs/logo/variants/diamond.png
7676
- docs/logo/variants/obsidian_glow.png
77+
- docs/logo/variants/pig.png
7778
# Item icons from mcicons (MIT), named after Minecraft identifiers.
7879
# See the credits in README.md.
7980
- assets/mcicons/

0 commit comments

Comments
 (0)