This commit is contained in:
2025-10-01 08:15:05 +07:00
parent deb7aeb850
commit e39b4b64cc
12 changed files with 994 additions and 483 deletions

View File

@@ -0,0 +1,52 @@
import 'package:base_flutter/features/home/models.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class LoadingLessonScreen extends StatefulWidget {
const LoadingLessonScreen({super.key});
@override
State<LoadingLessonScreen> createState() => _LoadingLessonScreenState();
}
class _LoadingLessonScreenState extends State<LoadingLessonScreen> {
LessonResponse? lessonResponse;
@override
void initState() {
// TODO: implement initState
super.initState();
callDio();
}
void callDio() async {
final dio = Dio();
final response = await dio.get('https://37b530e059dd.ngrok-free.app/');
setState(() {
lessonResponse = LessonResponse.fromJson(response.data);
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Center(
child: lessonResponse == null ? const CircularProgressIndicator() : Column(
mainAxisSize: MainAxisSize.min,
children: [
Text('Lesson Title: ${lessonResponse!.response}'),
TextButton(onPressed: () {
context.pushNamed('test', extra: lessonResponse);
}, child: Text('Next')),
],
)
),
);
}
}