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
- flutter – Widget minHeight
- flutter – ConstrainedBox maxHeight
- flutter – ConstrainedBox scroll
- flutter – SingleChildScrollView vertical
- flutter – DecoratedBox border
- flutter – BoxDecoration image
- flutter – BoxDecoration background color
- flutter – BoxDecoration border
- flutter – BoxDecoration border only
- flutter – BoxDecoration gradient
- flutter – Space between ListTile leading and title
- flutter – ListTile shape
- flutter – Random number in range
- flutter – Random material color
- flutter – Random bool custom probability