redesign for settings page
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/pages/settings/profile/actions/constants.dart';
|
||||
|
||||
|
||||
class ProfileActionButtonsLayout extends StatelessWidget {
|
||||
const ProfileActionButtonsLayout({super.key, required this.children});
|
||||
|
||||
final List<Widget> children;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final isCompact =
|
||||
constraints.maxWidth <
|
||||
ProfileActionsLayoutConstants.compactBreakpoint;
|
||||
|
||||
if (isCompact) {
|
||||
return Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: ProfileActionsLayoutConstants.buttonWidth,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: _buildChildren(isCompact: true),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: _buildChildren(isCompact: false),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> _buildChildren({required bool isCompact}) {
|
||||
return [
|
||||
for (var index = 0; index < children.length; index++) ...[
|
||||
SizedBox(
|
||||
width: isCompact
|
||||
? double.infinity
|
||||
: ProfileActionsLayoutConstants.buttonWidth,
|
||||
child: children[index],
|
||||
),
|
||||
if (index != children.length - 1)
|
||||
SizedBox(
|
||||
width: isCompact ? 0 : ProfileActionsLayoutConstants.buttonGap,
|
||||
height: isCompact ? ProfileActionsLayoutConstants.buttonGap : 0,
|
||||
),
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user