I tried to define a route for page navigation, but as you can see, the following error occurs.
What's the difference between the DashBoardMain and MyProfileModify causing this error? enter image description here
This is the code that is normally defined.
class DashBoardMain extends StatefulWidget {
@override
_DashBoardMainState createState() => _DashBoardMainState();
}
class _DashBoardMainState extends State<DashBoardMain> {
@override
void initState() {
super.initState();
pageController = PageController();
}
@override
void dispose() {
pageController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
int _value = 0;
return Scaffold(...);
}
}
This is the code where the error occurs.
class MyProfileModify extends StatefulWidget {
@override
_MyProfileModifyState createState() => _MyProfileModifyState();
}
class _MyProfileModifyState extends State<MyProfileModify> {
void initState() {
super.initState();
}
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
Widget submitButton = new Container(
child: new RaisedButton(
onPressed: submitData,
child: new Padding(
padding: new EdgeInsets.all(16.0),
child: new Text('Submit Data'),
),
),
);
return Scaffold(...);
}
}
I see the explanation of IDE is very clear. You defined MyProfileModify in two file and import both of resources. So you just remove unnecessary one or better way rename one class.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.