54 lines
1.6 KiB
Dart
54 lines
1.6 KiB
Dart
import 'package:aitrainer_app/util/message_state.dart';
|
|
import 'package:aitrainer_app/util/session.dart';
|
|
import 'package:aitrainer_app/widgets/home.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:aitrainer_app/util/loading_screen.dart';
|
|
|
|
class LoadingScreenMain extends StatefulWidget {
|
|
@override
|
|
LoadingScreenMainState createState() => LoadingScreenMainState();
|
|
}
|
|
|
|
class LoadingScreenMainState extends State<LoadingScreenMain> {
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
Image _backgroundImage = Image.asset('asset/image/WT01_loading_layers.png',
|
|
fit: BoxFit.cover,
|
|
height: double.infinity,
|
|
width: double.infinity,
|
|
alignment: Alignment.center,
|
|
);
|
|
dynamic _timer = <dynamic>[TimeMessages.timer];
|
|
return Scaffold(
|
|
body: LoadingScreen(
|
|
initializers: _timer,
|
|
navigateToWidget: AitrainerHome(),
|
|
loaderColor: Colors.yellow,
|
|
image: _backgroundImage,
|
|
backgroundColor: Colors.black,
|
|
styleTextUnderTheLoader: TextStyle(
|
|
fontSize: 14.0,
|
|
fontWeight: FontWeight.bold,
|
|
color: Colors.lightGreenAccent),
|
|
)
|
|
);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
class TimeMessages {
|
|
static Future timer(MessageState state, Function callback) async {
|
|
//while (true) {
|
|
await Future.delayed(Duration(seconds: 2), () {
|
|
state.setMessage = DateTime.now().toIso8601String();
|
|
print("---- TimeMessages initializer");
|
|
Session session = Session();
|
|
session.fetchSessionAndNavigate(callback);
|
|
});
|
|
//}
|
|
}
|
|
}
|