import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return MaterialApp(
title: "ClipRRect圆角矩形剪裁",
theme: ThemeData(
primaryColor: Colors.lightGreen,
),
home: Scaffold(
appBar: AppBar(
title: Text('ClipRRect圆角矩形剪裁'),
),
body: Center(
//圆形剪裁
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(30.0)),
child: SizedBox(
width: 300,
height: 300,
child: Image.asset(
"images/8.jpeg",
fit: BoxFit.fill,
),
),
),
)),
);
}
}
网友评论