95 lines
3.0 KiB
Dart
95 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class PersistentTacticalSheetWrapper extends StatelessWidget {
|
|
final String title;
|
|
final IconData icon;
|
|
final bool isMinimized;
|
|
final VoidCallback onToggleMinimize;
|
|
final VoidCallback onClose;
|
|
final Widget child;
|
|
|
|
const PersistentTacticalSheetWrapper({
|
|
super.key,
|
|
required this.title,
|
|
required this.icon,
|
|
required this.isMinimized,
|
|
required this.onToggleMinimize,
|
|
required this.onClose,
|
|
required this.child,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AnimatedContainer(
|
|
duration: const Duration(milliseconds: 300),
|
|
curve: Curves.easeOutCubic,
|
|
constraints: BoxConstraints(
|
|
maxHeight: isMinimized ? 60.0 : MediaQuery.of(context).size.height * 0.85,
|
|
),
|
|
margin: const EdgeInsets.only(top: 10),
|
|
decoration: const BoxDecoration(
|
|
color: Color(0xF50F172A),
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(24)),
|
|
border: Border(top: BorderSide(color: Color(0xFF0071E3), width: 2)),
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
// Header (always visible)
|
|
GestureDetector(
|
|
onVerticalDragUpdate: (details) {
|
|
if (details.delta.dy > 5 && !isMinimized) {
|
|
onToggleMinimize();
|
|
} else if (details.delta.dy < -5 && isMinimized) {
|
|
onToggleMinimize();
|
|
}
|
|
},
|
|
onTap: onToggleMinimize,
|
|
child: Container(
|
|
height: 60,
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
color: Colors.transparent, // Capture taps
|
|
child: Row(
|
|
children: [
|
|
Icon(icon, color: const Color(0xFF38BDF8), size: 24),
|
|
const SizedBox(width: 12),
|
|
Expanded(
|
|
child: Text(
|
|
title,
|
|
style: const TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
IconButton(
|
|
icon: Icon(
|
|
isMinimized ? Icons.expand_less : Icons.expand_more,
|
|
color: Colors.white70,
|
|
),
|
|
onPressed: onToggleMinimize,
|
|
),
|
|
IconButton(
|
|
icon: const Icon(Icons.close, color: Colors.white70),
|
|
onPressed: onClose,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
|
|
// Body (animates height)
|
|
if (!isMinimized)
|
|
Flexible(
|
|
child: ClipRRect(
|
|
borderRadius: const BorderRadius.vertical(bottom: Radius.circular(0)),
|
|
child: child,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|