97 lines
2.6 KiB
Dart
97 lines
2.6 KiB
Dart
|
|
import 'package:flutter/material.dart';
|
||
|
|
|
||
|
|
void showEventifyBottomSheet(
|
||
|
|
BuildContext context, {
|
||
|
|
required String title,
|
||
|
|
required Widget child,
|
||
|
|
double initialSize = 0.5,
|
||
|
|
double minSize = 0.3,
|
||
|
|
double maxSize = 0.9,
|
||
|
|
bool isDismissible = true,
|
||
|
|
}) {
|
||
|
|
showModalBottomSheet(
|
||
|
|
context: context,
|
||
|
|
isScrollControlled: true,
|
||
|
|
isDismissible: isDismissible,
|
||
|
|
backgroundColor: Colors.transparent,
|
||
|
|
builder: (_) => DraggableScrollableSheet(
|
||
|
|
initialChildSize: initialSize,
|
||
|
|
minChildSize: minSize,
|
||
|
|
maxChildSize: maxSize,
|
||
|
|
expand: false,
|
||
|
|
builder: (_, scrollController) => _EventifyBottomSheetContent(
|
||
|
|
title: title,
|
||
|
|
child: child,
|
||
|
|
scrollController: scrollController,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
class _EventifyBottomSheetContent extends StatelessWidget {
|
||
|
|
const _EventifyBottomSheetContent({
|
||
|
|
required this.title,
|
||
|
|
required this.child,
|
||
|
|
required this.scrollController,
|
||
|
|
});
|
||
|
|
|
||
|
|
final String title;
|
||
|
|
final Widget child;
|
||
|
|
final ScrollController scrollController;
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
return Container(
|
||
|
|
decoration: const BoxDecoration(
|
||
|
|
color: Color(0xFF0F172A),
|
||
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
|
||
|
|
),
|
||
|
|
child: Column(
|
||
|
|
mainAxisSize: MainAxisSize.min,
|
||
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||
|
|
children: [
|
||
|
|
const SizedBox(height: 12),
|
||
|
|
Center(
|
||
|
|
child: Container(
|
||
|
|
width: 40,
|
||
|
|
height: 4,
|
||
|
|
decoration: BoxDecoration(
|
||
|
|
color: Colors.white24,
|
||
|
|
borderRadius: BorderRadius.circular(2),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
const SizedBox(height: 8),
|
||
|
|
Padding(
|
||
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||
|
|
child: Row(
|
||
|
|
children: [
|
||
|
|
Expanded(
|
||
|
|
child: Text(
|
||
|
|
title,
|
||
|
|
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||
|
|
fontWeight: FontWeight.w600,
|
||
|
|
color: Colors.white,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
),
|
||
|
|
IconButton(
|
||
|
|
icon: const Icon(Icons.close, color: Colors.white54),
|
||
|
|
onPressed: () => Navigator.pop(context),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
const Divider(color: Colors.white12, height: 1),
|
||
|
|
Expanded(
|
||
|
|
child: SingleChildScrollView(
|
||
|
|
controller: scrollController,
|
||
|
|
child: child,
|
||
|
|
),
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|