DEV Community

Coder
Coder

Posted on

Wrap in Flutter

Image description

import 'package:flutter/material.dart';

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

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

  @override
  State<om> createState() => _omState();
}

class _omState extends State<om> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      darkTheme: ThemeData.dark(),
      debugShowCheckedModeBanner: false,
      title: 'Om Namah Shivay',
      home: Scaffold(
        appBar: AppBar(
          title: Text(
            "Rows and Columns and wrap",
            style: TextStyle(color: Colors.black),
          ),
          centerTitle: true,
          backgroundColor: Colors.red,
        ),
        body: Wrap(
          alignment: WrapAlignment.center,
          direction: Axis.vertical,
          children: [
            Container(
              margin: EdgeInsets.all(15),
              color: Colors.red,
              width: 50,
              height: 50,
            ),
            Container(
              margin: EdgeInsets.all(15),
              color: Colors.red,
              width: 50,
              height: 50,
            ),
            Container(
              margin: EdgeInsets.all(15),
              color: Colors.red,
              width: 50,
              height: 50,
            ),
            Container(
              margin: EdgeInsets.all(15),
              color: Colors.red,
              width: 50,
              height: 50,
            ),
            Container(
              margin: EdgeInsets.all(15),
              color: Colors.red,
              width: 50,
              height: 50,
            ),
            Container(
              margin: EdgeInsets.all(15),
              color: Colors.red,
              width: 50,
              height: 50,
            ),
            Container(
              margin: EdgeInsets.all(15),
              color: Colors.red,
              width: 50,
              height: 50,
            ),
            Container(
              margin: EdgeInsets.all(15),
              color: Colors.red,
              width: 50,
              height: 50,
            ),
            Container(
              margin: EdgeInsets.all(15),
              color: Colors.red,
              width: 50,
              height: 50,
            ),
            Container(
              margin: EdgeInsets.all(15),
              color: Colors.red,
              width: 50,
              height: 50,
            ),
          ],
        ),
      ),
    );
  }
}

Enter fullscreen mode Exit fullscreen mode

I understood

Top comments (0)