I am trying to divide a row into two columns with the following properties
Each column will have text with a maxLines of 1 and overflow: TextOverflow.ellipsis
Column 1 - label
Column 2 - value
The label will take a maximum of half the width The value should take the remaining available space
What happens in my code is that the value column gets a maximum of half the screen size even when the label is short
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Welcome to Flutter'),
),
body: const MyRow(),
),
);
}
}
class MyRow extends StatelessWidget {
const MyRow({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Flexible(
flex: 1,
child: Text('label:' * 1, maxLines: 1, overflow: TextOverflow.ellipsis),
),
Expanded(
flex: 1,
child: Text('1 2 3 ' * 100, maxLines: 1, overflow: TextOverflow.ellipsis),
),
],
);
}
}



