Skip to content

Commit 39ab8b3

Browse files
author
fbchen
committed
size default to wrapContent
1 parent b8834ad commit 39ab8b3

11 files changed

+73
-20
lines changed

CHANGELOG.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
0.8.1-beta:
2+
The first version published to pub.dev.
3+
4+
The following functions are supported:
5+
6+
1. build flexible layouts with constraints
7+
1. leftToLeft
8+
2. leftToRight
9+
3. rightToLeft
10+
4. rightToRight
11+
5. topToTop
12+
6. topToBottom
13+
7. bottomToTop
14+
8. bottomToBottom
15+
9. baselineToTop
16+
10. baselineToBottom
17+
11. baselineToBaseline
18+
2. margin and goneMargin
19+
3. clickPadding (quickly expand the click area of child elements without changing their actual size.
20+
This means that the click area can be shared between child elements without increasing nesting.)
21+
4. visibility control
22+
5. constraint integrity hint
23+
6. bias
24+
7. z-index
25+
8. translate
26+
9. percentage layout
27+
10. guideline
28+
11. constraints and widgets separation
29+
12. barrier

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 hackware1993
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ No matter how complex the layout is and how deep the constraints are, it has alm
66
performance as Flex and Stack. When facing complex layouts, it provides better performance,
77
flexibility, and a very flat code hierarchy than Flex and Stack. Say no to 'nesting hell'.
88

9-
## It is recommended to use ConstraintLayout at the top level. For moderately complex pages, max 500 FPS performance is promised
9+
**It is recommended to use ConstraintLayout at the top level. For moderately complex pages, frame
10+
rate up to 500 fps.**
1011

11-
## If not necessary, try to be relative to the parent layout, so that you can define less id
12+
**If not necessary, try to be relative to the parent layout, so that you can define less id.**
1213

1314
Warning:
1415
For layout performance considerations, constraints are always one-way, and there is no two child
@@ -78,7 +79,7 @@ dependencies:
7879
7980
```dart
8081
import 'package:flutter/material.dart';
81-
import 'package:flutter_constraintlayout/constrait_layout/constraint_layout.dart';
82+
import 'package:flutter_constraintlayout/src/constraint_layout/constraint_layout.dart';
8283

8384
class Example extends StatefulWidget {
8485
const Example({Key? key}) : super(key: key);
@@ -301,7 +302,7 @@ class ExampleState extends State<Example> {
301302

302303
```dart
303304
import 'package:flutter/material.dart';
304-
import 'package:flutter_constraintlayout/constrait_layout/constraint_layout.dart';
305+
import 'package:flutter_constraintlayout/src/constraint_layout/constraint_layout.dart';
305306
306307
class GuidelineExample extends StatelessWidget {
307308
const GuidelineExample({Key? key}) : super(key: key);
@@ -360,7 +361,7 @@ class GuidelineExample extends StatelessWidget {
360361

361362
```dart
362363
import 'package:flutter/material.dart';
363-
import 'package:flutter_constraintlayout/constrait_layout/constraint_layout.dart';
364+
import 'package:flutter_constraintlayout/src/constraint_layout/constraint_layout.dart';
364365
365366
class BarrierExample extends StatelessWidget {
366367
const BarrierExample({Key? key}) : super(key: key);
@@ -428,7 +429,7 @@ class BarrierExample extends StatelessWidget {
428429

429430
```dart
430431
import 'package:flutter/material.dart';
431-
import 'package:flutter_constraintlayout/constrait_layout/constraint_layout.dart';
432+
import 'package:flutter_constraintlayout/src/constraint_layout/constraint_layout.dart';
432433
433434
class BadgeExample extends StatelessWidget {
434435
const BadgeExample({Key? key}) : super(key: key);

lib/flutter_constraintlayout.dart

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
library flutter_constraintlayout;
2+
3+
export 'src/constraint_layout.dart';

lib/constrait_layout/constraint_layout.dart renamed to lib/src/constraint_layout.dart

+4-4
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ extension WidgetsExt on Widget {
149149
Constrained applyConstraint({
150150
Key? key,
151151
ConstraintId? id,
152-
required double width,
153-
required double height,
152+
double width = wrapContent,
153+
double height = wrapContent,
154154
@_baseConstraint _Align? left,
155155
@_baseConstraint _Align? top,
156156
@_baseConstraint _Align? right,
@@ -468,8 +468,8 @@ class Constraint {
468468

469469
Constraint({
470470
this.id,
471-
required this.width,
472-
required this.height,
471+
this.width = wrapContent,
472+
this.height = wrapContent,
473473
@_baseConstraint this.left,
474474
@_baseConstraint this.top,
475475
@_baseConstraint this.right,

lib/examples/badge.dart renamed to lib/src/examples/badge.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'package:flutter/material.dart';
2-
import 'package:flutter_constraintlayout/constrait_layout/constraint_layout.dart';
2+
import 'package:flutter_constraintlayout/src/constraint_layout.dart';
33

44
class BadgeExample extends StatelessWidget {
55
const BadgeExample({Key? key}) : super(key: key);

lib/examples/barrier.dart renamed to lib/src/examples/barrier.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'package:flutter/material.dart';
2-
import 'package:flutter_constraintlayout/constrait_layout/constraint_layout.dart';
2+
import 'package:flutter_constraintlayout/src/constraint_layout.dart';
33

44
class BarrierExample extends StatelessWidget {
55
const BarrierExample({Key? key}) : super(key: key);

lib/examples/guideline.dart renamed to lib/src/examples/guideline.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'package:flutter/material.dart';
2-
import 'package:flutter_constraintlayout/constrait_layout/constraint_layout.dart';
2+
import 'package:flutter_constraintlayout/src/constraint_layout.dart';
33

44
class GuidelineExample extends StatelessWidget {
55
const GuidelineExample({Key? key}) : super(key: key);

lib/examples/sumary.dart renamed to lib/src/examples/sumary.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'package:flutter/material.dart';
2-
import 'package:flutter_constraintlayout/constrait_layout/constraint_layout.dart';
2+
import 'package:flutter_constraintlayout/src/constraint_layout.dart';
33

44
class Example extends StatefulWidget {
55
const Example({Key? key}) : super(key: key);

lib/main.dart renamed to lib/src/main.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'package:flutter/material.dart';
2-
import 'package:flutter_constraintlayout/examples/sumary.dart';
2+
import 'package:flutter_constraintlayout/src/examples/sumary.dart';
33

44
void main() {
55
runApp(const Example());

pubspec.yaml

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
name: flutter_constraintlayout
2-
description: constraintlayout for flutter
3-
4-
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
5-
6-
version: 1.0.0+1
2+
description: Build flexible layouts with constraints, Similar to Android ConstraintLayout.
3+
version: 0.8.1-beta
4+
anthor: hackware
5+
homepage: https://github.com/hackware1993/Flutter-ConstraintLayout
76

87
environment:
98
sdk: ">=2.16.1 <3.0.0"

0 commit comments

Comments
 (0)