adguard-home-manager/lib/widgets/list_bottom_sheet.dart

83 lines
2.5 KiB
Dart
Raw Normal View History

2024-01-27 23:08:04 +01:00
import 'package:flutter/material.dart';
class ListBottomSheet extends StatelessWidget {
final IconData icon;
final String title;
final List<Widget> children;
2024-01-30 01:04:06 +01:00
final double? initialChildSize;
final double? minChildSize;
final double? maxChildSize;
2024-01-27 23:08:04 +01:00
const ListBottomSheet({
super.key,
required this.icon,
required this.title,
2024-01-30 01:04:06 +01:00
required this.children,
this.initialChildSize,
this.maxChildSize,
this.minChildSize,
2024-01-27 23:08:04 +01:00
});
@override
Widget build(BuildContext context) {
2024-02-03 02:38:00 +01:00
return DraggableScrollableSheet(
initialChildSize: initialChildSize ?? 0.6,
minChildSize: minChildSize ?? 0.3,
maxChildSize: maxChildSize ?? 1,
builder: (context, controller) {
return Container(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(28),
topRight: Radius.circular(28),
2024-01-27 23:08:04 +01:00
),
2024-02-03 02:38:00 +01:00
),
child: SafeArea(
child: ListView(
controller: controller,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
margin: const EdgeInsets.all(16),
width: 36,
height: 4,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Colors.grey
),
),
],
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 16),
child: Column(
2024-01-27 23:08:04 +01:00
children: [
2024-02-03 02:38:00 +01:00
Icon(
icon,
size: 24,
color: Theme.of(context).listTileTheme.iconColor
),
const SizedBox(height: 16),
Text(
title,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 24,
color: Theme.of(context).colorScheme.onSurface
2024-01-27 23:08:04 +01:00
),
),
],
),
2024-02-03 02:38:00 +01:00
),
...children
],
2024-01-27 23:08:04 +01:00
),
2024-02-03 02:38:00 +01:00
),
);
},
2024-01-27 23:08:04 +01:00
);
}
}