Visually mark expired cert

This commit is contained in:
Ming Ming 2024-06-19 21:37:05 +08:00
parent d29007691a
commit 01551d36fc
2 changed files with 5 additions and 0 deletions

View file

@ -1,6 +1,7 @@
import 'dart:async'; import 'dart:async';
import 'dart:io'; import 'dart:io';
import 'package:clock/clock.dart';
import 'package:collection/collection.dart'; import 'package:collection/collection.dart';
import 'package:copy_with/copy_with.dart'; import 'package:copy_with/copy_with.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';

View file

@ -72,6 +72,8 @@ class _ItemView extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final now = clock.now();
final isExpired = now.isAfter(cert.endValidity);
return ListTile( return ListTile(
title: Text(cert.host), title: Text(cert.host),
subtitle: Column( subtitle: Column(
@ -107,6 +109,8 @@ class _ItemView extends StatelessWidget {
), ),
], ],
), ),
tileColor:
isExpired ? Theme.of(context).colorScheme.errorContainer : null,
); );
} }