Stack

tpids·2024년 9월 11일

Flutter

목록 보기
15/40
import 'package:flutter/material.dart';

class ExStack extends StatelessWidget {
  const ExStack({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: Stack(
          // alignment: Alignment.cent,
          children: [
            Positioned(
              top: 50,
              left: 32,
              child: Container(
                width: 150,
                height: 150,
                color: Colors.red,
              ),
            ),

            Positioned(
              top: 100,
              child: Container(
                width: 100,
                height: 100,
                color: Colors.orange,
              ),
            ),

            Positioned(
              top: 0,
              left: 0,
              child: Container(
                width: 50,
                height: 50,
                color: Colors.yellow,
              ),
            )
          ],
        ),
      ),
    );
  }
}

profile
개발자

0개의 댓글