Skip to content

Commit bc3acfd

Browse files
committed
lol words
1 parent 319de08 commit bc3acfd

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

lib/one_day/lol_words.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import 'dart:math';
2+
3+
class LoLWords {
4+
final String word;
5+
final String wordEnglish;
6+
7+
LoLWords(this.word, this.wordEnglish);
8+
}
9+
10+
class LoLWordsFactory {
11+
static List<LoLWords> words = [
12+
LoLWords('且随疾风前行,身后亦须留心。', 'Follow the wind, but watch your back.'),
13+
LoLWords('哼,一个能打的都没有。', 'Who wants a piece of the champ?')
14+
];
15+
16+
static LoLWords randomWord() {
17+
return words[Random().nextInt(words.length)];
18+
}
19+
}

lib/one_day/one_day_normal_view.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
33
import 'package:timefly/add_habit/habit_edit_page.dart';
44
import 'package:timefly/login/login_page.dart';
55
import 'package:timefly/models/user.dart';
6+
import 'package:timefly/one_day/lol_words.dart';
67
import 'package:timefly/utils/date_util.dart';
78

89
import '../app_theme.dart';
@@ -17,6 +18,7 @@ class TimeAndWordView extends StatelessWidget {
1718

1819
@override
1920
Widget build(BuildContext context) {
21+
LoLWords words = LoLWordsFactory.randomWord();
2022
return AnimatedBuilder(
2123
animation: animationController,
2224
builder: (context, child) {
@@ -40,12 +42,12 @@ class TimeAndWordView extends StatelessWidget {
4042
),
4143
),
4244
Text(
43-
'且随疾风前行,身后亦须留心。',
45+
words.word,
4446
style: AppTheme.appTheme
4547
.headline1(fontSize: 16, fontWeight: FontWeight.normal),
4648
),
4749
Text(
48-
'Follow the wind, but watch your back.',
50+
words.wordEnglish,
4951
style: AppTheme.appTheme
5052
.numHeadline1(fontSize: 16, fontWeight: FontWeight.normal)
5153
.copyWith(fontFamily: 'Montserrat'),

0 commit comments

Comments
 (0)