Skip to content

Instantly share code, notes, and snippets.

@ryanlid
Created February 16, 2020 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanlid/707941b06ee5fbdc557da402cd5ff9e5 to your computer and use it in GitHub Desktop.
Save ryanlid/707941b06ee5fbdc557da402cd5ff9e5 to your computer and use it in GitHub Desktop.
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