2
Help us understand the problem. What are the problem?

More than 3 years have passed since last update.

posted at

Flutter tips 丸みを帯びた四角

Flutter 丸みを帯びた四角

Flutterで丸みを帯びた四角系の簡単な方法を知っていますか。
FlutterではClipRRectを使用することで簡単に作成できます。

import 'package:flutter/material.dart';

class Sample extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
        body:Center(
          // 丸みを作るWidget
          child: ClipRRect(
          // 曲線の度合いを設定
            borderRadius: BorderRadius.only(
              topLeft: Radius.circular(50.0),
              bottomLeft: Radius.circular(50.0),
            ),
              child: Container(
                child: Center(child:Text("center")),
                height: 100,
                width: 100,
                color: Colors.blue[500],
              )
          ),
        )
    );
  }
}

下の画像のように丸みを帯びた四角が簡単に出来上がります。

スクリーンショット 2019-05-15 12.18.09.png

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Sign upLogin
2
Help us understand the problem. What are the problem?