💄 Optimize settings buttons
This commit is contained in:
@@ -250,11 +250,16 @@ class AccountScreen extends HookConsumerWidget {
|
|||||||
],
|
],
|
||||||
).padding(horizontal: 12),
|
).padding(horizontal: 12),
|
||||||
const SizedBox.shrink(),
|
const SizedBox.shrink(),
|
||||||
SingleChildScrollView(
|
ConstrainedBox(
|
||||||
scrollDirection: Axis.horizontal,
|
constraints: BoxConstraints(maxWidth: MediaQuery.of(context).size.width),
|
||||||
child: Row(
|
child: LayoutBuilder(
|
||||||
spacing: 8,
|
builder: (context, constraints) {
|
||||||
children: [
|
const minWidth = 160.0;
|
||||||
|
const spacing = 8.0;
|
||||||
|
const padding = 24.0; // 12 * 2
|
||||||
|
final totalMin = 3 * minWidth + 2 * spacing;
|
||||||
|
final availableWidth = constraints.maxWidth - padding;
|
||||||
|
final children = [
|
||||||
Card(
|
Card(
|
||||||
margin: EdgeInsets.zero,
|
margin: EdgeInsets.zero,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
@@ -303,9 +308,24 @@ class AccountScreen extends HookConsumerWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
];
|
||||||
|
if (availableWidth > totalMin) {
|
||||||
|
return Row(
|
||||||
|
spacing: 8,
|
||||||
|
children: children.map((child) => Expanded(child: child)).toList(),
|
||||||
|
).padding(horizontal: 12).height(48);
|
||||||
|
} else {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: Row(
|
||||||
|
spacing: 8,
|
||||||
|
children: children.map((child) => SizedBox(width: minWidth, child: child)).toList(),
|
||||||
).padding(horizontal: 12),
|
).padding(horizontal: 12),
|
||||||
).height(48),
|
).height(48);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
minTileHeight: 48,
|
minTileHeight: 48,
|
||||||
leading: const Icon(Symbols.notifications),
|
leading: const Icon(Symbols.notifications),
|
||||||
|
|||||||
Reference in New Issue
Block a user