Если вам нужна тень, не используйте clipBehavior: Clip.antiAlias
эту строку, так как она удалит все пиксели, которые находятся вне границ контейнера (включая тень)
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
home: Homepage(),
theme: ThemeData(
primarySwatch: Colors.blue,
),
));
}
// Stateless widget=>created using a shortcut-stle
class Homepage extends StatelessWidget {
@override
Widget build(BuildContext context) {
// return Container(
// color: Colors.blue,
// child: Text("Hi Flutter App"),
// );
//Scaffold has prebuild some widget themes
return Scaffold(
appBar: AppBar(
title: Text("My App"),
),
// Container is similiar to <Div>
body: Center(
child: Container(
width: 100,
height: 100,
alignment: Alignment.center,
padding: const EdgeInsets.all(8),
// color: Colors.pink,
// clipBehavior: Clip.antiAlias, //Dont use this line
decoration: BoxDecoration(
color: Colors.pink,
// shape: BoxShape.circle,
borderRadius: BorderRadius.circular(11),
boxShadow: [
BoxShadow(
color: Colors.black,
blurRadius: 10.5,
spreadRadius: 2.2,
offset: Offset(5.0, 5.0),
)
],
),
child: Text("This is a box"),
),
),
);
}
}