skip to Main Content
import 'package:flutter/material.dart';

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

  @override
  State<SiginupPage> createState() => _SiginupPageState();
}

class _SiginupPageState extends State<SiginupPage> {
  @override
  Widget build(BuildContext context) {
    return SafeArea(child: Container(
      width: double.infinity,
      height: MediaQuery.of(context).size.height,
      padding: const EdgeInsets.symmetric(horizontal: 30,vertical: 30),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Column(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              const Text(
                'Get Started',
                style: TextStyle(fontWeight: FontWeight.bold,fontSize: 40),
              ),
              const SizedBox(height: 30,),
              Text('Hey lets get started with this journey to development',
              textAlign: TextAlign.center,
              style: TextStyle(
                color: Colors.grey[700],
                fontSize: 15
              ),
              ),
            ],
          ),
          Container(
            height: MediaQuery.of(context).size.height/3,
            decoration: const BoxDecoration(
              image: DecorationImage(
                  image: AssetImage('lib/assets/image/1stbg.png')
              ),
            ),
          )
        ],
      ),
    ));
  }
}

enter image description here

Why my output have no Image and heading in all red with double yellow underline along with black background ?i want it to appear with all default background with default color of heading with no underline and my image must render

3

Answers


  1. Because you don’t have a Material widget as a parent. Wrap it inside a Scaffold or a Material widget for the correct styling.

    Login or Signup to reply.
  2. Wrap your Container with Scaffold

    return SafeArea(child: Scaffold(child:Container(...)
    
    Login or Signup to reply.
  3. You must use a Scaffold widget on top of your widget tree to apply the Material theme to your child widgets.

    Scaffold(
          appBar: // Your Appbar
          body: Scaffold(child:Container(children: [ ... ],),),
    );
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search