簡體   English   中英

如何在 flutter 中創建按鈕?

[英]How to create button in flutter?

您如何以這種方式創建此按鈕? 需要我的學術工作。 請幫我!! 在此處輸入圖像描述

   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,
                  ),
                )),

嘗試這個:

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")
),

並使用 onClick 用 InkWell 包裝文本或容器。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM