flutter

flutter画一个底边半椭圆

2020-05-26  本文已影响0人  梁典典

flutter自学交流群1102781545,欢迎提问,
flutter 微商城开源地址:https://www.jianshu.com/p/66d223041c5d

import 'package:flutter/material.dart';

class MyClipper extends CustomClipper<Path> {
  @override
  Path getClip(Size size) {
    var path = Path();
    path.lineTo(0, size.height - 50);
    path.quadraticBezierTo(
        size.width / 2, size.height, size.width, size.height - 50);
    path.lineTo(size.width, 0);
    path.close();
    return path;
  }

  @override
  bool shouldReclip(CustomClipper<Path> oldClipper) {
    return false;
  }
}

效果

Screenshot_2020-05-26-17-02-45-360_shop.itbug.dem.jpg
显示高度可微调50
上一篇 下一篇

猜你喜欢

热点阅读