feat: complete kouyu_english app codebase, A0 specifications and .gitignore

This commit is contained in:
shen
2026-09-15 15:58:33 +08:00
parent b8072673d8
commit 37c86f7ecb
136 changed files with 19042 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter/material.dart';
import 'package:kouyu_english/core/app_state.dart';
import 'package:kouyu_english/core/models.dart';
import 'package:kouyu_english/features/lesson/lesson_flow.dart';
import 'package:kouyu_english/main.dart';
import 'package:shared_preferences/shared_preferences.dart';
void main() {
testWidgets('shows the M1 welcome flow', (tester) async {
SharedPreferences.setMockInitialValues({});
await tester.pumpWidget(const KouyuEnglishApp());
await tester.pumpAndSettle();
expect(find.text('每天 20 分钟,\n说出能用的英语。'), findsOneWidget);
expect(find.text('继续'), findsOneWidget);
await tester.tap(find.text('继续'));
await tester.pumpAndSettle();
expect(find.text('从哪里开始?'), findsOneWidget);
expect(find.text('直接从第一课开始'), findsOneWidget);
});
testWidgets('writing input updates the lesson draft and enables checking', (
tester,
) async {
final state = AppState()..lessonStep = LessonStep.writing;
await tester.pumpWidget(
MaterialApp(
home: LessonFlow(state: state, onOpenDialogue: () {}, onFinish: () {}),
),
);
await tester.enterText(find.byType(TextField), 'Hello. I am Shen.');
await tester.pump();
expect(state.lessonWritingDraft, 'Hello. I am Shen.');
final check = tester.widget<FilledButton>(
find.widgetWithText(FilledButton, '检查句子'),
);
expect(check.onPressed, isNotNull);
});
}