aves/lib/widgets/viewer/overlay/details/expander.dart
2023-01-26 23:04:56 +01:00

33 lines
862 B
Dart

import 'package:flutter/material.dart';
class OverlayRowExpander extends StatelessWidget {
final ValueNotifier<bool> expandedNotifier;
final Widget child;
const OverlayRowExpander({
super.key,
required this.expandedNotifier,
required this.child,
});
@override
Widget build(BuildContext context) {
return ValueListenableBuilder<bool>(
valueListenable: expandedNotifier,
builder: (context, expanded, child) {
final parent = DefaultTextStyle.of(context);
return DefaultTextStyle(
key: key,
style: parent.style,
textAlign: parent.textAlign,
softWrap: expanded,
overflow: parent.overflow,
maxLines: expanded ? null : 42,
textWidthBasis: parent.textWidthBasis,
child: child!,
);
},
child: child,
);
}
}