You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have this intro screen where i alternate between 3 images and then navigate to the configuration screen..I added onesignal today and while testing the API I send me a notification that navigates to a different page in my app..
The issue is when the app isnt running in the background it navigates to the correct route i send it with the notification but after a few seconds _goHome from this page kicks in and redirects to the configuration screen.
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Hello and thanks for the swift reply!
The problem is probably with my code,but it would be nice to have a way to
know that the app was opened by a notification so I can stop a certain
function from running in the background.
How can we help?
import 'package:flutter/material.dart';
import 'dart:async';
// import 'main.dart';
import '../configurations.dart';
class SplashScreen extends StatefulWidget {
const SplashScreen({super.key});
@OverRide
// ignore: library_private_types_in_public_api
_SplashScreenState createState() => _SplashScreenState();
}
class _SplashScreenState extends State {
List assetImages = [
const AssetImage(
"assets/images/depositphotos_371485238-stock-photo-abstract-black-texture-concrete-wall.jpg"),
const AssetImage("assets/images/RHzvO.png"),
const AssetImage("assets/images/Synectics-logo-big-300x77.png")
];
int curImage = 0;
var howToFit = BoxFit.cover;
late Timer _timer;
@OverRide
void initState() {
super.initState();
_startImageSlideshow();
}
void _startImageSlideshow() {
_timer = Timer.periodic(const Duration(seconds: 3), (timer) {
setState(() {
curImage++;
if (curImage == 2) {
howToFit = BoxFit.fitWidth;
}
if (curImage >= assetImages.length - 1) {
_goHome();
_timer.cancel();
}
});
});
}
Future _goHome() async {
await Future.delayed(const Duration(seconds: 3));
Navigator.pushReplacement(
// ignore: use_build_context_synchronously
context,
MaterialPageRoute(
builder: (context) => const ConfigurationScreen()),
);
}
@OverRide
void dispose() {
_timer.cancel();
super.dispose();
}
@OverRide
Widget build(BuildContext context) {
return Scaffold(
body: SizedBox.expand(
child: AnimatedSwitcher(
duration: const Duration(seconds: 1),
transitionBuilder: (Widget child, Animation animation) {
return FadeTransition(
opacity: animation,
child: child,
);
},
child: SizedBox(
key: ValueKey(curImage),
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: Image(
image: assetImages[curImage],
fit: howToFit,
),
),
),
),
);
}
}
I have this intro screen where i alternate between 3 images and then navigate to the configuration screen..I added onesignal today and while testing the API I send me a notification that navigates to a different page in my app..
The issue is when the app isnt running in the background it navigates to the correct route i send it with the notification but after a few seconds _goHome from this page kicks in and redirects to the configuration screen.
Code of Conduct
The text was updated successfully, but these errors were encountered: