feat: complete kouyu_english app codebase, A0 specifications and .gitignore
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'core/app_state.dart';
|
||||
import 'core/app_theme.dart';
|
||||
import 'features/onboarding/onboarding_pages.dart';
|
||||
import 'features/shell/learning_shell.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const KouyuEnglishApp());
|
||||
}
|
||||
|
||||
class KouyuEnglishApp extends StatefulWidget {
|
||||
const KouyuEnglishApp({super.key});
|
||||
|
||||
@override
|
||||
State<KouyuEnglishApp> createState() => _KouyuEnglishAppState();
|
||||
}
|
||||
|
||||
class _KouyuEnglishAppState extends State<KouyuEnglishApp> {
|
||||
final appState = AppState();
|
||||
var onboardingStep = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
appState.load();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
appState.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: '开口英语',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: buildAppTheme(),
|
||||
home: AnimatedBuilder(
|
||||
animation: appState,
|
||||
builder: (context, _) {
|
||||
if (!appState.isLoaded) {
|
||||
return const Scaffold(
|
||||
body: Center(child: CircularProgressIndicator()),
|
||||
);
|
||||
}
|
||||
if (appState.onboardingComplete) {
|
||||
return LearningShell(state: appState);
|
||||
}
|
||||
if (onboardingStep == 0) {
|
||||
return WelcomePage(
|
||||
state: appState,
|
||||
onContinue: () => setState(() => onboardingStep = 1),
|
||||
);
|
||||
}
|
||||
return PlacementPage(
|
||||
state: appState,
|
||||
onStart: () => appState.finishOnboarding(),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user