mirror of
https://github.com/madari-media/madari-oss.git
synced 2026-03-21 22:39:17 +00:00
78 lines
2 KiB
Dart
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],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|