89 lines
2.3 KiB
Dart
89 lines
2.3 KiB
Dart
|
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:forui/forui.dart';
|
||
|
|
|
||
|
|
import '../../../shared/constants/breakpoints.dart';
|
||
|
|
import '../../../shared/widgets/frosted_panel.dart';
|
||
|
|
|
||
|
|
class SectionContainer extends StatelessWidget {
|
||
|
|
final String title;
|
||
|
|
final Widget child;
|
||
|
|
final bool embedded;
|
||
|
|
final bool leadingDivider;
|
||
|
|
|
||
|
|
|
||
|
|
final Widget? leading;
|
||
|
|
|
||
|
|
const SectionContainer({
|
||
|
|
super.key,
|
||
|
|
required this.title,
|
||
|
|
required this.child,
|
||
|
|
this.embedded = false,
|
||
|
|
this.leadingDivider = false,
|
||
|
|
this.leading,
|
||
|
|
});
|
||
|
|
|
||
|
|
static double hPadOf(BuildContext context) =>
|
||
|
|
MediaQuery.sizeOf(context).width < Breakpoints.detail ? 16.0 : 32.0;
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
final hPad = embedded ? 0.0 : hPadOf(context);
|
||
|
|
final innerPad = embedded ? 0.0 : hPadOf(context);
|
||
|
|
final compact = MediaQuery.sizeOf(context).width < Breakpoints.compact;
|
||
|
|
|
||
|
|
final content = Column(
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
|
children: [
|
||
|
|
Padding(
|
||
|
|
padding: EdgeInsets.fromLTRB(
|
||
|
|
innerPad,
|
||
|
|
0,
|
||
|
|
innerPad,
|
||
|
|
compact ? 12 : 16,
|
||
|
|
),
|
||
|
|
child: Text(
|
||
|
|
title,
|
||
|
|
style: TextStyle(
|
||
|
|
fontSize: compact ? 17 : 20,
|
||
|
|
fontWeight: FontWeight.w600,
|
||
|
|
color: Colors.white.withValues(alpha: 0.9),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
child,
|
||
|
|
],
|
||
|
|
);
|
||
|
|
|
||
|
|
if (embedded) {
|
||
|
|
if (leading != null) {
|
||
|
|
return Column(
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
|
children: [leading!, content],
|
||
|
|
);
|
||
|
|
}
|
||
|
|
if (leadingDivider) {
|
||
|
|
return Column(
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||
|
|
children: [
|
||
|
|
const FDivider(style: .delta(color: Color(0x1AFFFFFF), padding: .value(EdgeInsets.symmetric(vertical: 24)))),
|
||
|
|
content,
|
||
|
|
],
|
||
|
|
);
|
||
|
|
}
|
||
|
|
return content;
|
||
|
|
}
|
||
|
|
|
||
|
|
return Padding(
|
||
|
|
padding: EdgeInsets.symmetric(horizontal: hPad),
|
||
|
|
child: FrostedPanel(
|
||
|
|
radius: 16,
|
||
|
|
padding: EdgeInsets.symmetric(vertical: hPad),
|
||
|
|
blurSigma: 15,
|
||
|
|
border: Border.all(color: Colors.white.withValues(alpha: 0.08)),
|
||
|
|
color: Colors.black.withValues(alpha: 0.3),
|
||
|
|
child: content,
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|