step 3 : copy login screen app dokter
This commit is contained in:
64
app_petty_cash/lib/screen/splash/splash_screen.dart
Normal file
64
app_petty_cash/lib/screen/splash/splash_screen.dart
Normal file
@@ -0,0 +1,64 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
import '../../app/constant.dart';
|
||||
import '../../app/route.dart';
|
||||
import '../../provider/current_user_provider.dart';
|
||||
|
||||
class SplashScreen extends HookConsumerWidget {
|
||||
const SplashScreen({super.key});
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
// useEffect(() {
|
||||
// WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||
// final doctorID =
|
||||
// ref.read(currentUserProvider)?.model.M_UserM_DoctorCode ?? "0";
|
||||
// // print(doctorID);
|
||||
|
||||
// if (doctorID == "0") {
|
||||
// //not login
|
||||
|
||||
// Navigator.of(context)
|
||||
// .pushNamedAndRemoveUntil(loginRoute, (route) => false);
|
||||
// return;
|
||||
|
||||
// } else {
|
||||
// Navigator.of(context)
|
||||
// .pushNamedAndRemoveUntil(menuRoute, (route) => false);
|
||||
// }
|
||||
// });
|
||||
// return () {};
|
||||
// }, []);
|
||||
|
||||
// setelah 3 detik redirect ke login route
|
||||
Timer(const Duration(seconds: 3), () {
|
||||
Navigator.of(context).pushNamedAndRemoveUntil(
|
||||
loginRoute,
|
||||
(route) => false,
|
||||
);
|
||||
});
|
||||
|
||||
return Scaffold(
|
||||
// appBar: AppBar(
|
||||
// backgroundColor: Constant.backgroundColor,
|
||||
// elevation: 0,
|
||||
// ),
|
||||
backgroundColor: Constant.backgroundColor,
|
||||
body: SafeArea(
|
||||
child: Container(
|
||||
width: Constant.getActualXPhone(context: context, x: 390),
|
||||
height: Constant.getActualYPhone(context: context, y: 844),
|
||||
child: Image.asset(
|
||||
"images/splashscreen.png",
|
||||
fit: BoxFit.cover,
|
||||
// scale: 1,
|
||||
),
|
||||
// color: Colors.green,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user