简体   繁体   English

如何在 flutter 中创建按钮?

[英]How to create button in flutter?

How do you create this button in this way?您如何以这种方式创建此按钮? Need for my academic work.需要我的学术工作。 Please help me!!请帮我!! enter image description here在此处输入图像描述

   ElevatedButton(
                onPressed: () {
                
                },
                style: ElevatedButton.styleFrom(
                  foregroundColor: Colors.white,
                  backgroundColor: green,
                  shadowColor: green,
                  elevation: 3,
                  shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(32.0)),
                  minimumSize: const Size(100, 50),
                ),
                child: const Padding(
                  padding: EdgeInsets.all(4.0),
                  child: Text(
                    "Arabic",
                    style: forteenWhite,
                  ),
                )),

Try this:尝试这个:

Container(
              width: 300,
              height: 60,
              color: const Color(0xFF9c1f5d),
              padding: EdgeInsets.all(10),
              child:
                ElevatedButton(
                  onPressed: () {},
                  child: const Text(
                    'Register your account today !',
                    style: TextStyle(
                      color: Colors.black
                    )
                  ),            
                  style: ElevatedButton.styleFrom(
                    primary: const Color(0xFFcc4e8c),
                    shape: RoundedRectangleBorder(                 
                      borderRadius: BorderRadius.circular(20), 
                    ),
                  ),
                ),
              ),
Container(
  padding: Padding.Edgeall(10.0),
  decoration: BoxDecoration(
    borderRadius: BorderRadius.circular(10.0),
    color: Colors.white,
  ),
  height: 55,
  child: Text("This is button")
),

And to use onClick wrap the Text or container with InkWell.并使用 onClick 用 InkWell 包装文本或容器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM