app works in androidStudio but not on phone
i have app which gets data from api.
While taking datas from api it waits on loadingScreen.
it works well in androidStudio but when i installed my phone i cant pass loadingScreen
is there any way to that i can pass this screen
texttexttextexttexttexttextexttexttexttextexttexttexttextext
class LoadingScreen extends StatefulWidget {
String? cityName;
LoadingScreen(this.cityName) {}
@override
_LoadingScreenState createState() => _LoadingScreenState();
}
class _LoadingScreenState extends State<LoadingScreen> {
Future<void> getWeatherData() async {
WeatherData weatherData = WeatherData(cityName: widget.cityName);
await weatherData.getCurrentWeather();
if (weatherData.currentTemperature == null) {
print("apiden currenttemeperatu boş gelyio");
} else {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(
builder: (context) => MainPage(widget.cityName,
weatherData.currentTemperature, weatherData.weatherId)),
(route) => false);
}
}
void initState() {
// TODO: implement initState
super.initState();
getWeatherData();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Colors.purple, Colors.blue])),
child: Directionality(
textDirection: TextDirection.ltr,
child: SpinKitChasingDots(
duration: Duration(milliseconds: 950),
itemBuilder: (BuildContext context, int index) {
return DecoratedBox(
decoration: BoxDecoration(
color: index.isEven ? Colors.white : Colors.red,
shape: BoxShape.circle,
),
);
},
),
),
),
);
}
}
from Recent Questions - Stack Overflow https://ift.tt/H1stLSg
https://ift.tt/FXHnecp
Comments
Post a Comment