Files
doddle/lib/presentation/common/widgets/popover.dart
2025-01-10 08:01:23 +02:00

74 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:sizer/sizer.dart';
class Popover extends StatefulWidget {
const Popover({
Key? key,
this.child,
}): super(key: key);
final Widget? child;
@override
State<Popover> createState() => _PopoverState();
}
class _PopoverState extends State<Popover> with SingleTickerProviderStateMixin {
Widget _buildHandle(BuildContext context) {
final theme = Theme.of(context);
return SizedBox(
width: double.infinity,
child: Stack(
alignment: Alignment.topCenter,
children: [
FractionallySizedBox(
widthFactor: 0.25,
child: Container(
margin: const EdgeInsets.symmetric(
vertical: 12.0,
),
child: Container(
height: 5.0,
decoration: BoxDecoration(
color: theme.dividerColor,
borderRadius: const BorderRadius.all(Radius.circular(2.5)),
),
),
),
),
],
),
);
}
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Container(
margin: const EdgeInsets.all(16.0),
clipBehavior: Clip.antiAlias,
constraints: BoxConstraints(
maxWidth: 90.w,
maxHeight: 93.h
),
decoration: BoxDecoration(
color: theme.cardColor,
borderRadius: const BorderRadius.all(Radius.circular(16.0)),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
_buildHandle(context),
Flexible(
child: SingleChildScrollView(
child: widget.child,
),
),
],
),
);
}
}