Ads by ProfitSence
Close

Flutter Rounded,Box Shadow Container Code Example

Last Updated on Wednesday 5th Oct 2022

Rounded Container Flutter

			
					import 'package:flutter/material.dart';

class ContainerRoundedRectangle extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        body: Container(
          height: MediaQuery.of(context).size.height,
          width: MediaQuery.of(context).size.width,
          margin: EdgeInsets.all(25.0),
          decoration: BoxDecoration(
            color: Colors.yellow,
            borderRadius: BorderRadius.circular(55.0),
            border: Border.all(
              width: 5.0,
              color: Colors.red,
            ),
          ),
          child: Center(child: const Text('Hello Flutter', textAlign: TextAlign.center)),
        ),
      ),
    );
  }
}

			
	

Circular Container Flutter

			
					import 'package:flutter/material.dart';

class CircularContainer extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        body: Container(
          height: 200.0,
          width: 200.0,
          alignment: Alignment.center,
          decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(200.0),
            color: Colors.green,
          ),
          child: Text('Hello'),
        ),
      ),
    );
  }
}

			
	

Container Box Shadow Flutter

			
					import 'package:flutter/material.dart';

class ContainerBoxShadow extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        body: Container(
          height: 100.0,
          width: 200.0,
          decoration: BoxDecoration(
              color: Colors.white,
              boxShadow: [
                BoxShadow(color: Colors.red, blurRadius: 12.0 ),
                BoxShadow(color: Colors.green, blurRadius: 40.0)
              ]
          ),
        )
      ),
    );
  }
}