first commit
This commit is contained in:
61
lib/ui/views/splash_screen/splash_screen_view.dart
Normal file
61
lib/ui/views/splash_screen/splash_screen_view.dart
Normal file
@ -0,0 +1,61 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stacked/stacked.dart';
|
||||
|
||||
import '../../../app/themes/app_text.dart';
|
||||
import './splash_screen_view_model.dart';
|
||||
|
||||
class SplashScreenView extends StatelessWidget {
|
||||
const SplashScreenView({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ViewModelBuilder<SplashScreenViewModel>.nonReactive(
|
||||
viewModelBuilder: () => SplashScreenViewModel(),
|
||||
onViewModelReady: (SplashScreenViewModel model) async {
|
||||
await model.init();
|
||||
},
|
||||
builder: (
|
||||
BuildContext context,
|
||||
SplashScreenViewModel model,
|
||||
Widget? child,
|
||||
) {
|
||||
return Scaffold(
|
||||
// backgroundColor: mainColor,
|
||||
body: Column(
|
||||
children: [
|
||||
const SizedBox(),
|
||||
Expanded(
|
||||
child: Center(
|
||||
// show the logo.png
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Image(
|
||||
image: AssetImage("assets/logo1.png"),
|
||||
width: 200,
|
||||
height: 200,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
"Monitoring Indihome Router",
|
||||
style: boldTextStyle.copyWith(
|
||||
fontSize: 20,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
const Text(
|
||||
"Made with Flutter and Passion By Febri",
|
||||
textAlign: TextAlign.center,
|
||||
style: regularTextStyle,
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
23
lib/ui/views/splash_screen/splash_screen_view_model.dart
Normal file
23
lib/ui/views/splash_screen/splash_screen_view_model.dart
Normal file
@ -0,0 +1,23 @@
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
|
||||
import '../../../app/app.logger.dart';
|
||||
import '../../../app/app.router.dart';
|
||||
import '../../../app/core/custom_base_view_model.dart';
|
||||
import '../../../services/my_notification.dart';
|
||||
|
||||
final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
|
||||
FlutterLocalNotificationsPlugin();
|
||||
|
||||
class SplashScreenViewModel extends CustomBaseViewModel {
|
||||
final log = getLogger('SplashScreenViewModel');
|
||||
Future<void> init() async {
|
||||
await Future.delayed(const Duration(seconds: 2));
|
||||
// navigate to login page
|
||||
// ignore: use_build_context_synchronously
|
||||
MyNotification.initialize(flutterLocalNotificationsPlugin);
|
||||
socketIoClient.init();
|
||||
// socketIoClient.connect();
|
||||
|
||||
navigationService.replaceWith(Routes.loginView);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user