flutter 基础 11 ( 走,一起去划船啊)

2019-10-29  本文已影响0人  fanchuang
S91029-190733.jpg S91029-191310.jpg

1. 笔记

1. Expanded(其他组件), 用于把剩下的空间都占满,不确定还有多少。
2. 限定具体哪些边角是圆角的:
Container(
  decoration: BoxDecoration(
    color: Theme.of(context).accentColor,
    borderRadius: BorderRadius.only(
      topLeft: Radius.circular(30.0),
      topRight: Radius.circular(30.0),
    ),
  ),
),
3. ListView.builder(),里面自带了一个padding参数,很好用的。
4. ListView 里面再包含一个ListView:
Flexible(
    child: ListView(
      children: <Widget>[
        //other Widgets here ...
        ConstrainedBox(
         // **THIS is the important part**
          constraints: BoxConstraints(maxHeight: 1000), 
          child: ListView.builder(
            shrinkWrap: true,
            physics: ScrollPhysics(),
            itemBuilder: (context, index) => _buildRow(index),
            itemCount: _elements.length,
          ),
        ),
      ],
    ),
),
5. 报错: type 'Color' is not a subtype of type 'MaterialColor'
自定义白色:
const MaterialColor white = const MaterialColor(
  0xFFFFFFFF,
  const <int, Color>{
    50: const Color(0xFFFFFFFF),
    100: const Color(0xFFFFFFFF),
    200: const Color(0xFFFFFFFF),
    300: const Color(0xFFFFFFFF),
    400: const Color(0xFFFFFFFF),
    500: const Color(0xFFFFFFFF),
    600: const Color(0xFFFFFFFF),
    700: const Color(0xFFFFFFFF),
    800: const Color(0xFFFFFFFF),
    900: const Color(0xFFFFFFFF),
  },
);

theme: ThemeData(
  primarySwatch: white,
),

上一篇 下一篇

猜你喜欢

热点阅读