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
,并且LayoutId
的id
必须是RelativeId
; RelativeId
的id
作为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),
),