I'm using VRouter for flutter web routing. When I click on a button to go to next route it shows the new route for a brief moment and then it's vanished. You can see in gif below it comes for a second and then goes away..
Problem is that due to this I'm not able to nevigate back to previous page
Here is my routings
class AppRouters extends StatelessWidget {
@override
Widget build(BuildContext context) {
return VRouter(
title: "Portal",
debugShowCheckedModeBanner: true,
mode: VRouterMode.history,
logs: VLogs.info,
routes: [
VWidget(path: '/', widget: LoginPage()),
VWidget(path: '/home', widget: HomePage()),
tagVGuard(),
HrVGuard(),
],
);
}
VGuard tagVGuard() => VGuard(
beforeEnter: (vRedirector) async {
String? check = await UserController.getUserType();
return check == 'tag' ? null : vRedirector.to('/');
},
stackedRoutes: [
VWidget(path: '/tag', widget: TagDashboardPage()),
VWidget(path: '/tag/candidates', widget: CandidateListPage()),
VWidget(path: '/tag/employee', widget: EmployeeListPage()),
],
);
And here is my page which is causing problem
class EmployeeListPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "EmployeeListPage",
home: Scaffold(
appBar: MyAppBar("EmployeeListPage"),
body: Body(),
),
);
}
}
class Body extends StatelessWidget {
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: ApiService.getAllEmployees(),
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.hasError) {
return Text("ERROR: ${snapshot.error}");
}
if (snapshot.hasData) {
return GridBody(snapshot.data);
}
return Text("Loading DATA");
},
);
}
}
class GridBody extends StatelessWidget {
final List<EmployeeModel> employeeList;
GridBody(this.employeeList);
@override
Widget build(BuildContext context) {
return Center(
child: SingleChildScrollView(
child: Wrap(
spacing: 10,
runSpacing: 10,
children: List.generate(
employeeList.length,
(index) => GridCard(employeeList[index]),
),
),
),
);
}
}
class GridCard extends StatelessWidget {
final EmployeeModel employee;
GridCard(this.employee);
@override
Widget build(BuildContext context) {
return Container(
color: Colors.black26,
width: 400.0,
height: 100.0,
child: Column(
children: [
Text(employee.id.toString()),
Text(employee.name),
Text(employee.role),
Text(employee.email),
],
),
);
}
}