marcglasberg/assorted_layout_widgets

FitHorizontally different vertical alignment when text is scaled

Closed this issue · 1 comments

Hello,

when the text is too long and it gets scaled it seems with some layouts that the vertical alignment of FitHorizontally becomes a top-alignment. I don't know the reason for this.

main.dart:

import 'package:flutter/material.dart';
import 'package:assorted_layout_widgets/assorted_layout_widgets.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: Scaffold(
        body: Container(
          height: 100,
          child: Row(
            children: <Widget>[
              Column(
                children: <Widget>[
                  Container(
                    width: 100,
                    child: FitHorizontally(
                      child: TextOneLine("text"),
                    ),
                  ),
                ],
              ),
              Column(
                children: <Widget>[
                  Container(
                    width: 100,
                    child: FitHorizontally(
                      child: TextOneLine("looooooooooooooooooooooooooooong"),
                    ),
                  ),
                ],
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Which results in:

FitHorizontally

@strohhut There was a bug under some situations, which is now fixed. I am sorry it has taken me that long.