1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] The named parameter 'onPressed' isn't defined

Discussão em 'Mobile' iniciado por Stack, Outubro 10, 2024 às 04:22.

  1. Stack

    Stack Membro Participativo

    The name parameter 'on Pressed' isn't defined

    I am trying to make an app with a sign in page but i can't make the button work


    import 'package:flutter/material.dart';

    class SignIn extends StatefulWidget {
    const SignIn({super.key});


    @override
    State<SignIn> createState() => _SignInState();
    }

    class _SignInState extends State<SignIn> {


    // ignore: unused_field
    final AuthService _auth = AuthService();

    // text field state
    String email = '';
    String password = '';



    @override
    Widget build(BuildContext context) {
    return Scaffold(
    backgroundColor: Colors.brown[100],
    appBar: AppBar(
    backgroundColor: Colors.brown[400],
    elevation: 0.0,
    title: const Text('Sign in to LejweConnect'),

    ),
    body: Container(
    padding: const EdgeInsets.symmetric(vertical: 20.0, horizontal: 50.0),
    child: Form(
    child: Column(
    children: <Widget>[
    const SizedBox(height: 20.0),
    TextFormField(
    onChanged: (val){
    setState(() => email = val);

    }
    ),
    const SizedBox(height: 20.0),
    TextFormField(
    obscureText: true,
    onChanged: (val){
    setState(() => password = val);

    }
    ),
    const SizedBox(height: 20.0),
    Container(
    color: Colors.pink[400],
    // ignore: prefer_const_constructors
    child: Text(
    'Sign in',
    style: const TextStyle(color: Colors.white),
    ),

    onPressed: () async {

    }


    The named parameter 'onPressed' isn't defined. Try correcting the name to an existing named parameter's name, or defining a named parameter with the name 'onPressed'.dartundefined_named_parameter

    How do i fix this problem

    Continue reading...

Compartilhe esta Página