Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to add custom container to form

I’m new to flutter. I’m trying to build register and login app.
but I faced an issue. My problem is that I have this container

class Background extends StatelessWidget {
  final Widget child;

  const Background({
    Key? key,
    required this.child,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    Size size = MediaQuery.of(context).size;

    return Container(
      child: Stack(
        alignment: Alignment.center,
        children: <Widget>[
          Positioned(
            top: 0,
            right: 0,
            child: Image.asset(
                "assets/images/img1.png",
                width: size.width
            ),
          ),
          Positioned(
            top: 0,
            right: 0,
            child: Image.asset(
                "assets/images/img2.png",
                width: size.width
            ),
          ),
          child
        ],
      ),
    );
  }
}

I need to include this container in Scaffold here to take the design
but I didn’t know how can I do that.

 return Scaffold(
      body: Form(
        key: formkey,
        child: Column()));
                                        

Can Anyone help me to do that please

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Background is a wrapper widget. Do it like

 Scaffold(
  body: Background(
    child: Form(
      child: Column(
        children: [],
      ),
    ),
  ),
),
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading