2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Flutter tips 丸みを帯びた四角

Posted at

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
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?