David PHAM-VAN

Optimize for loops

... ... @@ -204,7 +204,7 @@ class PdfString extends PdfDataType {
encoding.add(unit & UNICODE_BYTE_ZERO_MASK);
}
for (var unit in str.codeUnits) {
for (final unit in str.codeUnits) {
if ((unit >= 0 && unit < UNICODE_UTF16_RESERVED_LO) ||
(unit > UNICODE_UTF16_RESERVED_HI && unit <= UNICODE_PLANE_ONE_MAX)) {
add(unit);
... ... @@ -225,7 +225,7 @@ class PdfString extends PdfDataType {
/// Escape special characters
/// \ddd Character code ddd (octal)
void _putTextBytes(PdfStream s, List<int> b) {
for (var c in b) {
for (final c in b) {
switch (c) {
case 0x0a: // \n Line feed (LF)
s.putByte(0x5c);
... ... @@ -274,7 +274,7 @@ class PdfString extends PdfDataType {
switch (format) {
case PdfStringFormat.binary:
s.putByte(0x3c);
for (var byte in value) {
for (final byte in value) {
s.putByte(_codeUnitForDigit((byte & 0xF0) >> 4));
s.putByte(_codeUnitForDigit(byte & 0x0F));
}
... ...
... ... @@ -326,7 +326,7 @@ Iterable<String> _parse(String text) sync* {
final notArabicWords = <List<int>>[];
var first = true;
for (var word in words) {
for (final word in words) {
final newWord = <int>[];
var isNewWordArabic = false;
... ... @@ -375,7 +375,7 @@ Iterable<String> _parse(String text) sync* {
if (isNewWordArabic) {
isNewWordArabic = false;
for (var notArabicNewWord in notArabicWords) {
for (final notArabicNewWord in notArabicWords) {
yield '${String.fromCharCodes(notArabicNewWord)} ';
}
notArabicWords.clear();
... ...
... ... @@ -57,7 +57,7 @@ class PdfFontMetrics {
double? firstBearing;
late double spacing;
for (var metric in metrics) {
for (final metric in metrics) {
firstBearing ??= metric.leftBearing;
left ??= metric.left;
spacing = metric.advanceWidth > 0 ? letterSpacing : 0.0;
... ...
... ... @@ -303,15 +303,15 @@ class TtfParser {
/// https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html
void _parseGlyphs() {
final baseOffset = tableOffsets[glyf_table];
final baseOffset = tableOffsets[glyf_table]!;
final hmtxOffset = tableOffsets[hmtx_table]!;
final unitsPerEm = this.unitsPerEm;
final numOfLongHorMetrics = this.numOfLongHorMetrics;
final defaultadvanceWidth =
bytes.getUint16(hmtxOffset + (numOfLongHorMetrics - 1) * 4);
var glyphIndex = 0;
for (var offset in glyphOffsets) {
final xMin = bytes.getInt16(baseOffset! + offset + 2); // 2
for (final offset in glyphOffsets) {
final xMin = bytes.getInt16(baseOffset + offset + 2); // 2
final yMin = bytes.getInt16(baseOffset + offset + 4); // 4
final xMax = bytes.getInt16(baseOffset + offset + 6); // 6
final yMax = bytes.getInt16(baseOffset + offset + 8); // 8
... ...
... ... @@ -78,14 +78,14 @@ class TtfWriter {
final glyph =
ttf.readGlyph(ttf.charToGlyphIndexMap[chars[index]] ?? 0).copy();
for (var g in glyph.compounds) {
for (final g in glyph.compounds) {
compounds[g] = -1;
}
glyphsInfo.add(glyph);
}
// Add compound glyphs
for (var compound in compounds.keys) {
for (final compound in compounds.keys) {
final index = glyphsInfo.firstWhere(
(TtfGlyphInfo glyph) => glyph.index == compound,
orElse: () {
... ... @@ -106,14 +106,14 @@ class TtfWriter {
glyphsInfo.add(glyph);
// update compound indices
for (var glyph in glyphsInfo) {
for (final glyph in glyphsInfo) {
if (glyph.compounds.isNotEmpty) {
_updateCompoundGlyph(glyph, compounds);
}
}
var glyphsTableLength = 0;
for (var glyph in glyphsInfo) {
for (final glyph in glyphsInfo) {
glyphsTableLength =
_wordAlign(glyphsTableLength + glyph.data.lengthInBytes);
}
... ... @@ -136,7 +136,7 @@ class TtfWriter {
{
final loca = tables[TtfParser.loca_table]!.buffer.asByteData();
var index = 0;
for (var glyph in glyphsInfo) {
for (final glyph in glyphsInfo) {
if (ttf.indexToLocFormat == 0) {
loca.setUint16(index, offset ~/ 2);
index += 2;
... ... @@ -195,7 +195,7 @@ class TtfWriter {
final defaultadvanceWidth =
ttf.bytes.getUint16(hmtxOffset + (numOfLongHorMetrics - 1) * 4);
var index = 0;
for (var glyph in glyphsInfo) {
for (final glyph in glyphsInfo) {
final advanceWidth = glyph.index < numOfLongHorMetrics
? ttf.bytes.getUint16(hmtxOffset + glyph.index * 4)
: defaultadvanceWidth;
... ...
... ... @@ -104,8 +104,8 @@ class PdfCatalog extends PdfObjectDict {
}
final widgets = <PdfAnnot>[];
for (var page in pdfDocument.pdfPageList.pages) {
for (var annot in page.annotations) {
for (final page in pdfDocument.pdfPageList.pages) {
for (final annot in page.annotations) {
if (annot.annot.subtype == '/Widget') {
widgets.add(annot);
}
... ...
... ... @@ -55,7 +55,7 @@ class PdfNames extends PdfObjectDict {
final keys = _dests.keys.toList()..sort();
for (var name in keys) {
for (final name in keys) {
dests.add(PdfSecString.fromString(this, name));
dests.add(_dests[name]!);
}
... ...
... ... @@ -189,7 +189,7 @@ class PdfOutline extends PdfObjectDict {
var c = outlines.length; // initially the number of kids
// now call each one for their descendants
for (var o in outlines) {
for (final o in outlines) {
c += o.descendants();
}
... ...
... ... @@ -163,7 +163,7 @@ class PdfTtfFont extends PdfFont {
final runes = text.runes;
stream.putByte(0x3c);
for (var rune in runes) {
for (final rune in runes) {
var char = unicodeCMap.cmap.indexOf(rune);
if (char == -1) {
char = unicodeCMap.cmap.length;
... ...
... ... @@ -100,7 +100,7 @@ class PdfXrefTable extends PdfDataType {
void _writeblock(PdfStream s, int firstid, List<PdfXref> block) {
s.putString('$firstid ${block.length}\n');
for (var x in block) {
for (final x in block) {
s.putString(x.ref());
s.putByte(0x0a);
}
... ... @@ -125,7 +125,7 @@ class PdfXrefTable extends PdfDataType {
type: PdfCrossRefEntryType.free,
));
for (var x in offsets) {
for (final x in offsets) {
// check to see if block is in range
if (x.id != (lastid + 1)) {
// no, so write this block, and reset
... ... @@ -165,7 +165,7 @@ class PdfXrefTable extends PdfDataType {
// We need block 0 to exist
blocks.add(firstid);
for (var x in offsets) {
for (final x in offsets) {
// check to see if block is in range
if (x.id != (lastid + 1)) {
// no, so store this block, and reset
... ... @@ -195,7 +195,7 @@ class PdfXrefTable extends PdfDataType {
// Write offset zero, all zeros
ofs += wl;
for (var x in offsets) {
for (final x in offsets) {
ofs = x.cref(o, ofs, w);
}
... ...
... ... @@ -64,7 +64,7 @@ class _BarcodeWidget extends Widget {
final textList = <BarcodeText>[];
for (var element in barcode!.makeBytes(
for (final element in barcode!.makeBytes(
data,
width: box!.width,
height: box!.height,
... ... @@ -93,7 +93,7 @@ class _BarcodeWidget extends Widget {
if (drawText!) {
final font = textStyle!.font!.getFont(context);
for (var text in textList) {
for (final text in textList) {
final metrics = font!.stringMetrics(text.text);
final top = box!.top -
... ... @@ -136,7 +136,7 @@ class _BarcodeWidget extends Widget {
super.debugPaint(context);
if (drawText!) {
for (var element in barcode!.makeBytes(
for (final element in barcode!.makeBytes(
data,
width: box!.width,
height: box!.height,
... ...
... ... @@ -105,13 +105,13 @@ class CartesianGrid extends ChartGrid {
final datasets = Chart.of(context).datasets;
clip(context, box!.size);
for (var dataSet in datasets) {
for (final dataSet in datasets) {
dataSet.paintBackground(context);
}
context.canvas.restoreContext();
paintBackground(context);
clip(context, box!.size);
for (var dataSet in datasets) {
for (final dataSet in datasets) {
dataSet.paint(context);
}
context.canvas.restoreContext();
... ...
... ... @@ -69,13 +69,13 @@ class RadialGrid extends ChartGrid {
final datasets = Chart.of(context).datasets;
clip(context, box!.size);
for (var dataSet in datasets) {
for (final dataSet in datasets) {
dataSet.paintBackground(context);
}
context.canvas.restoreContext();
paintBackground(context);
clip(context, box!.size);
for (var dataSet in datasets) {
for (final dataSet in datasets) {
dataSet.paint(context);
}
context.canvas.restoreContext();
... ...
... ... @@ -88,19 +88,19 @@ class PieGrid extends ChartGrid {
Matrix4.translationValues(box!.width / 2, box!.height / 2, 0),
);
for (var dataSet in datasets) {
for (final dataSet in datasets) {
if (dataSet is PieDataSet) {
dataSet.paintBackground(context);
}
}
for (var dataSet in datasets) {
for (final dataSet in datasets) {
if (dataSet is PieDataSet) {
dataSet.paint(context);
}
}
for (var dataSet in datasets) {
for (final dataSet in datasets) {
if (dataSet is PieDataSet) {
dataSet.paintLegend(context);
}
... ...
... ... @@ -121,7 +121,7 @@ class Document {
Future<Uint8List> save() async {
if (!_paint) {
for (var page in _pages) {
for (final page in _pages) {
page.postProcess(this);
}
_paint = true;
... ...
... ... @@ -118,7 +118,7 @@ class Flex extends MultiChildWidget with SpanningWidget {
var inflexibleSpace = 0.0;
var maxFlexFractionSoFar = 0.0;
for (var child in children) {
for (final child in children) {
final flex = child is Flexible ? child.flex : 0;
totalFlex += flex;
if (flex > 0) {
... ... @@ -140,7 +140,7 @@ class Flex extends MultiChildWidget with SpanningWidget {
var totalFlex = 0;
var inflexibleSpace = 0.0;
var maxCrossSize = 0.0;
for (var child in children) {
for (final child in children) {
final flex = child is Flexible ? child.flex : 0;
totalFlex += flex;
double? mainSize;
... ... @@ -167,7 +167,7 @@ class Flex extends MultiChildWidget with SpanningWidget {
math.max(0.0, (availableMainSpace! - inflexibleSpace) / totalFlex);
// Size remaining (flexible) items, find the maximum cross size.
for (var child in children) {
for (final child in children) {
final flex = child is Flexible ? child.flex : 0;
if (flex > 0) {
maxCrossSize =
... ... @@ -241,7 +241,7 @@ class Flex extends MultiChildWidget with SpanningWidget {
var allocatedSize = 0.0; // Sum of the sizes of the non-flexible children.
var index = _context.firstChild;
for (var child in children.sublist(_context.firstChild)) {
for (final child in children.sublist(_context.firstChild)) {
final flex = child is Flexible ? child.flex : 0;
final fit = child is Flexible ? child.fit : FlexFit.loose;
if (flex > 0) {
... ... @@ -305,7 +305,7 @@ class Flex extends MultiChildWidget with SpanningWidget {
final spacePerFlex =
canFlex && totalFlex > 0 ? (freeSpace / totalFlex) : double.nan;
for (var child in children) {
for (final child in children) {
final flex = child is Flexible ? child.flex : 0;
final fit = child is Flexible ? child.fit : FlexFit.loose;
if (flex > 0) {
... ...
... ... @@ -162,7 +162,7 @@ class GridView extends MultiChildWidget with SpanningWidget {
var c = 0;
_context.lastChild = _context.firstChild;
for (var child in children.sublist(
for (final child in children.sublist(
_context.firstChild,
math.min(children.length,
_context.firstChild + crossAxisCount * _mainAxisCount!))) {
... ...
... ... @@ -368,7 +368,7 @@ class MultiPage extends Page {
final pageWidthMargin = _mustRotate ? _margin.vertical : _margin.horizontal;
final availableWidth = pageWidth - pageWidthMargin;
for (var page in _pages) {
for (final page in _pages) {
var offsetStart = pageHeight -
(_mustRotate ? pageHeightMargin - _margin.bottom : _margin.top);
var offsetEnd =
... ... @@ -386,7 +386,7 @@ class MultiPage extends Page {
var totalFlex = 0;
var allocatedSize = 0.0;
Widget? lastFlexChild;
for (var widget in page.widgets) {
for (final widget in page.widgets) {
final child = widget.child;
final flex = child is Flexible ? child.flex : 0;
if (flex > 0) {
... ... @@ -467,7 +467,7 @@ class MultiPage extends Page {
}
}
for (var widget in page.widgets) {
for (final widget in page.widgets) {
final child = widget.child;
final flex = child is Flexible ? child.flex : 0;
... ... @@ -505,7 +505,7 @@ class MultiPage extends Page {
}
var pos = offsetStart - leadingSpace;
for (var widget in page.widgets) {
for (final widget in page.widgets) {
pos -= widget.child.box!.height;
late double x;
switch (crossAxisAlignment) {
... ...
... ... @@ -135,7 +135,7 @@ class Partitions extends Widget with SpanningWidget {
// Calculate fixed width columns
var index = 0;
for (var child in children) {
for (final child in children) {
if (child.flex > 0) {
assert(() {
if (!canFlex) {
... ... @@ -160,7 +160,7 @@ class Partitions extends Widget with SpanningWidget {
final spacePerFlex = freeSpace / totalFlex;
index = 0;
for (var child in children) {
for (final child in children) {
if (child.flex > 0) {
final childExtent = spacePerFlex * child.flex;
allocatedSize += childExtent;
... ... @@ -173,7 +173,7 @@ class Partitions extends Widget with SpanningWidget {
// Layout the columns and compute the total height
var totalHeight = 0.0;
index = 0;
for (var child in children) {
for (final child in children) {
if (widths[index]! > 0) {
final innerConstraints = BoxConstraints(
minWidth: widths[index]!,
... ... @@ -190,7 +190,7 @@ class Partitions extends Widget with SpanningWidget {
// Update Y positions
index = 0;
allocatedSize = 0.0;
for (var child in children) {
for (final child in children) {
if (widths[index]! > 0) {
final offsetY = totalHeight - child.box!.height;
child.box = PdfRect.fromPoints(
... ... @@ -213,7 +213,7 @@ class Partitions extends Widget with SpanningWidget {
context.canvas
..saveContext()
..setTransform(mat);
for (var child in children) {
for (final child in children) {
child.paint(context);
}
context.canvas.restoreContext();
... ...
... ... @@ -147,7 +147,7 @@ class Stack extends MultiChildWidget {
break;
}
for (var child in children) {
for (final child in children) {
if (child is! Positioned) {
hasNonPositionedChildren = true;
... ... @@ -168,7 +168,7 @@ class Stack extends MultiChildWidget {
box = PdfRect.fromPoints(PdfPoint.zero, constraints.biggest);
}
for (var child in children) {
for (final child in children) {
if (child is! Positioned) {
child.box = PdfRect.fromPoints(
alignment.inscribe(child.box!.size, box!).offset, child.box!.size);
... ... @@ -232,7 +232,7 @@ class Stack extends MultiChildWidget {
..drawRect(0, 0, box!.width, box!.height)
..clipPath();
}
for (var child in children) {
for (final child in children) {
child.paint(context);
}
context.canvas.restoreContext();
... ...
... ... @@ -108,7 +108,7 @@ class TableBorder extends Border {
if (verticalInside.style.paint) {
verticalInside.style.setStyle(context);
var offset = box.x;
for (var width in widths!.sublist(0, widths.length - 1)) {
for (final width in widths!.sublist(0, widths.length - 1)) {
offset += width!;
context.canvas.moveTo(offset, box.y);
context.canvas.lineTo(offset, box.top);
... ... @@ -123,7 +123,7 @@ class TableBorder extends Border {
if (horizontalInside.style.paint) {
horizontalInside.style.setStyle(context);
var offset = box.top;
for (var height in heights!.sublist(0, heights.length - 1)) {
for (final height in heights!.sublist(0, heights.length - 1)) {
offset -= height;
context.canvas.moveTo(box.x, offset);
context.canvas.lineTo(box.right, offset);
... ... @@ -437,9 +437,9 @@ class Table extends Widget with SpanningWidget {
_heights.clear();
var index = 0;
for (var row in children) {
for (final row in children) {
var n = 0;
for (var child in row.children) {
for (final child in row.children) {
final columnWidth = columnWidths != null && columnWidths![n] != null
? columnWidths![n]!
: defaultColumnWidth;
... ... @@ -495,7 +495,7 @@ class Table extends Widget with SpanningWidget {
// Compute final widths
var totalHeight = 0.0;
index = 0;
for (var row in children) {
for (final row in children) {
if (index++ < _context.firstLine && !row.repeat) {
continue;
}
... ... @@ -504,7 +504,7 @@ class Table extends Widget with SpanningWidget {
var x = 0.0;
var lineHeight = 0.0;
for (var child in row.children) {
for (final child in row.children) {
final childConstraints = BoxConstraints.tightFor(width: _widths[n]);
child.layout(context, childConstraints);
assert(child.box != null);
... ... @@ -521,7 +521,7 @@ class Table extends Widget with SpanningWidget {
// Compute the layout again to give the full height to all cells
n = 0;
x = 0;
for (var child in row.children) {
for (final child in row.children) {
final childConstraints =
BoxConstraints.tightFor(width: _widths[n], height: lineHeight);
child.layout(context, childConstraints);
... ... @@ -545,14 +545,14 @@ class Table extends Widget with SpanningWidget {
// Compute final y position
index = 0;
var heightIndex = 0;
for (var row in children) {
for (final row in children) {
if (index++ < _context.firstLine && !row.repeat) {
continue;
}
final align = row.verticalAlignment ?? defaultVerticalAlignment;
for (var child in row.children) {
for (final child in row.children) {
double? childY;
switch (align) {
... ... @@ -602,7 +602,7 @@ class Table extends Widget with SpanningWidget {
..setTransform(mat);
var index = 0;
for (var row in children) {
for (final row in children) {
if (index++ < _context.firstLine && !row.repeat) {
continue;
}
... ... @@ -610,7 +610,7 @@ class Table extends Widget with SpanningWidget {
if (row.decoration != null) {
var y = double.infinity;
var h = 0.0;
for (var child in row.children) {
for (final child in row.children) {
y = math.min(y, child.box!.y);
h = math.max(h, child.box!.height);
}
... ... @@ -621,7 +621,7 @@ class Table extends Widget with SpanningWidget {
);
}
for (var child in row.children) {
for (final child in row.children) {
context.canvas
..saveContext()
..drawRect(
... ... @@ -636,7 +636,7 @@ class Table extends Widget with SpanningWidget {
}
index = 0;
for (var row in children) {
for (final row in children) {
if (index++ < _context.firstLine && !row.repeat) {
continue;
}
... ... @@ -644,7 +644,7 @@ class Table extends Widget with SpanningWidget {
if (row.decoration != null) {
var y = double.infinity;
var h = 0.0;
for (var child in row.children) {
for (final child in row.children) {
y = math.min(y, child.box!.y);
h = math.max(h, child.box!.height);
}
... ...
... ... @@ -458,16 +458,16 @@ class TextSpan extends InlineSpan {
AnnotationBuilder? annotation,
) {
final _style = parentStyle?.merge(style);
final _a = this.annotation ?? annotation;
final _annotation = this.annotation ?? annotation;
if (text != null) {
if (!visitor(this, _style, _a)) {
if (!visitor(this, _style, _annotation)) {
return false;
}
}
if (children != null) {
for (var child in children!) {
if (!child.visitChildren(visitor, _style, _a)) {
for (final child in children!) {
if (!child.visitChildren(visitor, _style, _annotation)) {
return false;
}
}
... ... @@ -534,7 +534,7 @@ class _Line {
}
delta = (totalWidth - wordsWidth) / (spans.length - 1);
var x = 0.0;
for (var span in spans) {
for (final span in spans) {
span.offset = span.offset.translate(x, -baseline);
x += delta;
}
... ... @@ -542,7 +542,7 @@ class _Line {
}
if (textDirection == TextDirection.rtl) {
for (var span in spans) {
for (final span in spans) {
span.offset = PdfPoint(
totalWidth - (span.offset.x + span.width) - delta,
span.offset.y - baseline,
... ... @@ -552,7 +552,7 @@ class _Line {
return;
}
for (var span in spans) {
for (final span in spans) {
span.offset = span.offset.translate(delta, -baseline);
}
... ... @@ -978,7 +978,7 @@ class RichText extends Widget with SpanningWidget {
..clipPath();
}
for (var decoration in _decorations) {
for (final decoration in _decorations) {
assert(() {
if (Document.debug && RichText.debug) {
decoration.debugPaint(context, textScaleFactor, box!, _spans);
... ... @@ -994,7 +994,7 @@ class RichText extends Widget with SpanningWidget {
);
}
for (var span in _spans.sublist(_context.spanStart, _context.spanEnd)) {
for (final span in _spans.sublist(_context.spanStart, _context.spanEnd)) {
assert(() {
if (Document.debug && RichText.debug) {
span.debugPaint(context, textScaleFactor, box);
... ... @@ -1018,7 +1018,7 @@ class RichText extends Widget with SpanningWidget {
);
}
for (var decoration in _decorations) {
for (final decoration in _decorations) {
decoration.foregroundPaint(
context,
textScaleFactor,
... ...
... ... @@ -35,7 +35,7 @@ class TextDecoration {
/// Creates a decoration that paints the union of all the given decorations.
factory TextDecoration.combine(List<TextDecoration> decorations) {
var mask = 0;
for (var decoration in decorations) {
for (final decoration in decorations) {
mask |= decoration._mask;
}
return TextDecoration._(mask);
... ...
... ... @@ -192,7 +192,7 @@ class Wrap extends MultiChildWidget with SpanningWidget {
var runCrossAxisExtent = 0.0;
var childCount = 0;
for (var child in children.sublist(_context.firstChild)) {
for (final child in children.sublist(_context.firstChild)) {
child.layout(context, childConstraints, parentUsesSize: true);
final childMainAxisExtent = _getMainAxisExtent(child)!;
... ... @@ -339,7 +339,7 @@ class Wrap extends MultiChildWidget with SpanningWidget {
}
var currentWidget = _context.lastChild;
for (var child in children.sublist(currentWidget)) {
for (final child in children.sublist(currentWidget)) {
final runIndex = childRunMetrics[child];
if (runIndex != i) {
break;
... ...
... ... @@ -460,7 +460,7 @@ void main() {
),
);
for (var item in cases) {
for (final item in cases) {
expect(
arabic.convert(item.original).codeUnits,
equals(item.reshaped),
... ...
... ... @@ -107,7 +107,7 @@ void main() {
final fontData = ttfFont.readAsBytesSync();
final font = PdfTtfFont(pdf.document, fontData.buffer.asByteData());
for (var letter in
for (final letter in
//font.font.charToGlyphIndexMap.keys
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz&%!?0123456789'
.codeUnits) {
... ...
... ... @@ -54,8 +54,8 @@ void main() {
final image = generateBitmap(100, 200);
final widgets = <Widget>[];
for (var shape in BoxShape.values) {
for (var fit in BoxFit.values) {
for (final shape in BoxShape.values) {
for (final fit in BoxFit.values) {
widgets.add(
Container(
alignment: Alignment.center,
... ...
... ... @@ -30,7 +30,7 @@ List<TableRow> buildTable(
final rows = <TableRow>[];
{
final tableRow = <Widget>[];
for (var cell in <String>['Hue', 'Color', 'RGBA']) {
for (final cell in <String>['Hue', 'Color', 'RGBA']) {
tableRow.add(Container(
alignment: Alignment.center,
margin: const EdgeInsets.all(5),
... ...
... ... @@ -32,7 +32,7 @@ Iterable<TextDecoration> permute(
List<TextDecoration> prefix, List<TextDecoration> remaining) sync* {
yield TextDecoration.combine(prefix);
if (remaining.isNotEmpty) {
for (var decoration in remaining) {
for (final decoration in remaining) {
final next = List<TextDecoration>.from(remaining);
next.remove(decoration);
yield* permute(prefix + <TextDecoration>[decoration], next);
... ... @@ -99,7 +99,7 @@ void main() {
final para = LoremText().paragraph(40);
final widgets = <Widget>[];
for (var align in TextAlign.values) {
for (final align in TextAlign.values) {
widgets.add(
Text(
'$align:\n' + para,
... ... @@ -191,8 +191,8 @@ void main() {
),
);
for (var decorationStyle in TextDecorationStyle.values) {
for (var decoration in decorationSet) {
for (final decorationStyle in TextDecorationStyle.values) {
for (final decoration in decorationSet) {
widgets.add(
Text(
decoration.toString().replaceAll('.', ' '),
... ... @@ -217,7 +217,7 @@ void main() {
final para = LoremText(random: rnd).paragraph(40);
final spans = <TextSpan>[];
for (var word in para.split(' ')) {
for (final word in para.split(' ')) {
spans.add(
TextSpan(
text: word,
... ...
... ... @@ -31,9 +31,9 @@ void main() {
test('Wrap Widget Horizontal 1', () {
final wraps = <Widget>[];
for (var direction in VerticalDirection.values) {
for (final direction in VerticalDirection.values) {
wraps.add(Text('$direction'));
for (var alignment in WrapAlignment.values) {
for (final alignment in WrapAlignment.values) {
wraps.add(Text('$alignment'));
wraps.add(
Wrap(
... ... @@ -63,9 +63,9 @@ void main() {
test('Wrap Widget Vertical 1', () {
final wraps = <Widget>[];
for (var direction in VerticalDirection.values) {
for (final direction in VerticalDirection.values) {
wraps.add(Transform.rotateBox(child: Text('$direction'), angle: 1.57));
for (var alignment in WrapAlignment.values) {
for (final alignment in WrapAlignment.values) {
wraps.add(Transform.rotateBox(child: Text('$alignment'), angle: 1.57));
wraps.add(
Wrap(
... ... @@ -95,7 +95,7 @@ void main() {
test('Wrap Widget Horizontal 2', () {
final wraps = <Widget>[];
for (var alignment in WrapCrossAlignment.values) {
for (final alignment in WrapCrossAlignment.values) {
final rnd = math.Random(42);
wraps.add(Text('$alignment'));
wraps.add(
... ... @@ -129,7 +129,7 @@ void main() {
test('Wrap Widget Vertical 2', () {
final wraps = <Widget>[];
for (var alignment in WrapCrossAlignment.values) {
for (final alignment in WrapCrossAlignment.values) {
final rnd = math.Random(42);
wraps.add(Transform.rotateBox(child: Text('$alignment'), angle: 1.57));
wraps.add(
... ... @@ -163,7 +163,7 @@ void main() {
test('Wrap Widget Horizontal 3', () {
final wraps = <Widget>[];
for (var alignment in WrapAlignment.values) {
for (final alignment in WrapAlignment.values) {
final rnd = math.Random(42);
wraps.add(Text('$alignment'));
wraps.add(
... ... @@ -199,7 +199,7 @@ void main() {
test('Wrap Widget Vertical 3', () {
final wraps = <Widget>[];
for (var alignment in WrapAlignment.values) {
for (final alignment in WrapAlignment.values) {
final rnd = math.Random(42);
wraps.add(Transform.rotateBox(child: Text('$alignment'), angle: 1.57));
wraps.add(
... ...