/
main_row_super_with_fit_horizontally.dart
119 lines (112 loc) · 3.68 KB
/
main_row_super_with_fit_horizontally.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
import 'package:assorted_layout_widgets/assorted_layout_widgets.dart';
import 'package:flutter/material.dart';
void main() => runApp(const MaterialApp(home: Demo()));
class Demo extends StatelessWidget {
const Demo({super.key});
@override
Widget build(BuildContext context) {
//
return Scaffold(
appBar: AppBar(title: const Text('RowSuper with FitHorizontally Example')),
body: Center(
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
//
const SizedBox(height: 10),
//
for (double width = 360; width >= 0.0; width -= 100)
Column(children: [
const SizedBox(height: 8),
//
// fitHorizontally: false
Container(
alignment: Alignment.centerLeft,
width: width,
height: 55,
color: Colors.yellow[600],
child: RowSuper(
separator: separator(),
outerDistance: 6.0,
innerDistance: 12.0,
fitHorizontally: false,
children: [
text1(),
text2(),
text3(),
],
),
),
//
// fitHorizontally: true
// (shrinkLimit is the default: 67%)
Container(
alignment: Alignment.centerLeft,
width: width,
height: 55,
color: Colors.yellow[500],
child: RowSuper(
separator: separator(),
outerDistance: 6.0,
innerDistance: 12.0,
fitHorizontally: true,
children: [
text1(),
text2(),
text3(),
],
),
),
// fitHorizontally: true
// shrinkLimit: 0.0
Container(
alignment: Alignment.centerLeft,
width: width,
height: 55,
color: Colors.yellow[300],
child: RowSuper(
separator: separator(),
outerDistance: 6.0,
innerDistance: 12.0,
fitHorizontally: true,
shrinkLimit: 0.0,
children: [
text1(),
text2(),
text3(),
],
),
),
]),
//
],
),
),
),
);
}
Container separator() => Container(width: 2, height: 50, color: Colors.black26);
Text text1() => const Text(
"So long",
overflow: TextOverflow.fade,
style: TextStyle(fontSize: 20, color: Colors.blue),
maxLines: 1,
softWrap: false,
);
Text text2() => const Text(
"farewell",
overflow: TextOverflow.fade,
style: TextStyle(fontSize: 20, color: Colors.red),
maxLines: 1,
softWrap: false,
);
Text text3() => const Text(
"auf Wiedersehen",
overflow: TextOverflow.fade,
style: TextStyle(fontSize: 20, color: Colors.red),
maxLines: 1,
softWrap: false,
);
}