Skip to content

Commit

Permalink
add example image in README
Browse files Browse the repository at this point in the history
  • Loading branch information
aqoong committed Jul 1, 2024
1 parent 457cb36 commit bd45eb0
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 30 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@ pre-release version
## 0.1.0

* Refactor main logic
* Check overflow in all areas horizontally and vertically
* Check overflow in all areas horizontally and vertically

## 1.0.0

* Update "How to Use" in README.md
68 changes: 64 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,80 @@ Size the text to the size of the parent widget.
It's similar to using a typical Text Widget.
Inputable arguments are left open the same as the arguments in Text Widget.
~~~
final text = "Strings Strings...";
final style = TextStyle(
...
fontSize: 200,
color: Colors.balck,
...
);
const SizeTailoredText(
text: text,
textStyle: style,
SizeTailoredText(
...
text,
width: 200,
height: 200,
style: style,
maxLines: 5,
);
minFontSize: 1,
textAlign: TextAlign.left,
...
),
~~~

## Example

<table style="border-collapse: collapse;border: 1px solid #dddddd;">
<tr>
<td>
<img alt="" src="https://aqoong.github.io/readme-assets/size-tailored-text/stt_no_sized.png" width="350"/>
</td>
<td>
<pre><code>
SizeTailoredText(
text,
maxLines: 5,
minFontSize: 1,
textAlign: TextAlign.left,
style: style,
);
Text(
text,
maxLines: 5,
textAlign: TextAlign.left,
style: style,
);</code></pre>
</td>
</tr>
<tr>
<td>
<img alt="" src="https://aqoong.github.io/readme-assets/size-tailored-text/stt_sized.png" width="350"/>
</td>
<td>
<pre><code>
SizeTailoredText(text,
width: 200,
height: 200,
maxLines: 5,
minFontSize: 1,
textAlign: TextAlign.left,
style: style,
);
SizedBox(
width: 200,
height: 200,
child: Text(
text,
maxLines: 5,
textAlign: TextAlign.left,
style: style,
),
);</code></pre>
</td>
</tr>
</table>

## License

MIT License
Expand Down
33 changes: 10 additions & 23 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,33 +47,20 @@ class _MyAppState extends State<MyApp> {
textAlign: TextAlign.left,
style: style,
),
Text(
text,
maxLines: 5,
style: style,

),
// borderContainer(const Text(text, style: style)),
// SizeTailoredText(
// text: text,
// textStyle: style,
// maxWidth: 100,
// maxHeight: 100,
// maxLines: 6,
// textAlign: TextAlign.start,
// )
SizedBox(
width: 200,
height: 200,
child: Text(
text,
maxLines: 5,
textAlign: TextAlign.left,
style: style,
),
)
],
),
),
),
);
}

Widget borderContainer(Widget child) => Container(
width: double.infinity,
height: 200,
decoration: const BoxDecoration(
border: Border.fromBorderSide(BorderSide(color: Colors.red))),
child: child,
);
}
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.1.0"
version: "1.0.0"
sky_engine:
dependency: transitive
description: flutter
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: size_tailored_text
description: "Size the text to the size of the parent widget."
version: 0.1.0
version: 1.0.0
homepage: https://github.com/aqoong/size_tailored_text

environment:
Expand Down

0 comments on commit bd45eb0

Please sign in to comment.