💄 Optimize settings buttons
This commit is contained in:
@@ -250,62 +250,82 @@ 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;
|
||||||
Card(
|
const spacing = 8.0;
|
||||||
margin: EdgeInsets.zero,
|
const padding = 24.0; // 12 * 2
|
||||||
child: InkWell(
|
final totalMin = 3 * minWidth + 2 * spacing;
|
||||||
borderRadius: BorderRadius.circular(8),
|
final availableWidth = constraints.maxWidth - padding;
|
||||||
|
final children = [
|
||||||
|
Card(
|
||||||
|
margin: EdgeInsets.zero,
|
||||||
|
child: InkWell(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
child: Row(
|
||||||
|
spacing: 8,
|
||||||
|
children: [
|
||||||
|
Icon(Symbols.settings, size: 20),
|
||||||
|
Text('appSettings').tr().fontSize(13).bold(),
|
||||||
|
],
|
||||||
|
).padding(horizontal: 16, vertical: 12),
|
||||||
|
onTap: () {
|
||||||
|
context.pushNamed('settings');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Card(
|
||||||
|
margin: EdgeInsets.zero,
|
||||||
|
child: InkWell(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
child: Row(
|
||||||
|
spacing: 8,
|
||||||
|
children: [
|
||||||
|
Icon(Symbols.person_edit, size: 20),
|
||||||
|
Text('updateYourProfile').tr().fontSize(13).bold(),
|
||||||
|
],
|
||||||
|
).padding(horizontal: 16, vertical: 12),
|
||||||
|
onTap: () {
|
||||||
|
context.pushNamed('profileUpdate');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Card(
|
||||||
|
margin: EdgeInsets.zero,
|
||||||
|
child: InkWell(
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
child: Row(
|
||||||
|
spacing: 8,
|
||||||
|
children: [
|
||||||
|
Icon(Symbols.manage_accounts, size: 20),
|
||||||
|
Text('accountSettings').tr().fontSize(13).bold(),
|
||||||
|
],
|
||||||
|
).padding(horizontal: 16, vertical: 12),
|
||||||
|
onTap: () {
|
||||||
|
context.pushNamed('accountSettings');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
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(
|
child: Row(
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
children: [
|
children: children.map((child) => SizedBox(width: minWidth, child: child)).toList(),
|
||||||
Icon(Symbols.settings, size: 20),
|
).padding(horizontal: 12),
|
||||||
Text('appSettings').tr().fontSize(13).bold(),
|
).height(48);
|
||||||
],
|
}
|
||||||
).padding(horizontal: 16, vertical: 12),
|
},
|
||||||
onTap: () {
|
),
|
||||||
context.pushNamed('settings');
|
),
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Card(
|
|
||||||
margin: EdgeInsets.zero,
|
|
||||||
child: InkWell(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
child: Row(
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
Icon(Symbols.person_edit, size: 20),
|
|
||||||
Text('updateYourProfile').tr().fontSize(13).bold(),
|
|
||||||
],
|
|
||||||
).padding(horizontal: 16, vertical: 12),
|
|
||||||
onTap: () {
|
|
||||||
context.pushNamed('profileUpdate');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Card(
|
|
||||||
margin: EdgeInsets.zero,
|
|
||||||
child: InkWell(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
child: Row(
|
|
||||||
spacing: 8,
|
|
||||||
children: [
|
|
||||||
Icon(Symbols.manage_accounts, size: 20),
|
|
||||||
Text('accountSettings').tr().fontSize(13).bold(),
|
|
||||||
],
|
|
||||||
).padding(horizontal: 16, vertical: 12),
|
|
||||||
onTap: () {
|
|
||||||
context.pushNamed('accountSettings');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
).padding(horizontal: 12),
|
|
||||||
).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