Flutter Tutorials

Flutter app development tutorials


flutter – BoxDecoration opacity

main.dart


import 'package:flutter/material.dart';

void main() {
  runApp(
      MaterialApp(
          theme: ThemeData(primarySwatch: Colors.blueGrey),
          home: Scaffold(
              appBar: AppBar(
                  title: const Text("Flutter - BoxDecoration Opacity")
              ),
              body: bodyContent(),
              backgroundColor: Colors.pink.shade600
          )
      )
  );
}

bodyContent(){
  return Center(
      child: SizedBox.fromSize(
          size: const Size(300,200),
          child: DecoratedBox(
              decoration: BoxDecoration(
                  color: Colors.green.shade400
                      .withOpacity(0.25),
                  borderRadius: const BorderRadius.all(
                      Radius.circular(16)
                  )
              )
          )
      )
  );
}

More flutter tutorials



About Me

Flutter Developer

Design a site like this with WordPress.com
Get started