Skip to content

Instantly share code, notes, and snippets.

@ryanlid
Created Feb 16, 2020
Embed
What would you like to do?
ClipRRect 圆角矩形裁剪
import 'package:flutter/material.dart';
void main() {
runApp((MyApp()));
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "ClipRRect圆角矩形裁剪示例",
home: Scaffold(
appBar: AppBar(
title: Text("ClipRRect圆角矩形裁剪示例"),
),
body: Center(
child: ClipRRect(
borderRadius: BorderRadius.all(
// 圆角弧度
Radius.circular(60.0),
),
// 固定大小
child: SizedBox(
width: 300.0,
height: 300.0,
child: Image.network(
"https://images.oonnnoo.com/appicons/alipay.png",
fit: BoxFit.fill,
),
),
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment