Home > Software design >  Can't make a big size container after increasing height
Can't make a big size container after increasing height

Time:02-21

This is my code where I have increased my height of this container to make big circle in mobile emulator but couldn't make it. I don't know the reason behind these.

import 'package:flutter/material.dart';

void main () {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({ Key? key }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: NewScreen(),
      debugShowCheckedModeBanner: false,
    );
  }
}

class NewScreen extends StatelessWidget {
  const NewScreen({ Key? key }) : super(key: key);

  @override
  Widget build(BuildContext context) {

    double height = MediaQuery.of(context).size.height;


    return Scaffold(
      body: Stack(
        children: [
          Positioned(
            top: -150.0,
            left: 0.0,
            bottom: 450.0,
            right: 0.0,
            child: Container(
              height: 800.0,
              decoration: BoxDecoration(
                color: Colors.red,
                shape: BoxShape.circle,
              ),
            ),
          ),
        ], 
      ),
    );
  }
}

I cannot make much bigger than initial size. What can I do to finish this?

CodePudding user response:

I think you try to achieve this result

enter image description here

It's simple, give the left and right properties negative values as you want to achieve the result that you want

     Positioned(
        left: -100.0,
        right: -100.0,

CodePudding user response:

Position wrapping Container is constraining the Container's size. Current Position widget is forcing child widget's size to have 600 height and same width with Stack.

  • Related