Laravel 无法导航到下一页,按下按钮ON可在集成后在颤振中切换1和0

Laravel 无法导航到下一页,按下按钮ON可在集成后在颤振中切换1和0,laravel,api,flutter,integration,Laravel,Api,Flutter,Integration,我已经将Flatter移动应用程序与laravel api集成,登录后无法导航到下一页 调试控制台中的 D/InputMethodManager(14467): view is not EditText D/InputMethodManager(14467): prepareNavigationBarInfo() DecorView@fac6bd9[MainActivity] D/InputMethodManager(14467): getNavigationBarColor() -855310

我已经将Flatter移动应用程序与laravel api集成,登录后无法导航到下一页

调试控制台中的

D/InputMethodManager(14467): view is not EditText
D/InputMethodManager(14467): prepareNavigationBarInfo() DecorView@fac6bd9[MainActivity]
D/InputMethodManager(14467): getNavigationBarColor() -855310
D/InputMethodManager(14467): SSI - flag : 0 Pid : 14467 view : com.example.FYPApp
D/InputMethodManager(14467): view is not EditText
D/InputMethodManager(14467): prepareNavigationBarInfo() DecorView@fac6bd9[MainActivity]
D/InputMethodManager(14467): getNavigationBarColor() -855310
D/InputMethodManager(14467): SSI - flag : 0 Pid : 14467 view : com.example.FYPApp
D/InputMethodManager(14467): view is not EditText
D/InputMethodManager(14467): prepareNavigationBarInfo() DecorView@fac6bd9[MainActivity]
D/InputMethodManager(14467): getNavigationBarColor() -855310
D/InputMethodManager(14467): SSI - flag : 0 Pid : 14467 view : com.example.FYPApp
D/InputMethodManager(14467): view is not EditText
D/InputMethodManager(14467): prepareNavigationBarInfo() DecorView@fac6bd9[MainActivity]
D/InputMethodManager(14467): getNavigationBarColor() -855310
I/ViewRootImpl@f6eec95[MainActivity](14467): ViewPostIme pointer 0
I/ViewRootImpl@f6eec95[MainActivity](14467): ViewPostIme pointer 1
I/ViewRootImpl@f6eec95[MainActivity](14467): ViewPostIme pointer 0
I/ViewRootImpl@f6eec95[MainActivity](14467): ViewPostIme pointer 1
class _HomePageState extends State<HomePage> {
  bool _isHidden = true;
  GlobalKey<FormState> _form = GlobalKey<FormState>();
  TextEditingController emailController = TextEditingController();
  TextEditingController passwordController = TextEditingController();
  Future<void> signIn(String email, pass) async {
    SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
    Map data = {'email': email, 'password': pass};
    var jsonResponse;
    var response = await http.post("http://192.168.166.61:8000/api/auth/login",
        headers: {'Accept': 'application/json'}, body: data);
    jsonResponse = json.decode(response.body);
    if (response.statusCode == 200) {
      if (jsonResponse != null) {
        setState(() {});
        sharedPreferences.setString('Token', jsonResponse['token']);
        sharedPreferences.setString('Email', jsonResponse['email']);
        sharedPreferences.setString('Name', jsonResponse['name']);
        sharedPreferences.setInt('ID', jsonResponse['id']);
        //sharedPreferences.setString("token", jsonResponse['token']);
        Navigator.push(
          context,
          MaterialPageRoute(
            builder: (context) => PrivilegeActivity(),
          ),
        );
      }
    } else {
      setState(() {});
      print(response.body);
    }
  }

