Skip to content

Commit

Permalink
Feat: add new year welcome overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackiu1997 committed Jan 21, 2023
1 parent 502b762 commit ffd778c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/pages/home.dart
@@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:io';

import 'package:flutter/material.dart';
Expand Down Expand Up @@ -52,6 +53,25 @@ class _HomePageRouterState extends State<HomePageRouter> {
);
Overlay.of(context)?.insert(entry);
}

// 新年祝福页
DateTime now = DateTime.now();
if (now.year == 2023 && now.month == 1 && now.day == 22) {
final newyearEntry = OverlayEntry(
builder: (context) => Container(
alignment: Alignment.center,
color: Colors.black54,
child: const AlertDialog(
title: Text("兔年快乐🎉🎉"),
content: Text('祝大家新年快乐,兔年吉祥安康~'),
),
),
);
Overlay.of(context)?.insert(newyearEntry);
Timer(const Duration(seconds: 3), () {
newyearEntry.remove();
});
}
},
);
}
Expand Down

0 comments on commit ffd778c

Please sign in to comment.