madari-oss/lib/widgets/bottom_sheet.dart
Madari Developers 16fe4a653f Project import generated by Copybara.
GitOrigin-RevId: 829626e92d5dba6a4586d1e7c4bd1615ec396e88
2025-01-02 18:46:26 +00:00

78 lines
2 KiB
Dart

import 'package:flutter/material.dart';
class BottomSheetWrapper extends StatefulWidget {
final String title;
final String description;
final Widget child;
const BottomSheetWrapper({
super.key,
required this.title,
required this.description,
required this.child,
});
@override
State<BottomSheetWrapper> createState() => _BottomSheetWrapperState();
}
class _BottomSheetWrapperState extends State<BottomSheetWrapper> {
@override
Widget build(BuildContext context) {
return Container(
constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height * 0.85,
minHeight: MediaQuery.of(context).size.height * 0.5,
),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
borderRadius: const BorderRadius.vertical(top: Radius.circular(28)),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
_buildBottomSheetHandle(),
_buildHeader(context),
widget.child,
],
),
);
}
Widget _buildBottomSheetHandle() {
return Padding(
padding: const EdgeInsets.only(top: 12, bottom: 8),
child: Container(
width: 32,
height: 4,
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.circular(2),
),
),
);
}
Widget _buildHeader(BuildContext context) {
return Container(
padding: const EdgeInsets.fromLTRB(24, 8, 24, 16),
child: Column(
children: [
Text(
widget.title,
style: Theme.of(context).textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 8),
Text(
widget.description,
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
color: Colors.grey[600],
),
),
],
),
);
}
}