Flutter自定义CustomMultiChildLayout之相对布局RelativeLayout:flutter_relative_layout

relative_layout

插件地址:https://pub.dev/packages/relative_layout
对应github地址:https://github.com/CCY0122/flutter_relative_layout

Flutter上的相对布局RelativeLayout

Usage

依赖:

relative_layout: ^0.1.0

导入:

import 'package:relative_layout/relative_layout.dart';

然后就可以愉快的使用RelativeLayout了。具体可用属性见Example。

要求:

  • children必须是LayoutId,并且LayoutIdid必须是RelativeId;
  • RelativeIdid作为child寻找相对关系的身份标示,其值必须唯一
  • 被依赖的child必须声明在依赖child之前。如一个child B要布局在child A的左侧,A要声明在B之前,然后B再使用toLeftOf: 'A'

Example

1、相对关系:toLeftOf,toRightOf,above,below

RelativeLayout(
                children: <LayoutId>[
                  LayoutId(
                    id: RelativeId('A'),
                    child: simpleContatiner(text: 'A', color: Colors.red),
                  ),
                  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值