import 'package:flutter/material.dart';
import './interview.dart';
import './profilepage.dart';
import './googlesignup.dart';
class HomePage extends StatelessWidget {
HomePage(
{super.key, required this.mailId, required this.name, required this.pic});
String mailId;
String name;
String pic = "";
@override
Widget build(context) {
return Scaffold(
appBar: AppBar(
title: const Text("Home page"),
backgroundColor: Colors.amber,
actions: [
GestureDetector(
onTap: () {
Navigator.of(context).pop(
MaterialPageRoute(
builder: (context) =>
ProfilePage("data:imJy+r2EKkN2l65xhRjrODuDOGSOX76eNM+9T5rwYd+OOOyAR0vA6w6+gjEQiUr+bqpnJ/uGmjaRdZFh40GKjdvH1pau8C0saW81R0lAty9idmf0CrPXpzp6gr11ZILJOuAAAAAAAAAAAAAA==",mailID: mailId, name: name, img: pic)),
);
//ProfilePage(mailID: mailId, name: name, img: pic);
},
child: CircleAvatar(
radius: 30,
backgroundImage: NetworkImage(pic),
// "https://e7.pngegg.com/pngimages/442/477/png-clipart-computer-icons-user-profile-avatar-profile-heroes-profile.png"),
),
)
],
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const DefaultTextStyle(
style: TextStyle(
color: Colors.amber,
fontSize: 40,
fontWeight: FontWeight.bold),
child: Text('Welcome to the interview'),
),
//
const SizedBox(height: 30,),
ElevatedButton(
onPressed: () {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => Interviewimg(
isL2Locked: false,
isL3Locked: false,
isL4Locked: false,
2),
),
);
},
child: const Text("Click to Take Interview")),
const SizedBox(height: 20,),
Container(
color: Colors.amber,
child: InkWell(onTap: (){},
child:TextButton(onPressed: () {
print("working");},
child: Text("TEST"),),),
)
],
),
),
);
}
}
如果我试图从这个页面导航到下一个页面,它不允许我导航,错误是记录。我在这段代码中给了页面导航,这两个都不起作用。以前它是工作,而我在这个网页上工作,但当我连接的网页,它最终显示错误。我
1条答案
按热度按时间toe950271#
您提供的代码基本正确,但存在一些问题。在GestureDetectoronTap方法中,弹出当前页面,然后推送新页面。这可能不是你想要的行为。如果你想导航到一个新的页面,你应该只使用
Navigator.push
或Navigator.pop
没有任何参数。ElevatedButtononPressed方法推送一个新的
Interviewimg
页面。然而,Interviewimg
构造函数是用一个数字(2)作为最后一个参数调用的,但不清楚这个数字应该表示什么。我会给你正确的密码。