Reputation: 3
I'm trying to get Flutter up and running so I can begin learning from my new tutorial. However, when I update my code and try to use Flutter's hot reload or hot restart functions, Flutter draws the visual changes on top of what was previously there. In order to get the desired changes I have to fully close and restart the entire app.
https://gyazo.com/21d1a7f0b076f3cbf0cdf9c31bef80d5 https://gyazo.com/dc7b10dd3d5ff17ee9cad8082455aaab
import 'package:flutter/material.dart';
import 'package:test_flutter_application/screens/authenticate.dart';
import 'home.dart';
class Wrapper extends StatelessWidget {
@override
Widget build(BuildContext context) {
// return home or authenticate widget
return Authenticate();
}
}
class Authenticate extends StatefulWidget {
@override
_AuthenticateState createState() => _AuthenticateState();
}
class _AuthenticateState extends State<Authenticate> {
@override
Widget build(BuildContext context) {
return Container(
child: Text("Authenticate"),
);
}
}
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Wrapper(),
);
}
}
^ These two screenshots show you what happens before I make a change and after. After I make the change for the text to draw "Authenticate" instead of "Home", flutter simply draw "Authenticate" over "Home". The only way to fix this is to restart the app.
If anyone has any insight I would greatly appreciate it, because this has been a very frustrating experience. Thank you!
Upvotes: 0
Views: 158
Reputation: 367
You're not using Scaffold in your app. Try using scaffold as home in your MaterialApp or CupertinoApp. We'll need more of your code in main.dart to help you.
Upvotes: 1