  Widget build(BuildContext context) {
    return Scaffold(
      body: SingleChildScrollView(
        child: Form(
          key: _form,
          child: Container(
            width: 500,
            height: 600,
            margin: EdgeInsets.fromLTRB(0.0, 120.0, 0.0, 0.0),
            padding: EdgeInsets.all(5),
            alignment: Alignment.center,
            child: Column(
              children: <Widget>[
                Image.asset(
                  'assets/cstlogo.png',
                  width: 180,
                  height: 180,
                ),
                Container(
                  margin: EdgeInsets.fromLTRB(0.0, 30.0, 0.0, 35),
                  child: Text(
                    'Log in',
                    textAlign: TextAlign.center,
                    style: TextStyle(
                      fontWeight: FontWeight.bold,
                      fontSize: 30,
                      fontFamily: 'PTSerif',
                    ),
                  ),
                ),
                Container(
                  height: 65,
                  child: Card(
                    shape: RoundedRectangleBorder(
                      side: BorderSide(
                        color: Colors.black,
                        width: 1.0,
                      ),
                      borderRadius: BorderRadius.circular(15.0),
                    ),
                    child: Padding(
                      padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
                      child: TextFormField(
                        controller: emailController,
                        validator: (val) {
                          if (val.isEmpty) return 'please enter emailID';
                          return null;
                        },
                        decoration: InputDecoration(
                          border: InputBorder.none,
                          focusedBorder: InputBorder.none,
                          enabledBorder: InputBorder.none,
                          errorBorder: InputBorder.none,
                          disabledBorder: InputBorder.none,
                          labelText: ' Email ID',
                          icon: Icon(Icons.email),
                          labelStyle:
                              TextStyle(fontFamily: 'PTSerif', fontSize: 20),
                        ),
                      ),
                    ),
                    //),
                  ),
                ),
                Container(
                  height: 65,
                  child: Card(
                    shape: RoundedRectangleBorder(
                      side: BorderSide(
                        color: Colors.black,
                        width: 1.0,
                      ),
                      borderRadius: BorderRadius.circular(15.0),
                    ),
                    child: Padding(
                      padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
                      child: TextFormField(
                        controller: passwordController,
                        obscureText: _isHidden,
                        validator: (val) {
                          if (val.isEmpty) return 'please enter the password';
                          return null;
                        },
                        decoration: InputDecoration(
                          border: InputBorder.none,
                          focusedBorder: InputBorder.none,
                          enabledBorder: InputBorder.none,
                          errorBorder: InputBorder.none,
                          disabledBorder: InputBorder.none,
                          labelText: 'Password',
                          icon: Icon(Icons.lock),
                          labelStyle:
                              TextStyle(fontFamily: 'PTSerif', fontSize: 20),
                          suffix: InkWell(
                            onTap: _togglePasswordView,
                            child: Icon(
                              _isHidden
                                  ? Icons.visibility
                                  : Icons.visibility_off,
                            ),
                          ),
                        ),
                      ),
                    ),
                  ),
                ),
                Container(
                  height: 50,
                  width: 120,
                  margin: EdgeInsets.fromLTRB(0.0, 30.0, 0.0, 0.0),
                  child: Padding(
                    padding: const EdgeInsets.fromLTRB(5, 0, 5, 0),
                    child: ElevatedButton(
                      style: ButtonStyle(
                        backgroundColor: MaterialStateProperty.all<Color>(
                            Colors.lightBlueAccent),
                        shape:
                            MaterialStateProperty.all<RoundedRectangleBorder>(
                                RoundedRectangleBorder(
                                    borderRadius: BorderRadius.circular(30),
                                    side: BorderSide(color: Colors.black))),
                      ),
                      onPressed: //emailController.text == "" || passwordController.text == "" ? null :
                          () {
                        //setState(() {});
                        _form.currentState.validate();
                        signIn(emailController.text, passwordController.text);
                      },
                      child: Text(
                        'log In',
                        style: TextStyle(
                          fontSize: 20,
                          fontFamily: 'PTSerif',
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                    ),
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }

  void _togglePasswordView() {
    setState(() {
      _isHidden = !_isHidden;
    });
  }
}
public function login(Request $request){

        $fields = $request->validate([
            'email' => 'required|string',
            'password' => 'required|string'
        ]);
            //chehck email
        $user = User::where('email', $fields['email'])->first();
        //chechk password

        if(!$user || !Hash::check($fields['password'], $user->password)){
            return response([
                'message' => 'Bad credintials'
            ], 401);

        }

        $token = $user->createToken('myapptoken');//->accessToken;
        $user->token = $token->accessToken;
       
        return response($user, 201);
}

颤振登录代码

D/InputMethodManager(14467): view is not EditText
D/InputMethodManager(14467): prepareNavigationBarInfo() DecorView@fac6bd9[MainActivity]
D/InputMethodManager(14467): getNavigationBarColor() -855310
D/InputMethodManager(14467): SSI - flag : 0 Pid : 14467 view : com.example.FYPApp
D/InputMethodManager(14467): view is not EditText
D/InputMethodManager(14467): prepareNavigationBarInfo() DecorView@fac6bd9[MainActivity]
D/InputMethodManager(14467): getNavigationBarColor() -855310
D/InputMethodManager(14467): SSI - flag : 0 Pid : 14467 view : com.example.FYPApp
D/InputMethodManager(14467): view is not EditText
D/InputMethodManager(14467): prepareNavigationBarInfo() DecorView@fac6bd9[MainActivity]
D/InputMethodManager(14467): getNavigationBarColor() -855310
D/InputMethodManager(14467): SSI - flag : 0 Pid : 14467 view : com.example.FYPApp
D/InputMethodManager(14467): view is not EditText
D/InputMethodManager(14467): prepareNavigationBarInfo() DecorView@fac6bd9[MainActivity]
D/InputMethodManager(14467): getNavigationBarColor() -855310
I/ViewRootImpl@f6eec95[MainActivity](14467): ViewPostIme pointer 0
I/ViewRootImpl@f6eec95[MainActivity](14467): ViewPostIme pointer 1
I/ViewRootImpl@f6eec95[MainActivity](14467): ViewPostIme pointer 0
I/ViewRootImpl@f6eec95[MainActivity](14467): ViewPostIme pointer 1
class _HomePageState extends State<HomePage> {
  bool _isHidden = true;
  GlobalKey<FormState> _form = GlobalKey<FormState>();
  TextEditingController emailController = TextEditingController();
  TextEditingController passwordController = TextEditingController();
  Future<void> signIn(String email, pass) async {
    SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
    Map data = {'email': email, 'password': pass};
    var jsonResponse;
    var response = await http.post("http://192.168.166.61:8000/api/auth/login",
        headers: {'Accept': 'application/json'}, body: data);
    jsonResponse = json.decode(response.body);
    if (response.statusCode == 200) {
      if (jsonResponse != null) {
        setState(() {});
        sharedPreferences.setString('Token', jsonResponse['token']);
        sharedPreferences.setString('Email', jsonResponse['email']);
        sharedPreferences.setString('Name', jsonResponse['name']);
        sharedPreferences.setInt('ID', jsonResponse['id']);
        //sharedPreferences.setString("token", jsonResponse['token']);
        Navigator.push(
          context,
          MaterialPageRoute(
            builder: (context) => PrivilegeActivity(),
          ),
        );
      }
    } else {
      setState(() {});
      print(response.body);
    }
  }

  Widget build(BuildContext context) {
    return Scaffold(
      body: SingleChildScrollView(
        child: Form(
          key: _form,
          child: Container(
            width: 500,
            height: 600,
            margin: EdgeInsets.fromLTRB(0.0, 120.0, 0.0, 0.0),
            padding: EdgeInsets.all(5),
            alignment: Alignment.center,
            child: Column(
              children: <Widget>[
                Image.asset(
                  'assets/cstlogo.png',
                  width: 180,
                  height: 180,
                ),
                Container(
                  margin: EdgeInsets.fromLTRB(0.0, 30.0, 0.0, 35),
                  child: Text(
                    'Log in',
                    textAlign: TextAlign.center,
                    style: TextStyle(
                      fontWeight: FontWeight.bold,
                      fontSize: 30,
                      fontFamily: 'PTSerif',
                    ),
                  ),
                ),
                Container(
                  height: 65,
                  child: Card(
                    shape: RoundedRectangleBorder(
                      side: BorderSide(
                        color: Colors.black,
                        width: 1.0,
                      ),
                      borderRadius: BorderRadius.circular(15.0),
                    ),
                    child: Padding(
                      padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
                      child: TextFormField(
                        controller: emailController,
                        validator: (val) {
                          if (val.isEmpty) return 'please enter emailID';
                          return null;
                        },
                        decoration: InputDecoration(
                          border: InputBorder.none,
                          focusedBorder: InputBorder.none,
                          enabledBorder: InputBorder.none,
                          errorBorder: InputBorder.none,
                          disabledBorder: InputBorder.none,
                          labelText: ' Email ID',
                          icon: Icon(Icons.email),
                          labelStyle:
                              TextStyle(fontFamily: 'PTSerif', fontSize: 20),
                        ),
                      ),
                    ),
                    //),
                  ),
                ),
                Container(
                  height: 65,
                  child: Card(
                    shape: RoundedRectangleBorder(
                      side: BorderSide(
                        color: Colors.black,
                        width: 1.0,
                      ),
                      borderRadius: BorderRadius.circular(15.0),
                    ),
                    child: Padding(
                      padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
                      child: TextFormField(
                        controller: passwordController,
                        obscureText: _isHidden,
                        validator: (val) {
                          if (val.isEmpty) return 'please enter the password';
                          return null;
                        },
                        decoration: InputDecoration(
                          border: InputBorder.none,
                          focusedBorder: InputBorder.none,
                          enabledBorder: InputBorder.none,
                          errorBorder: InputBorder.none,
                          disabledBorder: InputBorder.none,
                          labelText: 'Password',
                          icon: Icon(Icons.lock),
                          labelStyle:
                              TextStyle(fontFamily: 'PTSerif', fontSize: 20),
                          suffix: InkWell(
                            onTap: _togglePasswordView,
                            child: Icon(
                              _isHidden
                                  ? Icons.visibility
                                  : Icons.visibility_off,
                            ),
                          ),
                        ),
                      ),
                    ),
                  ),
                ),
                Container(
                  height: 50,
                  width: 120,
                  margin: EdgeInsets.fromLTRB(0.0, 30.0, 0.0, 0.0),
                  child: Padding(
                    padding: const EdgeInsets.fromLTRB(5, 0, 5, 0),
                    child: ElevatedButton(
                      style: ButtonStyle(
                        backgroundColor: MaterialStateProperty.all<Color>(
                            Colors.lightBlueAccent),
                        shape:
                            MaterialStateProperty.all<RoundedRectangleBorder>(
                                RoundedRectangleBorder(
                                    borderRadius: BorderRadius.circular(30),
                                    side: BorderSide(color: Colors.black))),
                      ),
                      onPressed: //emailController.text == "" || passwordController.text == "" ? null :
                          () {
                        //setState(() {});
                        _form.currentState.validate();
                        signIn(emailController.text, passwordController.text);
                      },
                      child: Text(
                        'log In',
                        style: TextStyle(
                          fontSize: 20,
                          fontFamily: 'PTSerif',
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                    ),
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }

  void _togglePasswordView() {
    setState(() {
      _isHidden = !_isHidden;
    });
  }
}
public function login(Request $request){

        $fields = $request->validate([
            'email' => 'required|string',
            'password' => 'required|string'
        ]);
            //chehck email
        $user = User::where('email', $fields['email'])->first();
        //chechk password

        if(!$user || !Hash::check($fields['password'], $user->password)){
            return response([
                'message' => 'Bad credintials'
            ], 401);

        }

        $token = $user->createToken('myapptoken');//->accessToken;
        $user->token = $token->accessToken;
       
        return response($user, 201);
}
class\u HomePageState扩展状态{
bool_ishiden=true;
GlobalKey _form=GlobalKey();
TextEditingController emailController=TextEditingController();
TextEditingController密码控制器=TextEditingController();
未来登录(字符串电子邮件,传递)异步{
SharedReferences SharedReferences=等待SharedReferences.getInstance();
映射数据={'email':email,'password':pass};
var-jsonResponse;
var response=wait http.post(“http://192.168.166.61:8000/api/auth/login",
标题:{'Accept':'application/json'},正文:数据);
jsonResponse=json.decode(response.body);
如果(response.statusCode==200){
if(jsonResponse!=null){
setState((){});
setString('Token',jsonResponse['Token']);
setString('Email',jsonResponse['Email']);
setString('Name',jsonResponse['Name']);
setInt('ID',jsonResponse['ID']);
//setString(“token”,jsonResponse['token']);
导航器。推(
上下文
材料路线(
生成器:(上下文)=>PrivilegeActivity(),
),
);
}
}否则{
setState((){});
打印(响应.正文);
}
}
小部件构建(构建上下文){
返回脚手架(
正文:SingleChildScrollView(
孩子:表格(
键:_形式,
子:容器(
宽度:500,
身高:600,
边距:LTRB(0.0,120.0,0.0,0.0)的边距集,
填充:边缘设置。全部(5),
对齐:对齐.center,
子:列(
儿童:[
影像资产(
“assets/cstlogo.png”,
宽度:180,
身高:180,
),
容器(
边距:LTRB(0.0,30.0,0.0,35)的边距,
子:文本(
“登录”,
textAlign:textAlign.center,
样式:TextStyle(
fontWeight:fontWeight.bold,
尺寸:30,
fontFamily:“PTSerif”,
),
),
),
容器(
身高:65,
孩子:卡片(
形状:圆形矩形边框(
边线(
颜色:颜色,黑色,
宽度:1.0,
),
边界半径:边界半径。圆形(15.0),
),
孩子:填充(
填充:从LTRB(10,0,10,0)开始的边缘设置,
子项:TextFormField(
控制器:emailController,
验证器:(val){
如果(val.isEmpty)返回“请输入emailID”;
返回null;
},
装饰:输入装饰(
边框:InputBorder.none,
FocusedOrder:InputBorder.none,
enabledBorder:InputBorder.none,
errorBorder:InputBorder.none,
disabledBorder:InputBorder.none,
labelText:“电子邮件ID”,
图标:图标(Icons.email),
标签样式:
TextStyle(fontFamily:'PTSerif',fontSize:20),
),
),
),
//),
),
),
容器(
身高:65,
孩子:卡片(
形状:圆形矩形边框(
边线(
颜色:颜色,黑色,
宽度:1.0,
),
边界半径:边界半径。圆形(15.0),
),
孩子:填充(
填充:从LTRB(10,0,10,0)开始的边缘设置,
子项:TextFormField(
控制器:密码控制器,
模糊文本:_ishiden,
验证器:(val){
如果(val.isEmpty)返回“请输入密码”;
返回null;
},
装饰:输入装饰(
边框:InputBorder.none,
FocusedOrder:InputBorder.none,
enabledBorder:InputBorder.none,
errorBorder:InputBorder.none,
disabledBorder:InputBorder.none,
labelText:“密码”,
图标:图标(Icons.lock),
标签样式:
TextStyle(fontFamily:'PTSerif',fontSize:20),
后缀:InkWell(
onTap:\u切换PasswordView,
子:图标(
_伊希登
?图标。可见性
:Icons.visibility\u关闭,
),
),
),
),
),
),
),
容器(
身高:50,
宽度:120,
边距:EdgeInsets.fr