Files

40 lines
1.1 KiB
Dart

import 'package:flutter/material.dart';
/// A native-themed affordance for a draggable pane divider.
class AdaptiveResizeGrip extends StatelessWidget {
const AdaptiveResizeGrip({
super.key,
this.axis = Axis.horizontal,
this.emphasized = false,
this.compact = false,
});
final Axis axis;
final bool emphasized;
final bool compact;
@override
Widget build(BuildContext context) {
return RotatedBox(
quarterTurns: axis == Axis.vertical ? 1 : 0,
child: DecoratedBox(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainerHigh,
borderRadius: BorderRadius.circular(8),
border: emphasized
? Border.all(color: Theme.of(context).colorScheme.primary)
: null,
),
child: Padding(
padding: EdgeInsets.symmetric(horizontal: compact ? 6 : 8),
child: Icon(
Icons.drag_handle,
size: compact ? 12 : 18,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
),
);
}
}