You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cloudsolutions-atoms/lib/views/pages/splash_screen.dart

78 lines
2.9 KiB
Dart

///todo deleted
// import 'package:firebase_core/firebase_core.dart';
// import 'package:flare_flutter/flare_actor.dart';
// import 'package:flutter/material.dart';
// import 'package:provider/provider.dart';
// import 'package:test_sa/controllers/notification/notification_manger.dart';
// import 'package:test_sa/controllers/providers/api/user_provider.dart';
// import 'package:test_sa/controllers/providers/settings/setting_provider.dart';
// import 'package:test_sa/models/user.dart';
// import 'package:test_sa/new_views/pages/land_page/land_page.dart';
//
// import 'login.dart';
//
// class SplashScreen extends StatefulWidget {
// static const String id = '/splash';
//
// const SplashScreen({Key? key}) : super(key: key);
//
// @override
// State<SplashScreen> createState() => _SplashScreenState();
// }
//
// class _SplashScreenState extends State<SplashScreen> {
// SettingProvider _settingProvider;
// UserProvider _userProvider;
//
// _goToUserScreen(User user) {
// if (user.tokenlife != null && (DateTime.tryParse(user.tokenlife)?.isAfter(DateTime.now()) ?? false)) {
// _userProvider.user = user;
// // Navigator.of(context).pushNamed(Login.id);
// Navigator.of(context).pushNamed(LandPage.routeName);
// }
// }
//
// @override
// void initState() {
// Firebase.initializeApp();
//
// NotificationManger.initialisation((notificationDetails) {
// // todo @sikander, check notifications payload, because notification model is different to need to check from backend
// // SystemNotificationModel notification = SystemNotificationModel.fromJson(json.decode(notificationDetails.payload));
// // if (notification.path == null || notification.path.isEmpty) return;
// // Navigator.pushNamed(context, notification.path, arguments: notification.requestId);
// }, (id, title, body, payload) async {});
// super.initState();
// }
//
// @override
// Widget build(BuildContext context) {
// _settingProvider = Provider.of<SettingProvider>(context, listen: false);
// _userProvider = Provider.of<UserProvider>(context, listen: false);
// return Scaffold(
// backgroundColor: Colors.white,
// body: Center(
// child: SizedBox(
// width: MediaQuery.of(context).size.width / 1.1,
// child: FlareActor(
// "assets/rives/atoms_splash.flr",
// fit: BoxFit.contain,
// animation: "splash",
// callback: (animation) async {
// Navigator.of(context).pushNamed(Login.id);
// if (_settingProvider.isLoaded && _settingProvider.user != null) {
// _goToUserScreen(_settingProvider.user);
// }
// },
// ),
// //const Center(child: CircularProgressIndicator())
//
// // Image.asset("assets/images/logo.png",
// // fit: BoxFit.contain,
// // ),
// ),
// ),
// );
// }
// }