zoukankan      html  css  js  c++  java
  • Flutter_03_画一个按钮和一根线

    import 'package:flutter/material.dart';
    
    /// 一个按钮和一根线
    class ButtonAndLine extends StatelessWidget {
      const ButtonAndLine({Key? key}) : super(key: key);
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: Text('一个按钮和一根线'),
          ),
          body: Container(
            padding: EdgeInsets.only(top: 10),
            child: Column(
              children: [
                /// FractionallySizedBox 百分比布局
                // 1、尺寸限制盒子
                FractionallySizedBox(
                  widthFactor: 0.9,
                  // 2、装饰盒子
                  child: DecoratedBox(
                    decoration: BoxDecoration(
                      // 渐变
                      gradient: LinearGradient(
                        colors: [Colors.lightBlueAccent, Colors.blue],
                      ),
                      // 圆角
                      borderRadius: BorderRadius.circular(6.0),
                      // 阴影
                      boxShadow: [
                        BoxShadow(
                            color: Colors.black54,
                            offset: Offset(2.0, 2.0),
                            blurRadius: 4.0)
                      ],
                    ),
                    // 3、材料设计的Button
                    child: MaterialButton(
                      shape: RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(6)),
                      height: 45,
                      onPressed: () => print("click btn"),
                      disabledColor: Colors.grey,
                      highlightColor: Colors.transparent,
                      splashColor: Colors.transparent,
                      // color: Colors.deepOrange,
                      child: Text(
                        "登录",
                        style: TextStyle(color: Colors.white, fontSize: 16),
                      ),
                    ),
                  ),
                ),
                SizedBox(height: 10),
    
                /// 绘制线条
                Divider(
                  // height: 30,
                  color: Colors.lightBlueAccent,
                  indent: 10,
                  endIndent: 10,
                  // 线的厚度
                  thickness: 2,
                ),
              ],
            ),
          ),
        );
      }
    }
    
  • 相关阅读:
    Spring中依赖注入的四种方式
    使用 EasyMock 更轻松地进行测试
    HDU2196 Computer(树形DP)
    BZOJ2125: 最短路(圆方树)
    虚树入门
    BZOJ2286: [Sdoi2011]消耗战(虚树/树形DP)
    Codeforces Round #487 (Div. 2)
    Educational Codeforces Round 45 (Rated for Div. 2)
    BZOJ3675: [Apio2014]序列分割(斜率优化)
    BZOJ2761: [JLOI2011]不重复数字(map)
  • 原文地址:https://www.cnblogs.com/carp-li/p/15106736.html
Copyright © 2011-2022 走看看